SPB Git forge

spb/countryatlas

Public
20commits 1branches 0releases
268.3 MBsize
maindefault branch
12 days agolast push
TypeScript 57% Python 38.6% JavaScript 3.6% CSS 0.6%
1.3 KB · 32 lines tsx
Raw Blame History
1import type { Metadata } from 'next';2import { redirect } from 'next/navigation';3import { t } from '@/i18n';4import { isAdminAuthed } from '@/lib/admin-auth';5import { routes } from '@/lib/site';6import { AdminNav } from '@/components/admin/admin-nav';7import { logoutAction } from '../actions';89export const metadata: Metadata = { title: t('admin.title'), robots: { index: false, follow: false } };10export const dynamic = 'force-dynamic';1112/** Every page in this group requires the admin cookie; otherwise → /admin/login. */13export default async function AdminLayout({ children }: { children: React.ReactNode }) {14  if (!(await isAdminAuthed())) redirect(routes.adminLogin());15  return (16    <div className="pb-10 pt-4 md:pt-6">17      <div className="flex flex-wrap items-center justify-between gap-3 border-b border-rule pb-2">18        <div className="flex min-w-0 items-center gap-4">19          <span className="eyebrow">{t('admin.title')}</span>20          <AdminNav />21        </div>22        <form action={logoutAction}>23          <button type="submit" className="inline-flex min-h-[36px] items-center rounded-sm border border-rule px-2.5 text-xs text-ink-2 hover:bg-surface-2 hover:text-ink">24            {t('admin.logout')}25          </button>26        </form>27      </div>28      <div className="min-w-0 text-sm">{children}</div>29    </div>30  );31}32