d9e6ff1496
- lib/admin-gold.ts: list/create/delete sobre home_goldprice (id, gold_amount, price). - API: POST /api/admin/gold, DELETE /api/admin/gold/[id] (403 sin admin). - UI: /admin/gold con AdminGoldManager (alta ordenada por cantidad + borrado), enlace desde el índice del admin. - i18n es/en (Admin): manageGold, gold, goldAmount, goldPrice, goldUnit, noGold. Verificado: build OK, /admin/gold 307→login sin sesión, APIs 403 sin admin, columnas confirmadas en la migración Django. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
44 lines
1.4 KiB
TypeScript
44 lines
1.4 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>
|
|
<li>
|
|
<Link href="/admin/gold" className="text-sky-400 hover:underline">
|
|
{t('manageGold')}
|
|
</Link>
|
|
</li>
|
|
</ul>
|
|
</main>
|
|
)
|
|
}
|