import { getTranslations, setRequestLocale } from 'next-intl/server'
import { getSession } from '@/lib/session'
import { getVoteSites } from '@/lib/vote'
import { PageShell } from '@/components/PageShell'
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 (
    <PageShell title={t('title')}>
      <div className="box-content">
        <div className="body-box-content centered">
          <p>{t('info', { server: 'NovaWoW' })}</p>
          <br />
          <VotePanel sites={sites} canVote={Boolean(session.accountId)} />
        </div>
      </div>
    </PageShell>
  )
}
