SPB Git

spb/ai-atlas

Public
1.2 KB · 24 lines tsx
1import type { Metadata } from 'next';2import { redirect } from 'next/navigation';3import { LoginForm } from '@/components/admin/login-form';4import { getAdminToken } from '@/lib/admin/session';56export const metadata: Metadata = { title: 'Sign in', robots: { index: false, follow: false } };7export const dynamic = 'force-dynamic';89/** `/admin`: login form, or straight to the overview when a session cookie is present (the overview validates it). */10export default async function AdminLogin({ searchParams }: { searchParams: Promise<Record<string, string | undefined>> }) {11  const sp = await searchParams;12  const token = await getAdminToken();13  if (token && !sp.expired && !sp.signed_out) redirect('/admin/overview');14  const hint = sp.expired ? 'Your session expired or the token was rejected — sign in again.' : sp.signed_out ? 'Signed out.' : null;15  return (16    <div className="py-16 md:py-24">17      <p className="eyebrow">AI Atlas</p>18      <h1 className="display mt-2 text-3xl md:text-4xl">Admin console</h1>19      <p className="mt-3 max-w-md text-sm text-ink-2">Connectors, runs, documents, jobs, review queue and infrastructure. Restricted to operators.</p>20      <LoginForm hint={hint} />21    </div>22  );23}24
Files · 988708f87b6de48ea615b846f7dee321b888038c
Menu

Theme