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:
parent
ee61568911
commit
c74ad746f5
70 changed files with 829 additions and 596 deletions
|
|
@ -18,9 +18,10 @@ import { useCallback, useEffect, useRef, useState, type ReactNode } from "react"
|
|||
import { Link } from "react-router-dom";
|
||||
|
||||
import { ApiError, del, get, post } from "../../lib/api.ts";
|
||||
import { accentText } from '../../lib/color.ts'
|
||||
|
||||
const TEAL = "#0f7183";
|
||||
const MUTED = "#4a6b72";
|
||||
const MUTED = "var(--color-muted)";
|
||||
const POLL_MS = 2000;
|
||||
|
||||
type Job = {
|
||||
|
|
@ -81,29 +82,29 @@ function sizeOf(bytes: number | null): string {
|
|||
}
|
||||
|
||||
const button =
|
||||
"rounded-full border border-[#138ba0] px-4 py-2 text-sm font-semibold text-[#0f7183] transition-colors hover:bg-[#eef9fb] disabled:cursor-default disabled:opacity-50";
|
||||
"rounded-full border border-brand px-4 py-2 text-sm font-semibold text-link transition-colors hover:bg-tint disabled:cursor-default disabled:opacity-50";
|
||||
const primary =
|
||||
"rounded-full bg-[#0f7183] px-5 py-2.5 font-semibold text-white transition-colors hover:bg-[#0b5c6a] disabled:bg-[#4a6b72]/25";
|
||||
"rounded-full bg-action px-5 py-2.5 font-semibold text-white transition-colors hover:bg-action-hover disabled:bg-muted/25";
|
||||
const input =
|
||||
"rounded-lg border border-[#4a6b72]/25 bg-white px-3 py-2 text-sm text-[#26454c] outline-none focus:border-[#138ba0] focus:ring-2 focus:ring-[#138ba0]/25";
|
||||
"rounded-lg border border-muted/25 bg-surface px-3 py-2 text-sm text-body outline-none focus:border-brand focus:ring-2 focus:ring-brand/25";
|
||||
|
||||
function Card({ title, children }: { title: string; children: ReactNode }) {
|
||||
return (
|
||||
<section className="mt-6 rounded-2xl border border-[#138ba0]/20 bg-white p-5">
|
||||
<h2 className="text-lg font-semibold text-[#26454c]">{title}</h2>
|
||||
<section className="mt-6 rounded-2xl border border-brand/20 bg-surface p-5">
|
||||
<h2 className="text-lg font-semibold text-body">{title}</h2>
|
||||
<div className="mt-4">{children}</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function Status({ job }: { job: Job }) {
|
||||
if (job.status === "failed") return <p className="text-sm text-[#b3261e]">Failed: {job.error}</p>;
|
||||
if (job.status === "failed") return <p className="text-sm text-danger">Failed: {job.error}</p>;
|
||||
if (job.status === "done") return null;
|
||||
const percent = Math.round(job.progress * 100);
|
||||
return (
|
||||
<div className="mt-2">
|
||||
<div className="h-2 overflow-hidden rounded-full bg-[#eef9fb]">
|
||||
<div className="h-full bg-[#0f7183] transition-all" style={{ width: `${job.status === "queued" ? 0 : percent}%` }} />
|
||||
<div className="h-2 overflow-hidden rounded-full bg-tint">
|
||||
<div className="h-full bg-action transition-all" style={{ width: `${job.status === "queued" ? 0 : percent}%` }} />
|
||||
</div>
|
||||
<p className="mt-1 text-xs" style={{ color: MUTED }}>
|
||||
{job.status === "queued" ? "Waiting its turn…" : `${percent}%`}
|
||||
|
|
@ -212,7 +213,7 @@ function Editor({ source, onMade }: { source: Job; onMade: () => void }) {
|
|||
] as const
|
||||
).map(([label, text, setText, setAt, value]) => (
|
||||
<div key={label}>
|
||||
<label className="block text-sm font-medium text-[#26454c]" htmlFor={`clip-${label}`}>
|
||||
<label className="block text-sm font-medium text-body" htmlFor={`clip-${label}`}>
|
||||
{label}
|
||||
</label>
|
||||
<input
|
||||
|
|
@ -233,7 +234,7 @@ function Editor({ source, onMade }: { source: Job; onMade: () => void }) {
|
|||
<button
|
||||
type="button"
|
||||
className="text-sm underline"
|
||||
style={{ color: TEAL }}
|
||||
style={{ color: accentText(TEAL) }}
|
||||
onClick={() => {
|
||||
if (videoRef.current) videoRef.current.currentTime = value;
|
||||
}}
|
||||
|
|
@ -249,7 +250,7 @@ function Editor({ source, onMade }: { source: Job; onMade: () => void }) {
|
|||
</p>
|
||||
|
||||
<div>
|
||||
<p className="text-sm font-medium text-[#26454c]">Make it</p>
|
||||
<p className="text-sm font-medium text-body">Make it</p>
|
||||
<div className="mt-2 flex gap-4 text-sm">
|
||||
{[
|
||||
["video", "Video (MP4)"],
|
||||
|
|
@ -265,7 +266,7 @@ function Editor({ source, onMade }: { source: Job; onMade: () => void }) {
|
|||
|
||||
{format === "video" && (
|
||||
<div>
|
||||
<p className="text-sm font-medium text-[#26454c]">Shape</p>
|
||||
<p className="text-sm font-medium text-body">Shape</p>
|
||||
<div className="mt-2 grid gap-1.5 text-sm">
|
||||
{SHAPES.map(([id, label]) => (
|
||||
<label key={id} className="flex items-center gap-2">
|
||||
|
|
@ -275,7 +276,7 @@ function Editor({ source, onMade }: { source: Job; onMade: () => void }) {
|
|||
))}
|
||||
</div>
|
||||
{target && (
|
||||
<label className="mt-3 block text-sm text-[#26454c]">
|
||||
<label className="mt-3 block text-sm text-body">
|
||||
Where to crop
|
||||
<input
|
||||
type="range"
|
||||
|
|
@ -284,7 +285,7 @@ function Editor({ source, onMade }: { source: Job; onMade: () => void }) {
|
|||
step={0.01}
|
||||
value={focus}
|
||||
onChange={(e) => setFocus(Number(e.target.value))}
|
||||
className="mt-1 w-full accent-[#138ba0]"
|
||||
className="mt-1 w-full accent-brand"
|
||||
/>
|
||||
<span className="text-xs" style={{ color: MUTED }}>
|
||||
The white box on the video is what's kept.
|
||||
|
|
@ -297,7 +298,7 @@ function Editor({ source, onMade }: { source: Job; onMade: () => void }) {
|
|||
<button type="button" className={primary} disabled={busy || end <= start} onClick={make}>
|
||||
{busy ? "Queuing…" : "Make clip"}
|
||||
</button>
|
||||
{error && <p className="text-sm text-[#b3261e]">{error}</p>}
|
||||
{error && <p className="text-sm text-danger">{error}</p>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
@ -368,14 +369,14 @@ export default function AdminClips() {
|
|||
return (
|
||||
<div>
|
||||
<div className="flex flex-wrap items-baseline gap-3">
|
||||
<h1 className="text-2xl font-bold text-[#0f7183]">Video clips</h1>
|
||||
<h1 className="text-2xl font-bold text-link">Video clips</h1>
|
||||
<p className="text-sm" style={{ color: MUTED }}>
|
||||
Cut clips from our YouTube and Facebook videos, for Reels, Shorts, the site or a podcast.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{missing.length > 0 && (
|
||||
<p className="mt-4 rounded-xl bg-[#fdf3f2] px-4 py-3 text-sm text-[#b3261e]">
|
||||
<p className="mt-4 rounded-xl bg-danger-tint px-4 py-3 text-sm text-danger">
|
||||
{missing.join(" and ")} {missing.length > 1 ? "aren't" : "isn't"} installed on the server, so this
|
||||
won't work until {missing.length > 1 ? "they are" : "it is"}. See docs/video-clips.md.
|
||||
</p>
|
||||
|
|
@ -397,15 +398,15 @@ export default function AdminClips() {
|
|||
<p className="mt-2 text-xs" style={{ color: MUTED }}>
|
||||
YouTube and Facebook links only, and only videos NGU owns or has permission to use. Up to 4 hours long.
|
||||
</p>
|
||||
{addError && <p className="mt-2 text-sm text-[#b3261e]">{addError}</p>}
|
||||
{addError && <p className="mt-2 text-sm text-danger">{addError}</p>}
|
||||
|
||||
{data.sources.length > 0 && (
|
||||
<ul className="mt-5 divide-y divide-[#138ba0]/10">
|
||||
<ul className="mt-5 divide-y divide-brand/10">
|
||||
{data.sources.map((s) => (
|
||||
<li key={s.id} className="py-3">
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="truncate font-medium text-[#26454c]">{s.title ?? s.source_url}</p>
|
||||
<p className="truncate font-medium text-body">{s.title ?? s.source_url}</p>
|
||||
<p className="text-xs" style={{ color: MUTED }}>
|
||||
{[s.duration && clock(s.duration), sizeOf(s.bytes)].filter(Boolean).join(" · ")}
|
||||
</p>
|
||||
|
|
@ -418,7 +419,7 @@ export default function AdminClips() {
|
|||
{s.status !== "running" && (
|
||||
<button
|
||||
type="button"
|
||||
className="text-sm hover:text-[#b3261e]"
|
||||
className="text-sm hover:text-danger"
|
||||
style={{ color: MUTED }}
|
||||
onClick={() =>
|
||||
window.confirm("Delete this video and its clips from the server?") &&
|
||||
|
|
@ -444,13 +445,13 @@ export default function AdminClips() {
|
|||
|
||||
{data.clips.length > 0 && (
|
||||
<Card title="Clips">
|
||||
{rowError && <p className="mb-3 text-sm text-[#b3261e]">{rowError}</p>}
|
||||
<ul className="divide-y divide-[#138ba0]/10">
|
||||
{rowError && <p className="mb-3 text-sm text-danger">{rowError}</p>}
|
||||
<ul className="divide-y divide-brand/10">
|
||||
{data.clips.map((clip) => (
|
||||
<li key={clip.id} className="py-3">
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="truncate font-medium text-[#26454c]">{sourceTitle(clip.source_id)}</p>
|
||||
<p className="truncate font-medium text-body">{sourceTitle(clip.source_id)}</p>
|
||||
<p className="text-xs" style={{ color: MUTED }}>
|
||||
{clip.params &&
|
||||
[
|
||||
|
|
@ -480,7 +481,7 @@ export default function AdminClips() {
|
|||
</>
|
||||
)}
|
||||
{clip.saved_url && (
|
||||
<Link to="/admin/media" className="text-sm underline" style={{ color: TEAL }}>
|
||||
<Link to="/admin/media" className="text-sm underline" style={{ color: accentText(TEAL) }}>
|
||||
In the media library
|
||||
</Link>
|
||||
)}
|
||||
|
|
@ -492,7 +493,7 @@ export default function AdminClips() {
|
|||
{clip.status !== "running" && (
|
||||
<button
|
||||
type="button"
|
||||
className="text-sm hover:text-[#b3261e]"
|
||||
className="text-sm hover:text-danger"
|
||||
style={{ color: MUTED }}
|
||||
onClick={() => act(() => del(`/admin/clips/${clip.id}`))}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ import { feedbackTypeLabel } from "../../data/feedbackTypes.ts";
|
|||
const STATUSES = ["new", "read", "actioned", "archived", "spam"];
|
||||
|
||||
const STATUS_STYLE = {
|
||||
new: "bg-[#0f7183] text-white",
|
||||
read: "bg-[#eef9fb] text-[#0f7183]",
|
||||
new: "bg-action text-white",
|
||||
read: "bg-tint text-link",
|
||||
actioned: "bg-[#eaf3e2] text-[#4a6b2f]",
|
||||
archived: "bg-[#4a6b72]/10 text-[#4a6b72]",
|
||||
spam: "bg-[#fdf3f2] text-[#b3261e]",
|
||||
archived: "bg-muted/10 text-muted",
|
||||
spam: "bg-danger-tint text-danger",
|
||||
};
|
||||
|
||||
// created_at is UTC in 'YYYY-MM-DD HH:MM:SS' form, which Safari
|
||||
|
|
@ -89,9 +89,9 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
|||
}
|
||||
|
||||
return (
|
||||
<article className="rounded-2xl border border-[#138ba0]/20 bg-white p-5">
|
||||
<article className="rounded-2xl border border-brand/20 bg-surface p-5">
|
||||
<div className="flex flex-wrap items-center gap-x-4 gap-y-2 text-sm">
|
||||
<span className="font-semibold text-[#26454c]">
|
||||
<span className="font-semibold text-body">
|
||||
{feedbackTypeLabel(row.feedback_type)}
|
||||
</span>
|
||||
<span
|
||||
|
|
@ -101,15 +101,15 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
|||
>
|
||||
{row.status}
|
||||
</span>
|
||||
<span className="text-[#4a6b72]">{locationOf(row)}</span>
|
||||
<span className="ml-auto text-xs text-[#4a6b72]">
|
||||
<span className="text-muted">{locationOf(row)}</span>
|
||||
<span className="ml-auto text-xs text-muted">
|
||||
#{row.id} · {formatDate(row.created_at)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<p className="mt-4 whitespace-pre-wrap text-[#26454c]">{row.message}</p>
|
||||
<p className="mt-4 whitespace-pre-wrap text-body">{row.message}</p>
|
||||
|
||||
<p className="mt-4 text-sm text-[#4a6b72]">
|
||||
<p className="mt-4 text-sm text-muted">
|
||||
{row.name || row.email ? (
|
||||
<>
|
||||
{row.name && <span>{row.name}</span>}
|
||||
|
|
@ -117,7 +117,7 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
|||
{row.email && (
|
||||
<a
|
||||
href={`mailto:${row.email}?subject=Your%20NGU%20site%20feedback`}
|
||||
className="text-[#0f7183] underline underline-offset-2"
|
||||
className="text-link underline underline-offset-2"
|
||||
>
|
||||
{row.email}
|
||||
</a>
|
||||
|
|
@ -129,11 +129,11 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
|||
</p>
|
||||
|
||||
{canWrite && (
|
||||
<div className="mt-5 border-t border-[#4a6b72]/15 pt-4">
|
||||
<div className="mt-5 border-t border-muted/15 pt-4">
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<label
|
||||
htmlFor={`status-${row.id}`}
|
||||
className="text-sm font-medium text-[#26454c]"
|
||||
className="text-sm font-medium text-body"
|
||||
>
|
||||
Status
|
||||
</label>
|
||||
|
|
@ -142,7 +142,7 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
|||
value={row.status}
|
||||
disabled={busy}
|
||||
onChange={(e) => save({ status: e.target.value })}
|
||||
className="rounded-lg border border-[#4a6b72]/25 bg-white px-3 py-1.5 text-sm text-[#26454c] outline-none focus:border-[#138ba0] focus:ring-2 focus:ring-[#138ba0]/25"
|
||||
className="rounded-lg border border-muted/25 bg-surface px-3 py-1.5 text-sm text-body outline-none focus:border-brand focus:ring-2 focus:ring-brand/25"
|
||||
>
|
||||
{STATUSES.map((s) => (
|
||||
<option key={s} value={s}>
|
||||
|
|
@ -158,14 +158,14 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
|||
disabled={busy}
|
||||
placeholder="Internal note: who's handling it, what was done"
|
||||
onChange={(e) => setNote(e.target.value)}
|
||||
className="mt-3 w-full resize-y rounded-lg border border-[#4a6b72]/25 bg-white px-3 py-2 text-sm text-[#26454c] outline-none focus:border-[#138ba0] focus:ring-2 focus:ring-[#138ba0]/25"
|
||||
className="mt-3 w-full resize-y rounded-lg border border-muted/25 bg-surface px-3 py-2 text-sm text-body outline-none focus:border-brand focus:ring-2 focus:ring-brand/25"
|
||||
/>
|
||||
{noteDirty && (
|
||||
<button
|
||||
type="button"
|
||||
disabled={busy}
|
||||
onClick={() => save({ admin_note: note })}
|
||||
className="mt-2 rounded-full bg-[#0f7183] px-4 py-1.5 text-sm font-semibold text-white transition-colors hover:bg-[#0b5c6a] disabled:bg-[#4a6b72]/25"
|
||||
className="mt-2 rounded-full bg-action px-4 py-1.5 text-sm font-semibold text-white transition-colors hover:bg-action-hover disabled:bg-muted/25"
|
||||
>
|
||||
{busy ? "Saving…" : "Save note"}
|
||||
</button>
|
||||
|
|
@ -177,17 +177,17 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
|||
spam or archived is the habit this defers to. Hence the
|
||||
second click rather than a window.confirm. */}
|
||||
{canRemove && (
|
||||
<div className="mt-4 flex flex-wrap items-center gap-3 border-t border-[#4a6b72]/15 pt-4">
|
||||
<div className="mt-4 flex flex-wrap items-center gap-3 border-t border-muted/15 pt-4">
|
||||
{confirming ? (
|
||||
<>
|
||||
<span className="text-sm text-[#26454c]">
|
||||
<span className="text-sm text-body">
|
||||
Delete #{row.id} for good? Marking it spam keeps it recoverable.
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
disabled={busy}
|
||||
onClick={remove}
|
||||
className="rounded-full bg-[#b3261e] px-4 py-1.5 text-sm font-semibold text-white transition-colors hover:bg-[#8f1e18] disabled:bg-[#4a6b72]/25"
|
||||
className="rounded-full bg-danger px-4 py-1.5 text-sm font-semibold text-white transition-colors hover:bg-[#8f1e18] disabled:bg-muted/25"
|
||||
>
|
||||
{busy ? "Deleting…" : "Delete"}
|
||||
</button>
|
||||
|
|
@ -195,7 +195,7 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
|||
type="button"
|
||||
disabled={busy}
|
||||
onClick={() => setConfirming(false)}
|
||||
className="rounded-full border border-[#4a6b72]/25 px-4 py-1.5 text-sm text-[#4a6b72] transition-colors hover:border-[#4a6b72]/50"
|
||||
className="rounded-full border border-muted/25 px-4 py-1.5 text-sm text-muted transition-colors hover:border-muted/50"
|
||||
>
|
||||
Keep it
|
||||
</button>
|
||||
|
|
@ -205,7 +205,7 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
|||
type="button"
|
||||
disabled={busy}
|
||||
onClick={() => setConfirming(true)}
|
||||
className="rounded-full border border-[#b3261e]/30 px-4 py-1.5 text-sm font-medium text-[#b3261e] transition-colors hover:bg-[#fdf3f2]"
|
||||
className="rounded-full border border-danger/30 px-4 py-1.5 text-sm font-medium text-danger transition-colors hover:bg-danger-tint"
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
|
|
@ -214,7 +214,7 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
|||
)}
|
||||
|
||||
{error && (
|
||||
<p role="alert" className="mt-3 text-sm text-[#b3261e]">
|
||||
<p role="alert" className="mt-3 text-sm text-danger">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
|
|
@ -305,8 +305,8 @@ export default function AdminFeedback() {
|
|||
|
||||
return (
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold text-[#0f7183]">Feedback</h1>
|
||||
<p className="mt-2 text-sm text-[#4a6b72]">
|
||||
<h1 className="text-3xl font-bold text-link">Feedback</h1>
|
||||
<p className="mt-2 text-sm text-muted">
|
||||
{canWrite
|
||||
? "Everything submitted through the site form."
|
||||
: "Read-only: your account can't change statuses or notes."}
|
||||
|
|
@ -322,8 +322,8 @@ export default function AdminFeedback() {
|
|||
className={
|
||||
"rounded-full px-4 py-1.5 text-sm transition-colors " +
|
||||
(status === tab.id
|
||||
? "bg-[#0f7183] font-semibold text-white"
|
||||
: "border border-[#4a6b72]/25 text-[#4a6b72] hover:border-[#138ba0]/50")
|
||||
? "bg-action font-semibold text-white"
|
||||
: "border border-muted/25 text-muted hover:border-brand/50")
|
||||
}
|
||||
>
|
||||
{tab.label}
|
||||
|
|
@ -340,12 +340,12 @@ export default function AdminFeedback() {
|
|||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") setSearch(query.trim());
|
||||
}}
|
||||
className="rounded-full border border-[#4a6b72]/25 bg-white px-4 py-1.5 text-sm text-[#26454c] outline-none focus:border-[#138ba0] focus:ring-2 focus:ring-[#138ba0]/25"
|
||||
className="rounded-full border border-muted/25 bg-surface px-4 py-1.5 text-sm text-body outline-none focus:border-brand focus:ring-2 focus:ring-brand/25"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setSearch(query.trim())}
|
||||
className="rounded-full border border-[#4a6b72]/25 px-4 py-1.5 text-sm text-[#4a6b72] transition-colors hover:border-[#138ba0]/50"
|
||||
className="rounded-full border border-muted/25 px-4 py-1.5 text-sm text-muted transition-colors hover:border-brand/50"
|
||||
>
|
||||
Search
|
||||
</button>
|
||||
|
|
@ -356,14 +356,14 @@ export default function AdminFeedback() {
|
|||
{error && (
|
||||
<p
|
||||
role="alert"
|
||||
className="mt-6 rounded-xl border border-[#b3261e]/30 bg-[#fdf3f2] px-4 py-3 text-sm text-[#b3261e]"
|
||||
className="mt-6 rounded-xl border border-danger/30 bg-danger-tint px-4 py-3 text-sm text-danger"
|
||||
>
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{!loading && rows.length === 0 && !error && (
|
||||
<p className="mt-10 text-[#4a6b72]">
|
||||
<p className="mt-10 text-muted">
|
||||
Nothing here. {status === "new" ? "The queue is clear." : "Try another filter."}
|
||||
</p>
|
||||
)}
|
||||
|
|
@ -381,13 +381,13 @@ export default function AdminFeedback() {
|
|||
))}
|
||||
</div>
|
||||
|
||||
{loading && <p className="mt-6 text-sm text-[#4a6b72]">Loading…</p>}
|
||||
{loading && <p className="mt-6 text-sm text-muted">Loading…</p>}
|
||||
|
||||
{cursor && !loading && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => load(cursor)}
|
||||
className="mt-6 rounded-full border border-[#138ba0] px-5 py-2 font-semibold text-[#0f7183] transition-colors hover:bg-[#eef9fb]"
|
||||
className="mt-6 rounded-full border border-brand px-5 py-2 font-semibold text-link transition-colors hover:bg-tint"
|
||||
>
|
||||
Load older
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ function NavCard({ item }) {
|
|||
const extras = (item.children ?? []).filter((child) => child.to !== to);
|
||||
|
||||
return (
|
||||
<div className="group relative flex flex-col rounded-2xl border border-[#138ba0]/20 bg-white p-5 transition-all hover:border-[#138ba0]/60 hover:shadow-sm">
|
||||
<div className="group relative flex flex-col rounded-2xl border border-brand/20 bg-surface p-5 transition-all hover:border-brand/60 hover:shadow-sm">
|
||||
<div className="flex items-baseline gap-3">
|
||||
<h3 className="text-base font-semibold text-[#0f7183]">
|
||||
<h3 className="text-base font-semibold text-link">
|
||||
<Link
|
||||
to={to}
|
||||
className="after:absolute after:inset-0 after:rounded-2xl after:content-['']"
|
||||
|
|
@ -46,23 +46,23 @@ function NavCard({ item }) {
|
|||
</h3>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="ml-auto text-[#0f7183] opacity-0 transition-opacity group-hover:opacity-100"
|
||||
className="ml-auto text-link opacity-0 transition-opacity group-hover:opacity-100"
|
||||
>
|
||||
→
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{item.blurb && (
|
||||
<p className="mt-1.5 text-sm leading-relaxed text-[#4a6b72]">{item.blurb}</p>
|
||||
<p className="mt-1.5 text-sm leading-relaxed text-muted">{item.blurb}</p>
|
||||
)}
|
||||
|
||||
{extras.length > 0 && (
|
||||
<div className="relative z-10 mt-4 flex flex-wrap gap-x-4 gap-y-1 border-t border-[#138ba0]/10 pt-3 text-sm">
|
||||
<div className="relative z-10 mt-4 flex flex-wrap gap-x-4 gap-y-1 border-t border-brand/10 pt-3 text-sm">
|
||||
{extras.map((child) => (
|
||||
<Link
|
||||
key={child.to}
|
||||
to={child.to}
|
||||
className="text-[#4a6b72] underline-offset-4 transition-colors hover:text-[#0f7183] hover:underline"
|
||||
className="text-muted underline-offset-4 transition-colors hover:text-link hover:underline"
|
||||
>
|
||||
{child.label}
|
||||
</Link>
|
||||
|
|
@ -77,8 +77,8 @@ function CardBlock({ title, blurb, children }) {
|
|||
return (
|
||||
<div className="mt-10">
|
||||
<div className="flex items-baseline gap-3">
|
||||
<h2 className="text-lg font-semibold text-[#0f7183]">{title}</h2>
|
||||
{blurb && <p className="text-sm text-[#4a6b72]">{blurb}</p>}
|
||||
<h2 className="text-lg font-semibold text-link">{title}</h2>
|
||||
{blurb && <p className="text-sm text-muted">{blurb}</p>}
|
||||
</div>
|
||||
<div className="mt-4 grid gap-4 sm:grid-cols-2">{children}</div>
|
||||
</div>
|
||||
|
|
@ -87,11 +87,11 @@ function CardBlock({ title, blurb, children }) {
|
|||
|
||||
function PanelSection({ title, children }) {
|
||||
return (
|
||||
<section className="border-b border-[#138ba0]/10 px-5 py-4 last:border-b-0">
|
||||
<h2 className="text-xs font-semibold uppercase tracking-wider text-[#4a6b72]/70">
|
||||
<section className="border-b border-brand/10 px-5 py-4 last:border-b-0">
|
||||
<h2 className="text-xs font-semibold uppercase tracking-wider text-muted/70">
|
||||
{title}
|
||||
</h2>
|
||||
<div className="mt-2.5 text-sm text-[#4a6b72]">{children}</div>
|
||||
<div className="mt-2.5 text-sm text-muted">{children}</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
|
@ -114,10 +114,10 @@ export default function AdminHome() {
|
|||
return (
|
||||
<div className="grid gap-8 lg:grid-cols-[1fr_17rem] lg:items-start">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold text-[#0f7183]">
|
||||
<h1 className="text-2xl font-bold text-link">
|
||||
{user?.name ? `Welcome back, ${user.name.split(" ")[0]}.` : "Welcome back."}
|
||||
</h1>
|
||||
<p className="mt-1 text-[#4a6b72]">Pick a section to work in.</p>
|
||||
<p className="mt-1 text-muted">Pick a section to work in.</p>
|
||||
|
||||
{GROUPS.map((group) => (
|
||||
<CardBlock key={group.label} title={group.label} blurb={group.blurb}>
|
||||
|
|
@ -137,14 +137,14 @@ export default function AdminHome() {
|
|||
</div>
|
||||
|
||||
{/* Sticky so it stays put once the card column outgrows it. */}
|
||||
<aside className="divide-y divide-[#138ba0]/10 rounded-2xl border border-[#138ba0]/20 bg-white lg:sticky lg:top-6">
|
||||
<aside className="divide-y divide-brand/10 rounded-2xl border border-brand/20 bg-surface lg:sticky lg:top-6">
|
||||
<PanelSection title="Signed in">
|
||||
<p className="font-medium text-[#0f2f36]">{user?.name || user?.email}</p>
|
||||
{user?.name && user?.email && (
|
||||
<p className="mt-0.5 break-all text-xs text-[#4a6b72]/80">{user.email}</p>
|
||||
<p className="mt-0.5 break-all text-xs text-muted/80">{user.email}</p>
|
||||
)}
|
||||
{role && (
|
||||
<span className="mt-2 inline-block rounded-full bg-[#eef9fb] px-2.5 py-0.5 text-xs font-medium text-[#0f7183]">
|
||||
<span className="mt-2 inline-block rounded-full bg-tint px-2.5 py-0.5 text-xs font-medium text-link">
|
||||
{role}
|
||||
</span>
|
||||
)}
|
||||
|
|
@ -156,7 +156,7 @@ export default function AdminHome() {
|
|||
<li key={link.to}>
|
||||
<Link
|
||||
to={link.to}
|
||||
className="underline-offset-4 transition-colors hover:text-[#0f7183] hover:underline"
|
||||
className="underline-offset-4 transition-colors hover:text-link hover:underline"
|
||||
>
|
||||
{link.label}
|
||||
</Link>
|
||||
|
|
@ -166,12 +166,12 @@ export default function AdminHome() {
|
|||
</PanelSection>
|
||||
|
||||
<PanelSection title="Site">
|
||||
<p className="font-mono text-xs text-[#4a6b72]/80">{SITE_VERSION}</p>
|
||||
<p className="font-mono text-xs text-muted/80">{SITE_VERSION}</p>
|
||||
<a
|
||||
href="/"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="mt-2 inline-block underline-offset-4 transition-colors hover:text-[#0f7183] hover:underline"
|
||||
className="mt-2 inline-block underline-offset-4 transition-colors hover:text-link hover:underline"
|
||||
>
|
||||
View the public site ↗
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import { AdminWidthContext } from "../../lib/adminWidth.tsx";
|
|||
import { SITE_VERSION } from "../../lib/version.ts";
|
||||
import { ROLE_LABELS, isSuper } from "../../lib/roles.ts";
|
||||
import nguLogo from "../../assets/logos/NGU_Logo.svg";
|
||||
import ThemeToggle from "../../components/ThemeToggle.tsx";
|
||||
import {
|
||||
ADMIN_HOME,
|
||||
AREA_TITLES,
|
||||
|
|
@ -45,8 +46,8 @@ import {
|
|||
function GroupMenu({ item, lit, pathname }) {
|
||||
const children = item.children ?? [];
|
||||
const link = lit
|
||||
? "font-semibold text-[#0f7183]"
|
||||
: "text-[#4a6b72] transition-colors hover:text-[#0f7183]";
|
||||
? "font-semibold text-link"
|
||||
: "text-muted transition-colors hover:text-link";
|
||||
|
||||
return (
|
||||
<div className="group relative">
|
||||
|
|
@ -61,15 +62,15 @@ function GroupMenu({ item, lit, pathname }) {
|
|||
|
||||
{children.length > 1 && (
|
||||
<div className="invisible absolute left-0 top-full z-30 pt-2 opacity-0 transition-opacity group-focus-within:visible group-focus-within:opacity-100 group-hover:visible group-hover:opacity-100">
|
||||
<ul className="min-w-52 rounded-xl border border-[#138ba0]/20 bg-white p-1.5 shadow-lg">
|
||||
<ul className="min-w-52 rounded-xl border border-brand/20 bg-surface p-1.5 shadow-lg">
|
||||
{children.map((child) => (
|
||||
<li key={child.to}>
|
||||
<NavLink
|
||||
to={child.to}
|
||||
className={`block rounded-lg px-3 py-2 text-sm transition-colors hover:bg-[#eef9fb] ${
|
||||
className={`block rounded-lg px-3 py-2 text-sm transition-colors hover:bg-tint ${
|
||||
matches(pathname, child.to)
|
||||
? "font-semibold text-[#0f7183]"
|
||||
: "text-[#26454c]"
|
||||
? "font-semibold text-link"
|
||||
: "text-body"
|
||||
}`}
|
||||
>
|
||||
{child.label}
|
||||
|
|
@ -130,11 +131,11 @@ export default function AdminLayout() {
|
|||
|
||||
const subnav = active?.children ?? [];
|
||||
|
||||
const wordmark = <span className="text-lg font-bold text-[#0f7183]">{areaTitle}</span>;
|
||||
const wordmark = <span className="text-lg font-bold text-link">{areaTitle}</span>;
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen flex-col bg-[#f6fbfc]">
|
||||
<header className="border-b border-[#138ba0]/20 bg-white">
|
||||
<div className="flex min-h-screen flex-col bg-tint-soft">
|
||||
<header className="border-b border-brand/20 bg-surface">
|
||||
<div className="mx-auto flex max-w-5xl flex-wrap items-center gap-x-8 gap-y-3 px-6 py-4">
|
||||
{/* Already home, so nothing to link to. */}
|
||||
{isHome ? (
|
||||
|
|
@ -156,7 +157,7 @@ export default function AdminLayout() {
|
|||
{item.separated && (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="h-4 w-px bg-[#4a6b72]/25"
|
||||
className="h-4 w-px bg-muted/25"
|
||||
/>
|
||||
)}
|
||||
<GroupMenu item={item} lit={item === active} pathname={pathname} />
|
||||
|
|
@ -165,14 +166,15 @@ export default function AdminLayout() {
|
|||
</nav>
|
||||
)}
|
||||
|
||||
<div className="ml-auto flex items-center gap-4 text-sm text-[#4a6b72]">
|
||||
<div className="ml-auto flex items-center gap-4 text-sm text-muted">
|
||||
<ThemeToggle className="hover:bg-tint hover:text-link" />
|
||||
<span>
|
||||
{user?.name || user?.email}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleLogout}
|
||||
className="rounded-full border border-[#4a6b72]/30 px-4 py-1.5 font-medium transition-colors hover:bg-[#eef9fb] hover:text-[#0f7183]"
|
||||
className="rounded-full border border-muted/30 px-4 py-1.5 font-medium transition-colors hover:bg-tint hover:text-link"
|
||||
>
|
||||
Sign out
|
||||
</button>
|
||||
|
|
@ -182,7 +184,7 @@ export default function AdminLayout() {
|
|||
{/* Subnav. Only drawn where there is something to draw, so
|
||||
Events and People don't get an empty grey strip. */}
|
||||
{subnav.length > 0 && (
|
||||
<div className="border-t border-[#138ba0]/10 bg-[#f6fbfc]">
|
||||
<div className="border-t border-brand/10 bg-tint-soft">
|
||||
<div className="mx-auto flex max-w-5xl flex-wrap gap-6 px-6 py-2.5 text-sm">
|
||||
{subnav.map((child) => (
|
||||
<NavLink
|
||||
|
|
@ -190,8 +192,8 @@ export default function AdminLayout() {
|
|||
to={child.to}
|
||||
className={
|
||||
child === activeChild
|
||||
? "font-semibold text-[#0f7183]"
|
||||
: "text-[#4a6b72] transition-colors hover:text-[#0f7183]"
|
||||
? "font-semibold text-link"
|
||||
: "text-muted transition-colors hover:text-link"
|
||||
}
|
||||
>
|
||||
{child.label}
|
||||
|
|
@ -213,12 +215,12 @@ export default function AdminLayout() {
|
|||
</AdminTitleContext.Provider>
|
||||
</main>
|
||||
|
||||
<footer className="border-t border-[#138ba0]/15 bg-white">
|
||||
<footer className="border-t border-brand/15 bg-surface">
|
||||
<div className="mx-auto flex max-w-5xl items-center gap-4 px-6 py-3">
|
||||
<Link to={ADMIN_HOME} className="transition-opacity hover:opacity-70">
|
||||
<img src={nguLogo} alt="NGU" className="h-6 w-auto" />
|
||||
</Link>
|
||||
<span className="ml-auto font-mono text-xs text-[#4a6b72]/70">
|
||||
<span className="ml-auto font-mono text-xs text-muted/70">
|
||||
{SITE_VERSION}
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ const GOOGLE_ERRORS: Record<string, string> = {
|
|||
};
|
||||
|
||||
const fieldClass =
|
||||
"w-full rounded-xl border border-[#4a6b72]/25 bg-white px-4 py-3 text-[#26454c] " +
|
||||
"outline-none transition-colors focus:border-[#138ba0] focus:ring-2 focus:ring-[#138ba0]/25";
|
||||
"w-full rounded-xl border border-muted/25 bg-surface px-4 py-3 text-body " +
|
||||
"outline-none transition-colors focus:border-brand focus:ring-2 focus:ring-brand/25";
|
||||
|
||||
export default function AdminLogin() {
|
||||
const { login } = useAuth();
|
||||
|
|
@ -85,23 +85,23 @@ export default function AdminLogin() {
|
|||
}
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center bg-[#eef9fb] px-6 py-16">
|
||||
<div className="flex min-h-screen items-center justify-center bg-tint px-6 py-16">
|
||||
<div className="w-full max-w-sm">
|
||||
<h1 className="text-3xl font-bold text-[#0f7183]">NGU admin</h1>
|
||||
<p className="mt-2 text-sm text-[#4a6b72]">
|
||||
<h1 className="text-3xl font-bold text-link">NGU admin</h1>
|
||||
<p className="mt-2 text-sm text-muted">
|
||||
Sign in to edit the site.
|
||||
</p>
|
||||
|
||||
<form
|
||||
onSubmit={handleSubmit}
|
||||
noValidate
|
||||
className="mt-8 rounded-2xl border border-[#138ba0]/20 bg-white p-6"
|
||||
className="mt-8 rounded-2xl border border-brand/20 bg-surface p-6"
|
||||
>
|
||||
{google && (
|
||||
<>
|
||||
<a
|
||||
href={`/api/auth/google?next=${encodeURIComponent(destination)}`}
|
||||
className="flex items-center justify-center gap-3 rounded-full border border-[#4a6b72]/30 px-6 py-3 font-semibold text-[#26454c] transition-colors hover:bg-[#eef9fb]"
|
||||
className="flex items-center justify-center gap-3 rounded-full border border-muted/30 px-6 py-3 font-semibold text-body transition-colors hover:bg-tint"
|
||||
>
|
||||
<svg viewBox="0 0 48 48" className="h-5 w-5" aria-hidden="true">
|
||||
<path fill="#FFC107" d="M43.6 20.5H42V20H24v8h11.3C33.7 32.7 29.2 36 24 36c-6.6 0-12-5.4-12-12s5.4-12 12-12c3.1 0 5.8 1.2 7.9 3.1l5.7-5.7C34 6.1 29.3 4 24 4 12.9 4 4 12.9 4 24s8.9 20 20 20 20-8.9 20-20c0-1.3-.1-2.4-.4-3.5z" />
|
||||
|
|
@ -111,17 +111,17 @@ export default function AdminLogin() {
|
|||
</svg>
|
||||
Sign in with Google
|
||||
</a>
|
||||
<div className="my-6 flex items-center gap-3 text-xs text-[#4a6b72]">
|
||||
<span className="h-px flex-1 bg-[#4a6b72]/20" />
|
||||
<div className="my-6 flex items-center gap-3 text-xs text-muted">
|
||||
<span className="h-px flex-1 bg-muted/20" />
|
||||
or with a password
|
||||
<span className="h-px flex-1 bg-[#4a6b72]/20" />
|
||||
<span className="h-px flex-1 bg-muted/20" />
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
<label
|
||||
htmlFor="admin-email"
|
||||
className="block text-sm font-medium text-[#26454c]"
|
||||
className="block text-sm font-medium text-body"
|
||||
>
|
||||
Email
|
||||
</label>
|
||||
|
|
@ -137,7 +137,7 @@ export default function AdminLogin() {
|
|||
|
||||
<label
|
||||
htmlFor="admin-password"
|
||||
className="mt-5 block text-sm font-medium text-[#26454c]"
|
||||
className="mt-5 block text-sm font-medium text-body"
|
||||
>
|
||||
Password
|
||||
</label>
|
||||
|
|
@ -153,7 +153,7 @@ export default function AdminLogin() {
|
|||
{error && (
|
||||
<p
|
||||
role="alert"
|
||||
className="mt-5 rounded-xl border border-[#b3261e]/30 bg-[#fdf3f2] px-4 py-3 text-sm text-[#b3261e]"
|
||||
className="mt-5 rounded-xl border border-danger/30 bg-danger-tint px-4 py-3 text-sm text-danger"
|
||||
>
|
||||
{error}
|
||||
</p>
|
||||
|
|
@ -162,14 +162,14 @@ export default function AdminLogin() {
|
|||
<button
|
||||
type="submit"
|
||||
disabled={busy || !email || !password}
|
||||
className="mt-6 w-full rounded-full bg-[#0f7183] px-6 py-3 font-semibold text-white transition-colors hover:bg-[#0b5c6a] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#138ba0]/40 disabled:cursor-not-allowed disabled:bg-[#4a6b72]/25"
|
||||
className="mt-6 w-full rounded-full bg-action px-6 py-3 font-semibold text-white transition-colors hover:bg-action-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/40 disabled:cursor-not-allowed disabled:bg-muted/25"
|
||||
>
|
||||
{busy ? "Signing in…" : "Sign in"}
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
<p className="mt-6 text-center text-xs text-[#4a6b72]">
|
||||
<p className="mt-6 text-center text-xs text-muted">
|
||||
Accounts are created on the server. Ask whoever runs the box.
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -64,17 +64,17 @@ function DeleteControl({ item, onDeleted }: { item: MediaItem; onDeleted: () =>
|
|||
type="button"
|
||||
onClick={ask}
|
||||
disabled={busy}
|
||||
className="text-xs text-[#4a6b72] hover:text-[#b3261e]"
|
||||
className="text-xs text-muted hover:text-danger"
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
{error && <p className="mt-1 text-xs text-[#b3261e]">{error}</p>}
|
||||
{error && <p className="mt-1 text-xs text-danger">{error}</p>}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="rounded-lg bg-[#fdf3f2] p-2 text-xs text-[#26454c]">
|
||||
<div className="rounded-lg bg-danger-tint p-2 text-xs text-body">
|
||||
{uses.length > 0 ? (
|
||||
<p>
|
||||
Still used by{" "}
|
||||
|
|
@ -89,15 +89,15 @@ function DeleteControl({ item, onDeleted }: { item: MediaItem; onDeleted: () =>
|
|||
type="button"
|
||||
onClick={remove}
|
||||
disabled={busy}
|
||||
className="font-medium text-[#b3261e] hover:underline"
|
||||
className="font-medium text-danger hover:underline"
|
||||
>
|
||||
{busy ? "Deleting…" : "Delete for good"}
|
||||
</button>
|
||||
<button type="button" onClick={() => setUses(null)} className="text-[#4a6b72] hover:underline">
|
||||
<button type="button" onClick={() => setUses(null)} className="text-muted hover:underline">
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
{error && <p className="mt-1 text-[#b3261e]">{error}</p>}
|
||||
{error && <p className="mt-1 text-danger">{error}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -113,7 +113,7 @@ function CopyPath({ url }: { url: string }) {
|
|||
setTimeout(() => setCopied(false), 1500);
|
||||
});
|
||||
}}
|
||||
className="text-xs text-[#0f7183] hover:underline"
|
||||
className="text-xs text-link hover:underline"
|
||||
>
|
||||
{copied ? "Copied" : "Copy path"}
|
||||
</button>
|
||||
|
|
@ -128,8 +128,8 @@ export default function AdminMedia() {
|
|||
return (
|
||||
<div>
|
||||
<div className="flex flex-wrap items-baseline gap-3">
|
||||
<h1 className="text-2xl font-bold text-[#0f7183]">Media</h1>
|
||||
<p className="text-sm text-[#4a6b72]">
|
||||
<h1 className="text-2xl font-bold text-link">Media</h1>
|
||||
<p className="text-sm text-muted">
|
||||
Uploaded images. Image fields in every editor pick from here.
|
||||
</p>
|
||||
</div>
|
||||
|
|
@ -142,7 +142,7 @@ export default function AdminMedia() {
|
|||
label="Upload images"
|
||||
onUploaded={(item) => setItems((current) => [item, ...(current ?? [])])}
|
||||
/>
|
||||
<p className="mt-1 text-xs text-[#4a6b72]">{UPLOAD_HELP}</p>
|
||||
<p className="mt-1 text-xs text-muted">{UPLOAD_HELP}</p>
|
||||
</div>
|
||||
)}
|
||||
<input
|
||||
|
|
@ -150,15 +150,15 @@ export default function AdminMedia() {
|
|||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
placeholder="Search by file name"
|
||||
className="ml-auto w-64 rounded-lg border border-[#4a6b72]/25 px-3 py-2 text-sm outline-none focus:border-[#138ba0]"
|
||||
className="ml-auto w-64 rounded-lg border border-muted/25 px-3 py-2 text-sm outline-none focus:border-brand"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mt-6">
|
||||
{error ? (
|
||||
<p className="text-sm text-[#b3261e]">{error}</p>
|
||||
<p className="text-sm text-danger">{error}</p>
|
||||
) : items === null ? (
|
||||
<p className="text-sm text-[#4a6b72]">Loading…</p>
|
||||
<p className="text-sm text-muted">Loading…</p>
|
||||
) : (
|
||||
<MediaGrid
|
||||
items={items}
|
||||
|
|
@ -169,7 +169,7 @@ export default function AdminMedia() {
|
|||
href={item.url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="text-xs text-[#0f7183] hover:underline"
|
||||
className="text-xs text-link hover:underline"
|
||||
>
|
||||
Open
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ import {
|
|||
|
||||
/* One card per section. scroll-mt clears the sticky "Jump to" bar
|
||||
below lg, and leaves a little air above the card on desktop. */
|
||||
const CARD = "mt-6 scroll-mt-16 rounded-2xl border border-[#138ba0]/20 bg-white p-5 lg:scroll-mt-6";
|
||||
const CARD = "mt-6 scroll-mt-16 rounded-2xl border border-brand/20 bg-surface p-5 lg:scroll-mt-6";
|
||||
|
||||
const sectionId = (name) => `section-${slugify(name)}`;
|
||||
|
||||
|
|
@ -225,8 +225,8 @@ export default function EntityEdit() {
|
|||
return () => window.removeEventListener("beforeunload", warn);
|
||||
}, [dirty]);
|
||||
|
||||
if (!manifest) return <p className="text-[#4a6b72]">No such thing to edit.</p>;
|
||||
if (loading || !form) return <p className="text-[#4a6b72]">Loading…</p>;
|
||||
if (!manifest) return <p className="text-muted">No such thing to edit.</p>;
|
||||
if (loading || !form) return <p className="text-muted">Loading…</p>;
|
||||
|
||||
/* ── Heading ───────────────────────────────────────────────── */
|
||||
|
||||
|
|
@ -356,13 +356,13 @@ export default function EntityEdit() {
|
|||
<button
|
||||
type="button"
|
||||
onClick={() => leave(`/admin/${manifest.key}`)}
|
||||
className="text-sm text-[#4a6b72] hover:text-[#0f7183]"
|
||||
className="text-sm text-muted hover:text-link"
|
||||
>
|
||||
← {manifest.label}
|
||||
</button>
|
||||
)}
|
||||
|
||||
<h1 className="mt-2 text-3xl font-bold text-[#0f7183]">
|
||||
<h1 className="mt-2 text-3xl font-bold text-link">
|
||||
{isNew ? `New ${manifest.singular}` : heading}
|
||||
</h1>
|
||||
|
||||
|
|
@ -385,13 +385,13 @@ export default function EntityEdit() {
|
|||
{singleton ? (
|
||||
updatedAt && (
|
||||
<div className={CARD}>
|
||||
<p className="text-sm text-[#4a6b72]">Last saved {updatedAt}</p>
|
||||
<p className="text-sm text-muted">Last saved {updatedAt}</p>
|
||||
</div>
|
||||
)
|
||||
) : autoId ? (
|
||||
!isNew && (
|
||||
<div id="section-url-id" className={CARD}>
|
||||
<p className="text-sm text-[#4a6b72]">
|
||||
<p className="text-sm text-muted">
|
||||
{manifest.idLabel} #{form.id}
|
||||
{form.updated_at && <> · last saved {form.updated_at}</>}
|
||||
</p>
|
||||
|
|
@ -421,7 +421,7 @@ export default function EntityEdit() {
|
|||
}}
|
||||
/>
|
||||
{!isNew && form.updated_at && (
|
||||
<p className="mt-2 text-xs text-[#4a6b72]">
|
||||
<p className="mt-2 text-xs text-muted">
|
||||
Last saved {form.updated_at}
|
||||
</p>
|
||||
)}
|
||||
|
|
@ -431,8 +431,8 @@ export default function EntityEdit() {
|
|||
{/* Field groups */}
|
||||
{groups.map((group) => (
|
||||
<section key={group.legend} id={sectionId(group.legend)} className={CARD}>
|
||||
<h2 className="text-lg font-semibold text-[#26454c]">{group.legend}</h2>
|
||||
{group.note && <p className="mt-1 text-sm text-[#4a6b72]">{group.note}</p>}
|
||||
<h2 className="text-lg font-semibold text-body">{group.legend}</h2>
|
||||
{group.note && <p className="mt-1 text-sm text-muted">{group.note}</p>}
|
||||
<div className="mt-4">
|
||||
<FieldGrid>
|
||||
{group.fields.map((field) => (
|
||||
|
|
@ -470,7 +470,7 @@ export default function EntityEdit() {
|
|||
</div>
|
||||
|
||||
{/* Sticky action bar */}
|
||||
<div className="fixed inset-x-0 bottom-0 border-t border-[#138ba0]/20 bg-white/95 backdrop-blur">
|
||||
<div className="fixed inset-x-0 bottom-0 border-t border-brand/20 bg-white/95 backdrop-blur">
|
||||
<div className="mx-auto flex max-w-5xl flex-wrap items-center gap-4 px-6 py-3">
|
||||
{canWrite ? (
|
||||
<>
|
||||
|
|
@ -478,7 +478,7 @@ export default function EntityEdit() {
|
|||
type="button"
|
||||
onClick={save}
|
||||
disabled={saving || !dirty}
|
||||
className="rounded-full bg-[#0f7183] px-6 py-2 font-semibold text-white transition-colors hover:bg-[#0b5c6a] disabled:bg-[#4a6b72]/25"
|
||||
className="rounded-full bg-action px-6 py-2 font-semibold text-white transition-colors hover:bg-action-hover disabled:bg-muted/25"
|
||||
>
|
||||
{saving ? "Saving…" : isNew ? "Create" : "Save changes"}
|
||||
</button>
|
||||
|
|
@ -486,27 +486,27 @@ export default function EntityEdit() {
|
|||
<button
|
||||
type="button"
|
||||
onClick={remove}
|
||||
className="rounded-full border border-[#b3261e]/40 px-4 py-2 text-sm font-medium text-[#b3261e] transition-colors hover:bg-[#fdf3f2]"
|
||||
className="rounded-full border border-danger/40 px-4 py-2 text-sm font-medium text-danger transition-colors hover:bg-danger-tint"
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<span className="text-sm text-[#4a6b72]">
|
||||
<span className="text-sm text-muted">
|
||||
Read-only: your account can view this but not change it.
|
||||
</span>
|
||||
)}
|
||||
|
||||
{dirty && !saving && (
|
||||
<span className="text-sm text-[#4a6b72]">Unsaved changes</span>
|
||||
<span className="text-sm text-muted">Unsaved changes</span>
|
||||
)}
|
||||
|
||||
{message && (
|
||||
<span
|
||||
role="status"
|
||||
className={`flex items-center gap-2 text-sm ${
|
||||
message.tone === "ok" ? "text-[#0f7183]" : "text-[#b3261e]"
|
||||
message.tone === "ok" ? "text-link" : "text-danger"
|
||||
}`}
|
||||
>
|
||||
{message.text}
|
||||
|
|
@ -514,7 +514,7 @@ export default function EntityEdit() {
|
|||
<button
|
||||
type="button"
|
||||
onClick={load}
|
||||
className="rounded-full border border-[#b3261e]/40 px-3 py-1 text-xs font-medium"
|
||||
className="rounded-full border border-danger/40 px-3 py-1 text-xs font-medium"
|
||||
>
|
||||
Reload
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ export default function EntityList() {
|
|||
}, [load]);
|
||||
|
||||
if (!manifest) {
|
||||
return <p className="text-[#4a6b72]">No such thing to edit.</p>;
|
||||
return <p className="text-muted">No such thing to edit.</p>;
|
||||
}
|
||||
|
||||
// One row, so no list: the tab opens the row.
|
||||
|
|
@ -92,11 +92,11 @@ export default function EntityList() {
|
|||
return (
|
||||
<div>
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
<h1 className="text-3xl font-bold text-[#0f7183]">{manifest.label}</h1>
|
||||
<h1 className="text-3xl font-bold text-link">{manifest.label}</h1>
|
||||
{canWrite && (
|
||||
<Link
|
||||
to={`/admin/${manifest.key}/new`}
|
||||
className="ml-auto rounded-full bg-[#0f7183] px-4 py-2 text-sm font-semibold text-white transition-colors hover:bg-[#0b5c6a]"
|
||||
className="ml-auto rounded-full bg-action px-4 py-2 text-sm font-semibold text-white transition-colors hover:bg-action-hover"
|
||||
>
|
||||
New {manifest.singular}
|
||||
</Link>
|
||||
|
|
@ -106,12 +106,12 @@ export default function EntityList() {
|
|||
{/* Filters */}
|
||||
<div className="mt-6 flex flex-wrap items-end gap-3">
|
||||
{manifest.list.filters.map((filter) => (
|
||||
<label key={filter.key} className="text-xs text-[#4a6b72]">
|
||||
<label key={filter.key} className="text-xs text-muted">
|
||||
<span className="block">{filter.label}</span>
|
||||
<select
|
||||
value={params.get(filter.key) ?? ""}
|
||||
onChange={(e) => setParam(filter.key, e.target.value)}
|
||||
className="mt-1 rounded-lg border border-[#4a6b72]/25 bg-white px-3 py-1.5 text-sm text-[#26454c] outline-none focus:border-[#138ba0]"
|
||||
className="mt-1 rounded-lg border border-muted/25 bg-surface px-3 py-1.5 text-sm text-body outline-none focus:border-brand"
|
||||
>
|
||||
<option value="">All</option>
|
||||
{labelFor(filter).map(([value, label]) => (
|
||||
|
|
@ -130,12 +130,12 @@ export default function EntityList() {
|
|||
placeholder="Search"
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
onKeyDown={(e) => e.key === "Enter" && setParam("q", query.trim())}
|
||||
className="rounded-full border border-[#4a6b72]/25 bg-white px-4 py-1.5 text-sm text-[#26454c] outline-none focus:border-[#138ba0]"
|
||||
className="rounded-full border border-muted/25 bg-surface px-4 py-1.5 text-sm text-body outline-none focus:border-brand"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setParam("q", query.trim())}
|
||||
className="rounded-full border border-[#4a6b72]/25 px-4 py-1.5 text-sm text-[#4a6b72] hover:border-[#138ba0]/50"
|
||||
className="rounded-full border border-muted/25 px-4 py-1.5 text-sm text-muted hover:border-brand/50"
|
||||
>
|
||||
Search
|
||||
</button>
|
||||
|
|
@ -145,16 +145,16 @@ export default function EntityList() {
|
|||
{error && (
|
||||
<p
|
||||
role="alert"
|
||||
className="mt-6 rounded-xl border border-[#b3261e]/30 bg-[#fdf3f2] px-4 py-3 text-sm text-[#b3261e]"
|
||||
className="mt-6 rounded-xl border border-danger/30 bg-danger-tint px-4 py-3 text-sm text-danger"
|
||||
>
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/* Rows */}
|
||||
<div className="mt-6 overflow-x-auto rounded-2xl border border-[#138ba0]/20 bg-white">
|
||||
<div className="mt-6 overflow-x-auto rounded-2xl border border-brand/20 bg-surface">
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="border-b border-[#4a6b72]/15 text-xs text-[#4a6b72]">
|
||||
<thead className="border-b border-muted/15 text-xs text-muted">
|
||||
<tr>
|
||||
{manifest.list.columns.map((column) => (
|
||||
<th key={column.key} className="px-4 py-3 font-medium">
|
||||
|
|
@ -170,14 +170,14 @@ export default function EntityList() {
|
|||
{rows.map((row) => (
|
||||
<tr
|
||||
key={row.id}
|
||||
className="cursor-pointer border-b border-[#4a6b72]/10 last:border-0 hover:bg-[#f6fbfc]"
|
||||
className="cursor-pointer border-b border-muted/10 last:border-0 hover:bg-tint-soft"
|
||||
onClick={() => navigate(`/admin/${manifest.key}/${row.id}`)}
|
||||
>
|
||||
{manifest.list.columns.map((column) => (
|
||||
<td
|
||||
key={column.key}
|
||||
className={`px-4 py-3 ${
|
||||
column.primary ? "font-medium text-[#26454c]" : "text-[#4a6b72]"
|
||||
column.primary ? "font-medium text-body" : "text-muted"
|
||||
}`}
|
||||
>
|
||||
{column.key === linkKey ? (
|
||||
|
|
@ -199,16 +199,16 @@ export default function EntityList() {
|
|||
)}
|
||||
</td>
|
||||
))}
|
||||
<td className="px-4 py-3 font-mono text-xs text-[#4a6b72]">{row.id}</td>
|
||||
<td className="px-4 py-3 font-mono text-xs text-muted">{row.id}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{!loading && rows.length === 0 && (
|
||||
<p className="px-4 py-8 text-center text-[#4a6b72]">Nothing matches.</p>
|
||||
<p className="px-4 py-8 text-center text-muted">Nothing matches.</p>
|
||||
)}
|
||||
{loading && <p className="px-4 py-8 text-center text-[#4a6b72]">Loading…</p>}
|
||||
{loading && <p className="px-4 py-8 text-center text-muted">Loading…</p>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue