import { useT } from '@app/i18n'
import { IconCheck as Check, IconCopy as Copy } from '@tabler/icons-react'
import { useState } from 'react'
/** Shared empty / error / copy affordances for the repo views. */
export function PanelNote({ text }: { text: string }) {
return
{text}
}
export function ErrorPanel({
status,
what,
onRetry,
note,
}: {
status: number
what: string
onRetry: () => void
note?: string
}) {
const { t } = useT()
const text =
status === 404
? t('ui.notFoundOnRevision', { what })
: status === 401 || status === 403
? t('ui.forbidden', { what })
: status === 0
? t('ui.loadFailedWithNote', { what, note: note ?? t('error.status.0') })
: t('ui.loadFailedWithStatus', { what, status })
return (
{text}
)
}
/** Copy-to-clipboard chip used for object ids; falls back silently when the
* clipboard API is unavailable (insecure context / permission denied). */
export function CopyChip({ text, label }: { text: string; label?: string }) {
const { t } = useT()
const [copied, setCopied] = useState(false)
return (
)
}