SPB Git

spb/ai-atlas

Public
2.5 KB · 60 lines tsx
1import Link from 'next/link';2import type { ReactNode } from 'react';3import { logoutAction } from '@/lib/admin/actions';4import { AdminNavSelect } from './nav-select';56export const ADMIN_NAV = [7  { href: '/admin/overview', label: 'Overview' },8  { href: '/admin/connectors', label: 'Connectors' },9  { href: '/admin/runs', label: 'Runs' },10  { href: '/admin/errors', label: 'Errors' },11  { href: '/admin/documents', label: 'Documents' },12  { href: '/admin/jobs', label: 'Jobs' },13  { href: '/admin/llm-jobs', label: 'LLM jobs' },14  { href: '/admin/review', label: 'Review queue' },15  { href: '/admin/entities/duplicates', label: 'Duplicates' },16  { href: '/admin/infrastructure', label: 'Infrastructure' },17  { href: '/admin/cache', label: 'Cache' },18];1920/** Admin shell: header line + left nav (≥ lg) / select (mobile). Server component; the nav highlight is done by the client select and CSS-less links. */21export function AdminShell({ children, where }: { children: ReactNode; where?: string | null }) {22  return (23    <div className="py-5 md:py-6">24      <div className="mb-4 flex flex-wrap items-center justify-between gap-3 border-b border-rule pb-3">25        <p className="mono text-xs text-ink-3">26          <span className="text-ink">AI Atlas admin</span>27          {where && <span> · {where}</span>}28        </p>29        <div className="flex items-center gap-3 text-xs">30          <Link href="/" className="text-ink-3 hover:text-ink">31            ← public site32          </Link>33          <form action={logoutAction}>34            <button type="submit" className="h-8 border border-rule px-2.5 text-xs text-ink-2 hover:border-rule-strong hover:text-ink">35              Sign out36            </button>37          </form>38        </div>39      </div>40      <div className="grid gap-6 lg:grid-cols-[11rem_minmax(0,1fr)]">41        <aside className="min-w-0">42          <AdminNavSelect items={ADMIN_NAV} />43          <nav aria-label="Admin sections" className="hidden lg:block lg:sticky lg:top-[calc(var(--header-h)+1rem)]">44            <ul className="space-y-px">45              {ADMIN_NAV.map((n) => (46                <li key={n.href}>47                  <Link href={n.href} className="flex min-h-8 items-center px-1 text-sm text-ink-2 hover:bg-surface-2 hover:text-ink">48                    {n.label}49                  </Link>50                </li>51              ))}52            </ul>53          </nav>54        </aside>55        <div className="min-w-0">{children}</div>56      </div>57    </div>58  );59}60
Files · 9f1db171c786cf4a3b99436329f29b145c02aeec
Menu

Theme