Add colour tokens, dark mode and drop gradients

- Colour tokens in index.css named by role (ink, body, muted, link,
  brand, action, surface, tint, danger), used everywhere instead of hex
- Dark mode: follows the system, a header toggle (site and admin)
  overrides it and is remembered; set before first paint in index.html
- Data colours go through src/lib/color.ts: withAlpha for tints,
  accentText (lighter on dark) for text in an accent, readableOn for
  text on one, so an admin's pale colour still reads
- Migration 040 drops events.gradient: a card is its photo or plain,
  with its colour as the border; other decorative gradients are solid
- The countdown and a hero event without a photo mix their colour
  toward ink behind white text

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-28 22:42:59 -05:00
parent ee61568911
commit c74ad746f5
70 changed files with 829 additions and 596 deletions

View file

@ -54,8 +54,8 @@ function Block({ title, note, children }: any) {
return (
<section className="mt-8 first:mt-0">
<div className="flex items-baseline gap-3">
<h2 className="text-lg font-semibold text-[#0f7183]">{title}</h2>
{note && <p className="text-sm text-[#4a6b72]">{note}</p>}
<h2 className="text-lg font-semibold text-link">{title}</h2>
{note && <p className="text-sm text-muted">{note}</p>}
</div>
<div className="mt-3">{children}</div>
</section>
@ -64,8 +64,8 @@ function Block({ title, note, children }: any) {
function Stat({ label, value }) {
return (
<div className="rounded-xl border border-[#138ba0]/20 bg-white px-4 py-3">
<div className="text-xs font-medium uppercase tracking-wider text-[#4a6b72]/70">
<div className="rounded-xl border border-brand/20 bg-surface px-4 py-3">
<div className="text-xs font-medium uppercase tracking-wider text-muted/70">
{label}
</div>
<div className="mt-1 break-words text-sm font-medium text-[#0f2f36]">{value}</div>
@ -143,7 +143,7 @@ export default function AdminPanel() {
if (loading) {
return (
<p className="py-12 text-[#4a6b72]" role="status">
<p className="py-12 text-muted" role="status">
Loading the panel…
</p>
);
@ -152,11 +152,11 @@ export default function AdminPanel() {
if (error) {
return (
<div className="py-12">
<p className="text-[#b3261e]">{error}</p>
<p className="text-danger">{error}</p>
<button
type="button"
onClick={load}
className="mt-3 rounded-full border border-[#138ba0] px-4 py-1.5 text-sm font-medium text-[#0f7183] transition-colors hover:bg-[#eef9fb]"
className="mt-3 rounded-full border border-brand px-4 py-1.5 text-sm font-medium text-link transition-colors hover:bg-tint"
>
Try again
</button>
@ -171,8 +171,8 @@ export default function AdminPanel() {
return (
<div>
<h1 className="text-2xl font-bold text-[#0f7183]">Panel</h1>
<p className="mt-1 text-[#4a6b72]">
<h1 className="text-2xl font-bold text-link">Panel</h1>
<p className="mt-1 text-muted">
Accounts and server state. Everything here is superadmin-only.
</p>
@ -186,7 +186,7 @@ export default function AdminPanel() {
<Stat label="Live sessions" value={system.sessions} />
</div>
{system.dbPath && (
<p className="mt-3 font-mono text-xs text-[#4a6b72]/70">{system.dbPath}</p>
<p className="mt-3 font-mono text-xs text-muted/70">{system.dbPath}</p>
)}
</Block>
@ -195,7 +195,7 @@ export default function AdminPanel() {
{content.map((row) => (
<span
key={row.label}
className="rounded-full border border-[#138ba0]/20 bg-white px-3 py-1 text-sm text-[#4a6b72]"
className="rounded-full border border-brand/20 bg-surface px-3 py-1 text-sm text-muted"
>
{row.label}{" "}
<strong className="font-semibold text-[#0f2f36]">
@ -210,9 +210,9 @@ export default function AdminPanel() {
title="Accounts"
note="Changing a role or disabling an account signs that person out."
>
<div className="overflow-x-auto rounded-2xl border border-[#138ba0]/20 bg-white">
<div className="overflow-x-auto rounded-2xl border border-brand/20 bg-surface">
<table className="w-full min-w-[46rem] text-left text-sm">
<thead className="border-b border-[#138ba0]/15 text-xs uppercase tracking-wider text-[#4a6b72]/70">
<thead className="border-b border-brand/15 text-xs uppercase tracking-wider text-muted/70">
<tr>
<th className="px-4 py-3 font-medium">Account</th>
<th className="px-4 py-3 font-medium">Role</th>
@ -221,7 +221,7 @@ export default function AdminPanel() {
<th className="px-4 py-3 font-medium">Access</th>
</tr>
</thead>
<tbody className="divide-y divide-[#138ba0]/10">
<tbody className="divide-y divide-brand/10">
{users.map((row) => {
const isMe = row.id === me?.id;
const lastSuper =
@ -230,21 +230,21 @@ export default function AdminPanel() {
const busy = busyId === row.id;
return (
<tr key={row.id} className={row.is_active ? "" : "bg-[#f6fbfc]"}>
<tr key={row.id} className={row.is_active ? "" : "bg-tint-soft"}>
<td className="px-4 py-3">
<div className="font-medium text-[#0f2f36]">
{row.name || row.email}
{isMe && (
<span className="ml-2 text-xs font-normal text-[#4a6b72]/70">
<span className="ml-2 text-xs font-normal text-muted/70">
you
</span>
)}
</div>
{row.name && (
<div className="text-xs text-[#4a6b72]/80">{row.email}</div>
<div className="text-xs text-muted/80">{row.email}</div>
)}
{rowError?.id === row.id && (
<div className="mt-1 text-xs text-[#b3261e]">
<div className="mt-1 text-xs text-danger">
{rowError.message}
</div>
)}
@ -255,7 +255,7 @@ export default function AdminPanel() {
value={row.role}
disabled={locked || busy}
onChange={(e) => changeRole(row, e.target.value)}
className="rounded-lg border border-[#138ba0]/30 bg-white px-2 py-1 text-sm text-[#0f2f36] disabled:cursor-not-allowed disabled:bg-[#f6fbfc] disabled:text-[#4a6b72]/60"
className="rounded-lg border border-brand/30 bg-surface px-2 py-1 text-sm text-[#0f2f36] disabled:cursor-not-allowed disabled:bg-tint-soft disabled:text-muted/60"
title={
isMe
? "You can't change your own role."
@ -272,16 +272,16 @@ export default function AdminPanel() {
</select>
</td>
<td className="px-4 py-3 text-[#4a6b72]">{when(row.last_login_at)}</td>
<td className="px-4 py-3 text-muted">{when(row.last_login_at)}</td>
<td className="px-4 py-3">
<span className="text-[#4a6b72]">{row.sessions}</span>
<span className="text-muted">{row.sessions}</span>
{row.sessions > 0 && (
<button
type="button"
disabled={busy}
onClick={() => revoke(row)}
className="ml-3 text-xs font-medium text-[#0f7183] underline-offset-4 hover:underline disabled:opacity-50"
className="ml-3 text-xs font-medium text-link underline-offset-4 hover:underline disabled:opacity-50"
>
Sign out
</button>
@ -295,8 +295,8 @@ export default function AdminPanel() {
onClick={() => setActive(row, row.is_active ? 0 : 1)}
className={`rounded-full border px-3 py-1 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${
row.is_active
? "border-[#4a6b72]/30 text-[#4a6b72] hover:border-[#b3261e]/50 hover:text-[#b3261e]"
: "border-[#138ba0]/40 text-[#0f7183] hover:bg-[#eef9fb]"
? "border-muted/30 text-muted hover:border-danger/50 hover:text-danger"
: "border-brand/40 text-link hover:bg-tint"
}`}
>
{row.is_active ? "Disable" : "Enable"}
@ -317,12 +317,12 @@ export default function AdminPanel() {
<dt className="shrink-0 font-medium text-[#0f2f36]">
{ROLE_LABELS[role]}
</dt>
<dd className="text-[#4a6b72]">{ROLE_NOTES[role]}</dd>
<dd className="text-muted">{ROLE_NOTES[role]}</dd>
</div>
))}
</dl>
<p className="mt-4 text-xs text-[#4a6b72]/80">
<p className="mt-4 text-xs text-muted/80">
New accounts are still created with <code>admin-cli.js</code> on the server.
</p>
</Block>