- Update all component imports from useTranslation to useTranslations - Replace react-i18next and next-i18next imports with next-intl - Convert Trans components to t.rich() for rich text formatting - Update all translation hook usage to next-intl API This affects 80+ component files across the codebase including: - Character, weapon, summon components - Auth modals (login, signup, account) - Party management components - Filter and search components - Toast notifications - About pages and content updates 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import React, { useEffect, useState } from 'react'
|
|
import Link from 'next/link'
|
|
import { useTranslations } from 'next-intl'
|
|
|
|
import Button from '~components/common/Button'
|
|
import { ResponseStatus } from '~types'
|
|
|
|
import styles from './index.module.scss'
|
|
|
|
interface Props {
|
|
status: ResponseStatus
|
|
}
|
|
|
|
const ErrorSection = ({ status }: Props) => {
|
|
// Import translations
|
|
const t = useTranslations('common')
|
|
|
|
const [statusText, setStatusText] = useState('')
|
|
|
|
useEffect(() => {
|
|
setStatusText(status.text.replaceAll(' ', '_').toLowerCase())
|
|
}, [status.text])
|
|
|
|
const errorBody = () => {
|
|
return (
|
|
<>
|
|
<div className={styles.code}>{status.code}</div>
|
|
<h1>{t(`errors.${statusText}.title`)}</h1>
|
|
<p>{t(`errors.${statusText}.description`)}</p>
|
|
</>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<section className={styles.error}>
|
|
{errorBody()}
|
|
{[401, 404].includes(status.code) ? (
|
|
<Link href="/new">
|
|
<Button text={t('errors.not_found.button')} />
|
|
</Link>
|
|
) : (
|
|
''
|
|
)}
|
|
</section>
|
|
)
|
|
}
|
|
|
|
export default ErrorSection
|