/** * Presentational primitives shared by every settings surface (user, space, * repo). Non-component helpers (useSave / inputCls / fmtDate) live in * settings-utils.ts so this file only exports components (react-refresh). */ import { Alert } from '@app/components' import { useT } from '@app/i18n' import { Button, Checkbox } from '@app/ui' import { IconCopy as Copy, IconLoader2 as Loader2 } from '@tabler/icons-react' import { type ReactNode, useState } from 'react' export function SectionTitle({ title, sub }: { title: string; sub?: string }) { return (

{title}

{sub ?

{sub}

: null}
) } export function Field({ label, children, hint }: { label: string; children: ReactNode; hint?: string }) { return ( ) } export function Toggle({ checked, onChange, label, disabled = false, }: { checked: boolean onChange: (v: boolean) => void label: string disabled?: boolean }) { return (
onChange(!checked)} > {label}
) } export function SaveBar({ onSave, busy, notice, error, label, danger = false, extra, }: { onSave: () => void busy: boolean notice: string | null error: string | null label?: string danger?: boolean extra?: ReactNode }) { const { t } = useT() return (
{extra} {notice ? {notice} : null} {error ? {error} : null}
) } export function CopyButton({ text }: { text: string }) { const { t } = useT() const [copied, setCopied] = useState(false) return ( ) } export function Busy() { const { t } = useT() return } /** One entry in a settings list: leading mark, stacked text, trailing actions. */ export function SettingRow({ lead, title, meta, actions, }: { lead?: ReactNode title: ReactNode meta?: ReactNode actions?: ReactNode }) { return (
{lead}

{title}

{meta ?

{meta}

: null}
{actions ?
{actions}
: null}
) } export function EmptyNote({ children }: { children: ReactNode }) { return

{children}

} /** Circular initials mark; used wherever a member or role needs a glyph. */ export function InitialAvatar({ name, url, size = 30 }: { name: string; url?: string | null; size?: number }) { if (url) { return ( ) } return ( {(name.trim()[0] ?? '?').toUpperCase()} ) } /** A short run of inline chips (roles, permissions, states). */ export function Chip({ children }: { children: ReactNode }) { return ( {children} ) }