SPB Git forge

spb/ai-atlas

Public
41commits 1branches 0releases
4.6 MBsize
maindefault branch
12 days agolast push
HTML 77.2% TypeScript 10.5% Python 9.6% JavaScript 2.5%
1.2 KB · 24 lines tsx
Raw Blame History
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