934bee2aec
- lib/admin-votes.ts: listVoteSites / createVoteSite / deleteVoteSite. - Routes /api/admin/votes (POST) y /api/admin/votes/[id] (DELETE), guard isAdmin. - Página /admin/votes (AdminVotesManager: crear/listar/borrar) + enlace en dashboard. - Conecta con la página de votación (/vote-points) ya existente. Verificado: guardas (307/403), CRUD del write layer OK (con env cargado). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { getTranslations, setRequestLocale } from 'next-intl/server'
|
|
import { redirect, Link } from '@/i18n/navigation'
|
|
import { getSession } from '@/lib/session'
|
|
import { isAdmin } from '@/lib/admin'
|
|
|
|
export const dynamic = 'force-dynamic'
|
|
|
|
export default async function AdminPage({ params }: { params: Promise<{ locale: string }> }) {
|
|
const { locale } = await params
|
|
setRequestLocale(locale)
|
|
const t = await getTranslations('Admin')
|
|
const session = await getSession()
|
|
if (!session.bnetId) redirect({ href: '/login', locale })
|
|
if (!(await isAdmin(session))) redirect({ href: '/', locale })
|
|
|
|
return (
|
|
<main className="mx-auto max-w-3xl px-4 py-8">
|
|
<h1 className="mb-6 text-2xl font-bold text-amber-500">{t('title')}</h1>
|
|
<ul className="space-y-2">
|
|
<li>
|
|
<Link href="/admin/news" className="text-sky-400 hover:underline">
|
|
{t('manageNews')}
|
|
</Link>
|
|
</li>
|
|
<li>
|
|
<Link href="/admin/prices" className="text-sky-400 hover:underline">
|
|
{t('managePrices')}
|
|
</Link>
|
|
</li>
|
|
<li>
|
|
<Link href="/admin/votes" className="text-sky-400 hover:underline">
|
|
{t('manageVotes')}
|
|
</Link>
|
|
</li>
|
|
</ul>
|
|
</main>
|
|
)
|
|
}
|