import type { Metadata } from 'next'; import Link from 'next/link'; import { requireUser } from '@/lib/auth/session'; import { listSavedSearches } from '@/lib/account/queries'; import { deleteSavedSearchAction, toggleSavedSearchNotifyAction } from '@/lib/account/actions'; import { PageHeader, btnDanger, btnGhost } from '@/components/account/page-header'; import { Card, CardHeader, EmptyState, Badge } from '@/components/ui/primitives'; import { fmtRelative } from '@/lib/format'; import { SaveSearchForm } from './save-form'; export const metadata: Metadata = { title: 'Saved searches', robots: { index: false } }; export default async function SavedPage({ searchParams }: { searchParams: Promise> }) { const sp = await searchParams; const u = await requireUser('/saved'); const rows = await listSavedSearches(u.id); return ( <>
{rows.length === 0 ? ( ) : (
    {rows.map((s) => (
  • {s.name}

    {s.url} · saved {fmtRelative(s.createdAt)} {s.lastRunAt ? ` · last run ${fmtRelative(s.lastRunAt)} (${s.lastCount ?? 0} results)` : ''}

    {s.notify ? notify : null}
  • ))}
)}
); }