import { getTranslations, setRequestLocale } from 'next-intl/server'
import { getSession } from '@/lib/session'
import { getVoteSites } from '@/lib/vote'
import { VotePanel } from '@/components/VotePanel'

export const dynamic = 'force-dynamic'

export default async function VotePointsPage({ params }: { params: Promise<{ locale: string }> }) {
  const { locale } = await params
  setRequestLocale(locale)
  const t = await getTranslations('Vote')
  const session = await getSession()
  const sites = await getVoteSites()
  return (
    <main className="mx-auto max-w-3xl px-4 py-8">
      <h1 className="mb-3 text-2xl font-bold text-amber-500">{t('title')}</h1>
      <p className="mb-6 text-sm text-amber-200/70">{t('info', { server: 'Nova WoW' })}</p>
      <VotePanel sites={sites} canVote={Boolean(session.accountId)} />
    </main>
  )
}
