hensei-web/app/p/[party]/PartyPageClient.tsx
Justin Edmund 218a524b55 Fix Party component interface and remove unstable_cache
- Update NewPartyClient and PartyPageClient to use correct Party props
- Remove unstable_cache from all data fetching functions
- Fix viewport metadata configuration in App Router
- Restore ToastViewport component in layout
- Fix import paths from 'types' to '~types' in Party components
- Add comprehensive PRD documenting the fixes

This addresses the interface mismatch between Party component and its
client wrappers that occurred during the App Router migration.
2025-09-01 19:06:22 -07:00

74 lines
No EOL
1.7 KiB
TypeScript

'use client'
import React, { useEffect, useState } from 'react'
import { useTranslation } from 'next-i18next'
import { useRouter } from 'next/navigation'
// Utils
import { appState } from '~/utils/appState'
import { GridType } from '~/utils/enums'
// Components
import Party from '~/components/party/Party'
import PartyFooter from '~/components/party/PartyFooter'
import ErrorSection from '~/components/ErrorSection'
interface Props {
party: any; // Replace with proper Party type
raidGroups: any[]; // Replace with proper RaidGroup type
}
const PartyPageClient: React.FC<Props> = ({ party, raidGroups }) => {
const router = useRouter()
const { t } = useTranslation('common')
// State for tab management
const [selectedTab, setSelectedTab] = useState<GridType>(GridType.Weapon)
// Initialize app state
useEffect(() => {
if (party) {
appState.parties[0] = party
appState.raidGroups = raidGroups
}
}, [party, raidGroups])
// Handle tab change
const handleTabChanged = (value: string) => {
const tabType = parseInt(value) as GridType
setSelectedTab(tabType)
}
// Navigation helper (not used for existing parties but required by interface)
const pushHistory = (path: string) => {
router.push(path)
}
// Error case
if (!party) {
return (
<ErrorSection
status={{
code: 404,
text: 'not_found'
}}
/>
)
}
return (
<>
<Party
team={party}
selectedTab={selectedTab}
raidGroups={raidGroups}
handleTabChanged={handleTabChanged}
pushHistory={pushHistory}
/>
<PartyFooter party={party} />
</>
)
}
export default PartyPageClient