Colors (GSD palette) untouched. New visual vocabulary across the whole GUI: - warm-tinted layered shadow tokens (--shadow-xs/sm/md) replacing flat rings; cards/dialogs framed with hairline border + real elevation - strict radii scale: xl cards / lg inputs / md controls / 2xl dialogs; buttons move from pills to rounded-md - third type register: --font-mono + tabular-nums on SQL, timers, dates, ids; standardized .thot-label micro-label tier - prose: framed tables with uppercase headers, elevated code blocks - SqlViewer badges moved from hardcoded Tailwind greens/reds to success/ destructive token tints; ResultsPanel inline styles replaced with classes - artifact gate: first option rendered as filled primary action Verified offline via Playwright against a mock backend replaying a real psd session (no VPN needed). tsc clean, 115/115 vitest. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
78 lines
2.7 KiB
TypeScript
78 lines
2.7 KiB
TypeScript
// frontend/src/shell/NavSessions.tsx
|
|
import type { ReactNode } from "react";
|
|
import type { SessionSummary } from "../api/types";
|
|
|
|
interface Props {
|
|
sessions: SessionSummary[];
|
|
activeSessionId: string | null;
|
|
onOpenPanel: (id: string) => void;
|
|
menuFor: (session: SessionSummary) => ReactNode;
|
|
}
|
|
|
|
export function NavSessions({ sessions, activeSessionId, onOpenPanel, menuFor }: Props) {
|
|
if (sessions.length === 0) {
|
|
return (
|
|
<p className="px-1 py-6 text-center text-xs text-muted-foreground">
|
|
No sessions yet. Start with <span className="font-medium text-foreground">New session</span>.
|
|
</p>
|
|
);
|
|
}
|
|
return (
|
|
<ul className="flex flex-col gap-px">
|
|
{sessions.map((s) => {
|
|
const active = s.id === activeSessionId;
|
|
const label = s.name || s.question || s.id;
|
|
return (
|
|
<li key={s.id}>
|
|
<div
|
|
data-testid={`session-item-${s.id}`}
|
|
data-active={active ? "true" : "false"}
|
|
onClick={() => onOpenPanel(s.id)}
|
|
role="button"
|
|
tabIndex={0}
|
|
aria-label={label}
|
|
title={`${label} · ${s.status}`}
|
|
onKeyDown={(e) => {
|
|
if (e.key === "Enter" || e.key === " ") {
|
|
e.preventDefault();
|
|
onOpenPanel(s.id);
|
|
}
|
|
}}
|
|
className={[
|
|
"group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1 text-left transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
// The in-progress (active) session is marked in yellow — both its dot
|
|
// and its row background — so it stands out from the rest of the rail.
|
|
active ? "bg-[oklch(var(--warning)/0.22)]" : "hover:bg-accent",
|
|
].join(" ")}
|
|
>
|
|
<span
|
|
aria-hidden
|
|
title={s.status}
|
|
className={[
|
|
"size-1.5 shrink-0 rounded-full",
|
|
active
|
|
? "bg-[oklch(var(--warning))]"
|
|
: s.status === "open"
|
|
? "bg-[oklch(var(--success))]"
|
|
: s.status === "finalized"
|
|
? "bg-primary"
|
|
: "bg-muted-foreground/50",
|
|
].join(" ")}
|
|
/>
|
|
<span
|
|
className={[
|
|
"min-w-0 flex-1 truncate text-[0.8rem] leading-snug",
|
|
active ? "font-semibold text-foreground" : "font-medium text-foreground/90",
|
|
].join(" ")}
|
|
>
|
|
{label}
|
|
</span>
|
|
{menuFor(s)}
|
|
</div>
|
|
</li>
|
|
);
|
|
})}
|
|
</ul>
|
|
);
|
|
}
|