| 3 | import { useTranslation } from 'react-i18next' |
| 4 | |
| 5 | function ErrorState({ error, onRetry }: { error?: Error; onRetry?: () => void }) { |
| 6 | const { t } = useTranslation() |
| 7 | const navigate = useNavigate() |
| 8 | |
| 9 | return ( |
| 10 | <VStack gap={4} p={8} textAlign="center"> |
| 11 | <Text color="red.500" fontSize="lg"> |
| 12 | {error?.message || 'Something went wrong'} |
| 13 | </Text> |
| 14 | {onRetry ? ( |
| 15 | <Button onClick={onRetry}>{t('general.errors.tryAgain')}</Button> |
| 16 | ) : ( |
| 17 | <Button onClick={() => navigate({ to: '/collections' })}> |
| 18 | {t('general.actions.goHome')} |
| 19 | </Button> |
| 20 | )} |
| 21 | </VStack> |
| 22 | ) |
| 23 | } |
| 24 | |
| 25 | export default ErrorState |