## Summary
- Fixed translation key format compatibility with next-intl
- Fixed pluralization format from i18next to next-intl format
- Fixed dynamic translation key error handling
- Updated server components to match API response structure
- Fixed useSearchParams import location
## Changes
- Changed pluralization from `{{count}} items` to `{count} items` format
- Added proper error handling for missing translation keys
- Fixed import paths for next-intl hooks
- Fixed PartyPageClient trying to set non-existent appState.parties
## Test plan
- [x] Verified translations render correctly
- [x] Tested pluralization works with different counts
- [x] Confirmed no console errors about missing translations
- [x] Tested party page functionality
🤖 Generated with [Claude Code](https://claude.ai/code)
---------
Co-authored-by: Claude <noreply@anthropic.com>
61 lines
1.4 KiB
TypeScript
61 lines
1.4 KiB
TypeScript
import React from 'react'
|
|
import { useTranslations } from 'next-intl'
|
|
import classNames from 'classnames'
|
|
import GuidebookUnit from '../GuidebookUnit'
|
|
|
|
import type { SearchableObject } from '~types'
|
|
|
|
import styles from './index.module.scss'
|
|
|
|
// Props
|
|
interface Props {
|
|
grid: GuidebookList
|
|
editable: boolean
|
|
removeGuidebook: (position: number) => void
|
|
updateObject: (object: SearchableObject, position: number) => void
|
|
}
|
|
|
|
// Constants
|
|
const EXTRA_WEAPONS_COUNT = 3
|
|
|
|
const GuidebooksGrid = ({
|
|
grid,
|
|
editable,
|
|
removeGuidebook,
|
|
updateObject,
|
|
}: Props) => {
|
|
const t = useTranslations('common')
|
|
|
|
const classes = classNames({
|
|
[styles.guidebooks]: true,
|
|
[styles.containerItem]: true,
|
|
})
|
|
|
|
const guidebooks = (
|
|
<ul className={styles.grid}>
|
|
{Array.from(Array(EXTRA_WEAPONS_COUNT)).map((x, i) => {
|
|
const itemClasses = classNames({
|
|
Empty: grid && grid[i] === undefined,
|
|
})
|
|
|
|
return (
|
|
<li className={itemClasses} key={`grid_unit_${i}`}>
|
|
<GuidebookUnit
|
|
editable={editable}
|
|
position={i + 1}
|
|
guidebook={grid[i + 1]}
|
|
removeGuidebook={removeGuidebook}
|
|
updateObject={updateObject}
|
|
/>
|
|
</li>
|
|
)
|
|
})}
|
|
</ul>
|
|
)
|
|
|
|
const guidebookElement = <div className={classes}>{guidebooks}</div>
|
|
|
|
return guidebookElement
|
|
}
|
|
|
|
export default GuidebooksGrid
|