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
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue