({
message = 'Something went wrong',
onRetry,
className,
}: Readonly<QueryErrorProps>)
| 13 | import { EmptyState } from '@/components/empty-state'; |
| 14 | import { AccessibleStatus } from '@/components/ui/accessible-status'; |
| 15 | import { Button } from '@/components/ui/button'; |
| 16 | import { Text } from '@/components/ui/text'; |
| 17 | |
| 18 | export type QueryErrorVariant = 'neutral' | 'offline' | 'permission' | 'not-found' | 'server'; |
| 19 | |
| 20 | const VARIANT_ICONS = { |
| 21 | neutral: AlertCircle, |
| 22 | offline: WifiOff, |
| 23 | permission: Lock, |
| 24 | 'not-found': SearchX, |
| 25 | server: ServerCrash, |
| 26 | } satisfies Record<QueryErrorVariant, LucideIcon>; |
| 27 | |
| 28 | const VARIANT_META_KEYS = { |
| 29 | neutral: { title: 'common.somethingWentWrong', description: 'queryError.neutralDescription' }, |
| 30 | offline: { title: 'queryError.offlineTitle', description: 'common.somethingWentWrong' }, |
| 31 | permission: { |
| 32 | title: 'common.accessDenied', |
| 33 | description: 'queryError.permissionDescription', |
| 34 | }, |
| 35 | 'not-found': { |
| 36 | title: 'common.notFound', |
| 37 | description: 'queryError.notFoundDescription', |
| 38 | }, |
| 39 | server: { title: 'queryError.serverTitle', description: 'queryError.serverDescription' }, |
| 40 | } as const; |
| 41 | |
| 42 | function variantMeta(t: TFunction, variant: QueryErrorVariant) { |
| 43 | const meta = VARIANT_META_KEYS[variant]; |
nothing calls this directly
no test coverage detected