hensei-web/components/about/UpdatesPage/index.tsx
Justin Edmund 73395efee8
Migrate about pages to App Router (#432)
## Summary
- Migrated about, updates, and roadmap pages from Pages Router to App
Router
- Fixed profile page data loading and display
- Created API route handlers for proxying backend calls
- Fixed translation format issues with next-intl

## Changes
- Created new App Router pages under `/app/[locale]/`
- Fixed translation interpolation from `{{variable}}` to `{variable}`
format
- Added API routes for characters, raids, summons, and weapons
- Fixed infinite recursion in ChangelogUnit by renaming fetch function
- Converted from useTranslation to useTranslations hook

## Test plan
- [x] About page loads and displays correctly
- [x] Updates page fetches and displays changelog data
- [x] Roadmap page renders without errors
- [x] Profile page shows user teams correctly
- [x] All translations render properly

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-03 17:20:16 -07:00

69 lines
1.9 KiB
TypeScript

import React, { useState } from 'react'
import { useTranslations } from 'next-intl'
import classNames from 'classnames'
import ContentUpdate2022 from '../updates/ContentUpdate2022'
import ContentUpdate2023 from '../updates/ContentUpdate2023'
import ContentUpdate2024 from '../updates/ContentUpdate2024'
import styles from './index.module.scss'
const UpdatesPage = () => {
const common = useTranslations('common')
const updates = useTranslations('updates')
const classes = classNames(styles.updates, 'PageContent')
// Default to most recent year with content (2024)
const [activeYear, setActiveYear] = useState(2024)
const getYearButtonClass = (year: number) =>
classNames({
[styles.yearButton]: true,
[styles.active]: activeYear === year,
})
// Render the component based on the active year
const renderContentUpdate = () => {
switch (activeYear) {
case 2022:
return <ContentUpdate2022 />
case 2023:
return <ContentUpdate2023 />
case 2024:
return <ContentUpdate2024 />
default:
return <div>{updates('noUpdates')}</div>
}
}
return (
<div className={classes}>
<div className={styles.top}>
<h1>{common('about.segmented_control.updates')}</h1>
<div className={styles.yearSelector}>
<button
className={getYearButtonClass(2024)}
onClick={() => setActiveYear(2024)}
>
2024
</button>
<button
className={getYearButtonClass(2023)}
onClick={() => setActiveYear(2023)}
>
2023
</button>
<button
className={getYearButtonClass(2022)}
onClick={() => setActiveYear(2022)}
>
2022
</button>
</div>
</div>
{renderContentUpdate()}
</div>
)
}
export default UpdatesPage