Compare commits
4 commits
bff082652a
...
f94f1a6584
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f94f1a6584 | ||
|
|
e4a9c96f7e | ||
|
|
c74ad746f5 | ||
|
|
ee61568911 |
100 changed files with 3288 additions and 2704 deletions
|
|
@ -66,11 +66,12 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu
|
||||||
- **Imports need explicit extensions** (`.ts`, `.tsx`, `.js`) everywhere.
|
- **Imports need explicit extensions** (`.ts`, `.tsx`, `.js`) everywhere.
|
||||||
- **Vite resolves `.js` before `.ts`**, so a `.js` and `.ts` file with the same base name will import the wrong one. Give new hooks distinct names.
|
- **Vite resolves `.js` before `.ts`**, so a `.js` and `.ts` file with the same base name will import the wrong one. Give new hooks distinct names.
|
||||||
- **Don't use `fallback: EMPTY` in api.ts hooks.** It silently returns empty arrays and hides server errors; let the error state surface.
|
- **Don't use `fallback: EMPTY` in api.ts hooks.** It silently returns empty arrays and hides server errors; let the error state surface.
|
||||||
|
- **Colours are tokens, not hex.** Use the utilities from `src/index.css` (`text-ink`, `text-body`, `text-muted`, `text-link`, `bg-surface`, `bg-tint`, `bg-action`, `border-brand/20`...) so dark mode works; a literal only for something that must look the same in both modes (white on a dark band, a platform's colour). Data colours (accents, event and region colours) go through `withAlpha`, `accentText` and `readableOn` in `src/lib/color.ts`, never `${color}55`.
|
||||||
- **No em-dashes** (U+2014) anywhere: UI text, help text, comments, docs, commit messages. Use a colon, comma or parentheses. An empty table cell shows `-`.
|
- **No em-dashes** (U+2014) anywhere: UI text, help text, comments, docs, commit messages. Use a colon, comma or parentheses. An empty table cell shows `-`.
|
||||||
- **Admin editor text:** blank select options read `Default: …` (what blank means), examples in help text start with `eg.`, and record ids are called "URL ID". Cut-off preview text uses `preview()` from `src/lib/text.ts`, which ends it with an ellipsis. See `docs/updating-data-in-code.md`.
|
- **Admin editor text:** blank select options read `Default: …` (what blank means), examples in help text start with `eg.`, and record ids are called "URL ID". Cut-off preview text uses `preview()` from `src/lib/text.ts`, which ends it with an ellipsis. See `docs/updating-data-in-code.md`.
|
||||||
|
|
||||||
## Admin CRUD engine
|
## Admin CRUD engine
|
||||||
Descriptor-driven: `server/src/admin-crud.js` and `server/src/admin-schema.js` (server) and `adminSchema.ts` (client) generate SQL and form fields from declarative entity configs. Adding an entity should mean adding a descriptor, not new CRUD code.
|
Descriptor-driven: `server/src/admin-crud.js` and `server/src/admin-schema.js` (server) and `src/lib/adminSchema/` (client, one file per entity, registered in `adminSchema.ts`) generate SQL and form fields from declarative entity configs. Adding an entity should mean adding a descriptor, not new CRUD code.
|
||||||
- Child collections are deleted and reinserted wholesale. Unsafe for entities referenced by foreign keys elsewhere.
|
- Child collections are deleted and reinserted wholesale. Unsafe for entities referenced by foreign keys elsewhere.
|
||||||
- `reindex: false` prevents cross-entity sort order collisions.
|
- `reindex: false` prevents cross-entity sort order collisions.
|
||||||
- The `OMIT` sentinel distinguishes unsent fields from deliberate clears.
|
- The `OMIT` sentinel distinguishes unsent fields from deliberate clears.
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,15 @@ carries Hono's `secureHeaders()` (`server/src/index.js`):
|
||||||
- `Referrer-Policy: strict-origin-when-cross-origin`: kept to the origin,
|
- `Referrer-Policy: strict-origin-when-cross-origin`: kept to the origin,
|
||||||
because YouTube embeds refuse to play without a referrer.
|
because YouTube embeds refuse to play without a referrer.
|
||||||
- `Cross-Origin-Opener-Policy` and `Cross-Origin-Resource-Policy: same-origin`
|
- `Cross-Origin-Opener-Policy` and `Cross-Origin-Resource-Policy: same-origin`
|
||||||
- no HSTS (nginx sends it, below) and no Content-Security-Policy yet
|
- no HSTS (nginx sends it, below)
|
||||||
(it needs trying in Report-Only first: pages carry an inline
|
- `Content-Security-Policy-Report-Only`: blocks nothing yet. Browsers
|
||||||
`window.__NGU_SITE__` script and YouTube, Facebook and Maps iframes).
|
post what it would have blocked to `/api/csp-report`, which logs one
|
||||||
|
line per report (`journalctl -u ngu-api | grep csp`). The allowed
|
||||||
|
embed hosts are `EMBEDS` in `server/src/index.js`. After a while of
|
||||||
|
real use with nothing unexpected in the log, rename
|
||||||
|
`contentSecurityPolicyReportOnly` to `contentSecurityPolicy` there to
|
||||||
|
enforce it. A new embed host (a new video site, say) has to be added
|
||||||
|
to `EMBEDS` first.
|
||||||
|
|
||||||
The API also refuses a form-style write (`text/plain`, form or
|
The API also refuses a form-style write (`text/plain`, form or
|
||||||
multipart body) sent from another site, including a sibling subdomain
|
multipart body) sent from another site, including a sibling subdomain
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ what a dropdown in the admin editor says.
|
||||||
| The **label** a dropdown shows in the admin | code | [one file](#renaming-what-a-dropdown-shows) |
|
| The **label** a dropdown shows in the admin | code | [one file](#renaming-what-a-dropdown-shows) |
|
||||||
| The **list of allowed values** behind a fixed dropdown | database CHECK + code | [a migration and three files](#adding-removing-or-renaming-a-stored-value) |
|
| The **list of allowed values** behind a fixed dropdown | database CHECK + code | [a migration and three files](#adding-removing-or-renaming-a-stored-value) |
|
||||||
| Navigation, page section titles, colours, the site banner, history decades, the map grid | code | [the file named below](#other-content-that-lives-in-code) |
|
| Navigation, page section titles, colours, the site banner, history decades, the map grid | code | [the file named below](#other-content-that-lives-in-code) |
|
||||||
| A static page's title and intro (also its search title and description), the site's name, description, preview image, icons, search indexing | the database, over `site.json` | Admin → Panel → Site settings (superadmins). Blank uses `site.json`, which also holds the site's address and the pages' defaults. See `docs/seo.md` |
|
| A static page's title and intro (also its search title and description), the site's name, description, preview image, icons, search indexing, privacy contact email | the database, over `site.json` | Admin → Panel → Site settings (superadmins). Blank uses `site.json`, which also holds the site's address and the pages' defaults. See `docs/seo.md` |
|
||||||
| Uploaded images | disk + the `media` table | Admin → Tools → Media, or any image field. See `docs/media-uploads.md` |
|
| Uploaded images | disk + the `media` table | Admin → Tools → Media, or any image field. See `docs/media-uploads.md` |
|
||||||
|
|
||||||
The rule of thumb from `CLAUDE.md`: data belongs in the database,
|
The rule of thumb from `CLAUDE.md`: data belongs in the database,
|
||||||
|
|
@ -49,7 +49,7 @@ each entity:
|
||||||
|
|
||||||
| File | What it holds |
|
| File | What it holds |
|
||||||
| ----------------------------- | ----------------------------------------------------- |
|
| ----------------------------- | ----------------------------------------------------- |
|
||||||
| `src/lib/adminSchema.ts` | The **form**: field labels, help text, dropdown labels, list columns and filters |
|
| `src/lib/adminSchema/` (one file per entity, `shared.ts` for common fields; `src/lib/adminSchema.ts` lists them) | The **form**: field labels, help text, dropdown labels, list columns and filters |
|
||||||
| `server/src/admin-schema.js` | What the server **accepts**: columns, types, the allowed values of each `enumeration(...)` |
|
| `server/src/admin-schema.js` | What the server **accepts**: columns, types, the allowed values of each `enumeration(...)` |
|
||||||
|
|
||||||
And the database itself holds the final word: most fixed lists are a
|
And the database itself holds the final word: most fixed lists are a
|
||||||
|
|
@ -76,7 +76,7 @@ organization name in the label, as the `awards` query does.
|
||||||
> are changed with a migration: `UPDATE event_scopes SET name = '…' WHERE id = '…';`
|
> are changed with a migration: `UPDATE event_scopes SET name = '…' WHERE id = '…';`
|
||||||
|
|
||||||
**2. A fixed list in code (`options`).** The choices are written in
|
**2. A fixed list in code (`options`).** The choices are written in
|
||||||
`src/lib/adminSchema.ts`. Each option is one of two shapes:
|
the entity's file in `src/lib/adminSchema/`. Each option is one of two shapes:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
options: ["speaker", "leader", "host"] // shows: speaker, leader, host
|
options: ["speaker", "leader", "host"] // shows: speaker, leader, host
|
||||||
|
|
@ -90,7 +90,7 @@ relabelling cheap.
|
||||||
### Renaming what a dropdown shows
|
### Renaming what a dropdown shows
|
||||||
|
|
||||||
If the stored value stays the same and you only want the dropdown to
|
If the stored value stays the same and you only want the dropdown to
|
||||||
read differently, **only `src/lib/adminSchema.ts` changes**. No
|
read differently, **only the file in `src/lib/adminSchema/` changes**. No
|
||||||
migration, no server change, and every existing row keeps working.
|
migration, no server change, and every existing row keeps working.
|
||||||
|
|
||||||
Find the field (search for its column name) and give the option a
|
Find the field (search for its column name) and give the option a
|
||||||
|
|
@ -147,7 +147,7 @@ together, in one branch:
|
||||||
decide what existing rows become first.
|
decide what existing rows become first.
|
||||||
2. **`server/src/admin-schema.js`**: the `enumeration("column", [...])`
|
2. **`server/src/admin-schema.js`**: the `enumeration("column", [...])`
|
||||||
list for that column.
|
list for that column.
|
||||||
3. **`src/lib/adminSchema.ts`**: the `options` on the form field, and on
|
3. **`src/lib/adminSchema/<entity>.ts`**: the `options` on the form field, and on
|
||||||
the list filter if there is one.
|
the list filter if there is one.
|
||||||
4. **Anywhere the public site renders or relies on the value**, listed in
|
4. **Anywhere the public site renders or relies on the value**, listed in
|
||||||
the table below (for example `EVENT_TYPES` for event types, or the
|
the table below (for example `EVENT_TYPES` for event types, or the
|
||||||
|
|
@ -160,7 +160,7 @@ wrong rather than working around it.
|
||||||
|
|
||||||
### Every dropdown in the editor
|
### Every dropdown in the editor
|
||||||
|
|
||||||
**Fixed lists** (`options`: labels in `src/lib/adminSchema.ts`, values
|
**Fixed lists** (`options`: labels in `src/lib/adminSchema/`, values
|
||||||
also in `admin-schema.js` and a CHECK):
|
also in `admin-schema.js` and a CHECK):
|
||||||
|
|
||||||
| Entity → field | Stored values | Labelled? | Also used on the public site by |
|
| Entity → field | Stored values | Labelled? | Also used on the public site by |
|
||||||
|
|
@ -176,7 +176,7 @@ also in `admin-schema.js` and a CHECK):
|
||||||
| Links → Kind (on organizations, events, people, teams) | action, social, website, email | no | `splitLinks` in `server/src/shape.js` |
|
| Links → Kind (on organizations, events, people, teams) | action, social, website, email | no | `splitLinks` in `server/src/shape.js` |
|
||||||
| Links → Platform | instagram, facebook, discord, youtube, tiktok, x, substack, spotify, linkedin | **yes**, `PLATFORMS` | `PlatformIcon.tsx` draws the icon on the button. **No CHECK and no `enumeration`**: the column is plain text, so adding one is an entry in `PLATFORMS` (`src/lib/platforms.ts`) and its icon in `src/components/PlatformIcon.tsx`, no migration. |
|
| Links → Platform | instagram, facebook, discord, youtube, tiktok, x, substack, spotify, linkedin | **yes**, `PLATFORMS` | `PlatformIcon.tsx` draws the icon on the button. **No CHECK and no `enumeration`**: the column is plain text, so adding one is an entry in `PLATFORMS` (`src/lib/platforms.ts`) and its icon in `src/components/PlatformIcon.tsx`, no migration. |
|
||||||
| Content blocks → Shown in (slot) | card, body | **yes** | `paragraphs()` in `server/src/shape.js` (card), `ContentBlocks.tsx` (body) |
|
| Content blocks → Shown in (slot) | card, body | **yes** | `paragraphs()` in `server/src/shape.js` (card), `ContentBlocks.tsx` (body) |
|
||||||
| Content blocks → Type | heading, subheading, paragraph, list, links, quote, image, divider, video, button, callout, schedule | **yes**, `BLOCK_TYPES` (with each type's description) | `ContentBlocks.tsx` (one renderer per type). Which fields each type shows is `when` on the fields in `blocksChild` (`src/lib/adminSchema.ts`). |
|
| Content blocks → Type | heading, subheading, paragraph, list, links, quote, image, divider, video, button, callout, schedule | **yes**, `BLOCK_TYPES` (with each type's description) | `ContentBlocks.tsx` (one renderer per type). Which fields each type shows is `when` on the fields in `blocksChild` (`src/lib/adminSchema/shared.ts`). |
|
||||||
| Timeline → Kind (+ list filter) | milestone, event, organization, award, people | no | `KIND_NAMES` in `src/pages/sections/history/TimelineEntry.tsx` |
|
| Timeline → Kind (+ list filter) | milestone, event, organization, award, people | no | `KIND_NAMES` in `src/pages/sections/history/TimelineEntry.tsx` |
|
||||||
| Timeline → Points at (+ list filter) | event, organization, award, person, team | no | `refHref` in `src/lib/hrefs.ts` |
|
| Timeline → Points at (+ list filter) | event, organization, award, person, team | no | `refHref` in `src/lib/hrefs.ts` |
|
||||||
| Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping |
|
| Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping |
|
||||||
|
|
@ -219,7 +219,7 @@ each is changed in a different place:
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| **The heading on the page** ("National Retreats", "What's on") | **Admin → Pages → Front page → Page sections → Heading.** Blank uses the default below. |
|
| **The heading on the page** ("National Retreats", "What's on") | **Admin → Pages → Front page → Page sections → Heading.** Blank uses the default below. |
|
||||||
| The default heading when that field is blank | `SECTIONS` in `src/pages/Home.tsx`, the `title` of each entry |
|
| The default heading when that field is blank | `SECTIONS` in `src/pages/Home.tsx`, the `title` of each entry |
|
||||||
| **The name in the admin's Section dropdown** ("Events Carousel (National Retreats)") | `FRONT_PAGE_SECTIONS` in `src/lib/adminSchema.ts` |
|
| **The name in the admin's Section dropdown** ("Events Carousel (National Retreats)") | `FRONT_PAGE_SECTIONS` in `src/lib/adminSchema/frontPage.ts` |
|
||||||
| The subnav links under the header ("#Retreats", "#Calendar") | `PAGE_SECTIONS["/"]` in `src/navConfig.ts` |
|
| The subnav links under the header ("#Retreats", "#Calendar") | `PAGE_SECTIONS["/"]` in `src/navConfig.ts` |
|
||||||
|
|
||||||
To rename a band **for visitors**, use the admin. To rename how it
|
To rename a band **for visitors**, use the admin. To rename how it
|
||||||
|
|
@ -253,7 +253,7 @@ CHECK on `front_page_sections.section` via a migration.
|
||||||
|
|
||||||
The numbers band's "Number Source" dropdown works the same way:
|
The numbers band's "Number Source" dropdown works the same way:
|
||||||
|
|
||||||
- **Relabel a source:** `STAT_SOURCES` in `src/lib/adminSchema.ts`.
|
- **Relabel a source:** `STAT_SOURCES` in `src/lib/adminSchema/frontPage.ts`.
|
||||||
- **Change what a count counts:** its query in `STAT_QUERIES` in
|
- **Change what a count counts:** its query in `STAT_QUERIES` in
|
||||||
`server/src/routes/home.js`. Keep it counting exactly what the
|
`server/src/routes/home.js`. Keep it counting exactly what the
|
||||||
matching public page shows (published rows), or the number and the
|
matching public page shows (published rows), or the number and the
|
||||||
|
|
@ -273,7 +273,9 @@ The numbers band's "Number Source" dropdown works the same way:
|
||||||
| Site-wide announcement banner | `src/data/bannerConfig.ts` | `enabled: false` hides it. Bump `id` when the message changes, so people who dismissed the old one see the new one. |
|
| Site-wide announcement banner | `src/data/bannerConfig.ts` | `enabled: false` hides it. Bump `id` when the message changes, so people who dismissed the old one see the new one. |
|
||||||
| History page decade headers | `src/data/historyDecades.ts` | Title, tagline and blurb per decade. |
|
| History page decade headers | `src/data/historyDecades.ts` | Title, tagline and blurb per decade. |
|
||||||
| Chapter map tiles and area names | `src/data/mapGrid.ts` | `AREAS` (tile positions) and `AREA_NAMES`. Which region paints which tile is in the database (Admin → Data → Organizations → a region → Map areas). |
|
| Chapter map tiles and area names | `src/data/mapGrid.ts` | `AREAS` (tile positions) and `AREA_NAMES`. Which region paints which tile is in the database (Admin → Data → Organizations → a region → Map areas). |
|
||||||
| Feedback form types | `src/data/feedbackTypes.ts` **and** `TYPES` in `server/src/routes/feedback.js` | Keep the ids identical in both; the server stores unknown ids as `general`. Labels and hints are client-only. |
|
| Feedback form types | `src/data/feedbackTypes.ts` **and** `TYPES` in `server/src/routes/feedback.js` | Keep the ids identical in both; the server stores unknown ids as `general`. Labels and hints are client-only. `DATA_REQUEST` ('privacy') isn't a tile: the Privacy page's form sends it, and the server requires an email for it. |
|
||||||
|
| The site's colours, light and dark | `src/index.css` (`@theme` tokens and the dark overrides under them) | Change a token's value in both modes and every use follows. Use the token utilities (`text-muted`, `bg-surface`, `border-brand/20`) or `var(--color-…)`, not hex. A colour that arrives as data (a page accent, an event's or region's colour) goes through `src/lib/color.ts`: `withAlpha` for tints, `accentText` for text in it, `readableOn` for text on it. |
|
||||||
|
| Privacy Policy and Terms wording | `src/pages/Privacy.tsx`, `src/pages/Terms.tsx` | The `PARTS` list, and `LAST_UPDATED` whenever the wording changes. The Privacy page must stay true of the code: what the feedback form stores, what the browser keeps, which embeds wait for a click. |
|
||||||
| Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. |
|
| Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. |
|
||||||
| Event and person role labels (public site) | `ROLE_LABEL` in `src/pages/EventDetail.tsx` and `src/pages/PersonDetail.tsx` | |
|
| Event and person role labels (public site) | `ROLE_LABEL` in `src/pages/EventDetail.tsx` and `src/pages/PersonDetail.tsx` | |
|
||||||
| Organization kind labels ("Region", "Chapter") | `ORG_KIND_LABEL` in `src/lib/hrefs.ts` | |
|
| Organization kind labels ("Region", "Chapter") | `ORG_KIND_LABEL` in `src/lib/hrefs.ts` | |
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,15 @@
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title><!-- site:title --></title>
|
<title><!-- site:title --></title>
|
||||||
|
<!-- Theme before first paint, so a dark visitor never sees a white
|
||||||
|
flash: this browser's choice (ThemeToggle), else the system. -->
|
||||||
|
<script>
|
||||||
|
try {
|
||||||
|
var t = localStorage.getItem("ngu-theme");
|
||||||
|
document.documentElement.dataset.theme =
|
||||||
|
t === "dark" || t === "light" ? t : matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
||||||
|
} catch (e) {}
|
||||||
|
</script>
|
||||||
<!-- site:head-end -->
|
<!-- site:head-end -->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -378,7 +378,6 @@ const events = {
|
||||||
text("org_logo"),
|
text("org_logo"),
|
||||||
text("event_logo"),
|
text("event_logo"),
|
||||||
text("color"),
|
text("color"),
|
||||||
text("gradient"),
|
|
||||||
text("card_image"),
|
text("card_image"),
|
||||||
bool("is_published"),
|
bool("is_published"),
|
||||||
bool("is_listed"),
|
bool("is_listed"),
|
||||||
|
|
@ -935,6 +934,7 @@ const siteSettings = {
|
||||||
text("favicon"),
|
text("favicon"),
|
||||||
text("apple_touch_icon"),
|
text("apple_touch_icon"),
|
||||||
enumeration("indexing", ["on", "off"]),
|
enumeration("indexing", ["on", "off"]),
|
||||||
|
text("privacy_email"),
|
||||||
],
|
],
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
|
|
|
||||||
|
|
@ -62,17 +62,64 @@ app.use("*", logger());
|
||||||
/* Headers for every response. Referrer kept to the origin (YouTube
|
/* Headers for every response. Referrer kept to the origin (YouTube
|
||||||
embeds refuse to play without one). No HSTS here: nginx sends it on
|
embeds refuse to play without one). No HSTS here: nginx sends it on
|
||||||
everything, including the files it serves from disk
|
everything, including the files it serves from disk
|
||||||
(docs/security-headers.md). No CSP yet: pages carry an inline
|
(docs/security-headers.md).
|
||||||
window.__NGU_SITE__ script and YouTube, Facebook and Maps iframes,
|
|
||||||
so one needs trying in Report-Only first. */
|
The Content-Security-Policy is Report-Only for now: nothing is
|
||||||
|
blocked, and each thing it would have blocked is logged by
|
||||||
|
/api/csp-report (journalctl -u ngu-api). Once a while of real use
|
||||||
|
logs nothing unexpected, switch contentSecurityPolicyReportOnly to
|
||||||
|
contentSecurityPolicy. 'unsafe-inline' scripts cover the page's
|
||||||
|
window.__NGU_SITE__ and the theme script in index.html. */
|
||||||
|
const EMBEDS = [
|
||||||
|
"https://www.youtube-nocookie.com",
|
||||||
|
"https://www.youtube.com",
|
||||||
|
"https://www.facebook.com",
|
||||||
|
"https://player.vimeo.com",
|
||||||
|
"https://www.google.com",
|
||||||
|
"https://maps.google.com",
|
||||||
|
"https://*.churchcenter.com",
|
||||||
|
"https://*.churchcenteronline.com",
|
||||||
|
];
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
"*",
|
"*",
|
||||||
secureHeaders({
|
secureHeaders({
|
||||||
referrerPolicy: "strict-origin-when-cross-origin",
|
referrerPolicy: "strict-origin-when-cross-origin",
|
||||||
strictTransportSecurity: false,
|
strictTransportSecurity: false,
|
||||||
|
contentSecurityPolicyReportOnly: {
|
||||||
|
defaultSrc: ["'self'"],
|
||||||
|
scriptSrc: ["'self'", "'unsafe-inline'", "https://js.churchcenter.com"],
|
||||||
|
styleSrc: ["'self'", "'unsafe-inline'"],
|
||||||
|
imgSrc: ["'self'", "data:", "https:"],
|
||||||
|
mediaSrc: ["'self'"],
|
||||||
|
fontSrc: ["'self'"],
|
||||||
|
connectSrc: ["'self'"],
|
||||||
|
frameSrc: EMBEDS,
|
||||||
|
frameAncestors: ["'self'"],
|
||||||
|
baseUri: ["'self'"],
|
||||||
|
formAction: ["'self'"],
|
||||||
|
objectSrc: ["'none'"],
|
||||||
|
reportUri: "/api/csp-report",
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* What the policy above would have blocked. Browsers post these on
|
||||||
|
their own; a short line per report is plenty to go on. */
|
||||||
|
app.use("/api/csp-report", rateLimit({ windowMs: 60_000, max: 30 }));
|
||||||
|
app.post("/api/csp-report", async (c) => {
|
||||||
|
const text = (await c.req.text()).slice(0, 4000);
|
||||||
|
try {
|
||||||
|
const report = JSON.parse(text)["csp-report"] ?? {};
|
||||||
|
console.warn(
|
||||||
|
`csp ${report["violated-directive"] ?? "?"} blocked ${report["blocked-uri"] ?? "?"} on ${report["document-uri"] ?? "?"}`,
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
// Not a report; nothing to log.
|
||||||
|
}
|
||||||
|
return c.body(null, 204);
|
||||||
|
});
|
||||||
|
|
||||||
/* Refuse a form-style write (text/plain, form or multipart body)
|
/* Refuse a form-style write (text/plain, form or multipart body)
|
||||||
that another site sent, including a sibling subdomain, which
|
that another site sent, including a sibling subdomain, which
|
||||||
SameSite=Lax cookies don't stop. Browsers mark their own requests
|
SameSite=Lax cookies don't stop. Browsers mark their own requests
|
||||||
|
|
|
||||||
11
server/src/migrations/039_privacy_contact.sql
Normal file
11
server/src/migrations/039_privacy_contact.sql
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
-- ═══════════════════════════════════════════════════════════════
|
||||||
|
-- 039 PRIVACY CONTACT
|
||||||
|
--
|
||||||
|
-- The address the Privacy page gives for privacy questions and data
|
||||||
|
-- requests (Panel → Site settings). Null falls back to site.json's
|
||||||
|
-- privacyEmail; blank in both, the page points to its request form
|
||||||
|
-- only. Data requests themselves are feedback rows of type
|
||||||
|
-- 'privacy' (routes/feedback.js), triaged in Admin → Feedback.
|
||||||
|
-- ═══════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
ALTER TABLE site_settings ADD COLUMN privacy_email TEXT;
|
||||||
12
server/src/migrations/040_drop_event_gradient.sql
Normal file
12
server/src/migrations/040_drop_event_gradient.sql
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
-- ═══════════════════════════════════════════════════════════════
|
||||||
|
-- 040 NO MORE CARD GRADIENTS
|
||||||
|
--
|
||||||
|
-- An event card is its photo (card_image) under a light veil, or a
|
||||||
|
-- plain card, always with the event's colour as its border. The
|
||||||
|
-- gradient layer went over the photo and hid it, and gradients are
|
||||||
|
-- leaving the design, so the column goes. Any gradient saved on an
|
||||||
|
-- event is dropped with it; the card falls back to its photo or the
|
||||||
|
-- plain surface.
|
||||||
|
-- ═══════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
ALTER TABLE events DROP COLUMN gradient;
|
||||||
|
|
@ -102,12 +102,13 @@ export function siteFor(db) {
|
||||||
...base.robots,
|
...base.robots,
|
||||||
index: row.indexing ? row.indexing === "on" : base.robots?.index !== false,
|
index: row.indexing ? row.indexing === "on" : base.robots?.index !== false,
|
||||||
},
|
},
|
||||||
|
privacyEmail: row.privacy_email || base.privacyEmail || "",
|
||||||
pages,
|
pages,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* What the browser app reads for headings and titles. */
|
/* What the browser app reads for headings and titles. */
|
||||||
const forBrowser = (site) => ({ title: site.title, pages: site.pages });
|
const forBrowser = (site) => ({ title: site.title, pages: site.pages, privacyEmail: site.privacyEmail });
|
||||||
|
|
||||||
/* robots.txt for this database's setting, as the build writes it. */
|
/* robots.txt for this database's setting, as the build writes it. */
|
||||||
export function robotsTxt(site) {
|
export function robotsTxt(site) {
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,6 @@ function shapeEvent(row, links, cardBlocks, hosts = []) {
|
||||||
org_logo: row.effective_org_logo,
|
org_logo: row.effective_org_logo,
|
||||||
event_logo: row.event_logo,
|
event_logo: row.event_logo,
|
||||||
color: row.effective_color,
|
color: row.effective_color,
|
||||||
gradient: row.gradient,
|
|
||||||
card_image: row.card_image,
|
card_image: row.card_image,
|
||||||
|
|
||||||
hosts: hosts.map(shapeHost),
|
hosts: hosts.map(shapeHost),
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,10 @@ const LIMITS = {
|
||||||
|
|
||||||
const MIN_MESSAGE = 10;
|
const MIN_MESSAGE = 10;
|
||||||
|
|
||||||
// Must match FEEDBACK_TYPES in src/pages/sections/FeedbackForm.jsx.
|
// Must match FEEDBACK_TYPES and DATA_REQUEST in src/data/feedbackTypes.ts.
|
||||||
// Anything else falls back to 'general' rather than being rejected,
|
// Anything else falls back to 'general' rather than being rejected,
|
||||||
// a renamed option shouldn't lose someone's submission.
|
// a renamed option shouldn't lose someone's submission.
|
||||||
const TYPES = ["broken", "confusing", "outdated", "request", "praise", "other"];
|
const TYPES = ["broken", "confusing", "outdated", "request", "praise", "other", "privacy"];
|
||||||
|
|
||||||
/* ── Input cleaning ──────────────────────────────────────────── */
|
/* ── Input cleaning ──────────────────────────────────────────── */
|
||||||
|
|
||||||
|
|
@ -76,6 +76,10 @@ feedback.post("/", async (c) => {
|
||||||
const errors = {};
|
const errors = {};
|
||||||
if (message.length < MIN_MESSAGE) errors.message = "Please write a little more.";
|
if (message.length < MIN_MESSAGE) errors.message = "Please write a little more.";
|
||||||
if (!looksLikeEmail(email)) errors.email = "That email doesn't look right.";
|
if (!looksLikeEmail(email)) errors.email = "That email doesn't look right.";
|
||||||
|
// A data request (Privacy page) has to be answerable.
|
||||||
|
else if (feedbackType === "privacy" && !email) {
|
||||||
|
errors.email = "We need an email address to reply to a data request.";
|
||||||
|
}
|
||||||
|
|
||||||
if (Object.keys(errors).length > 0) {
|
if (Object.keys(errors).length > 0) {
|
||||||
return c.json({ error: "Validation failed", fields: errors }, 422);
|
return c.json({ error: "Validation failed", fields: errors }, 422);
|
||||||
|
|
|
||||||
|
|
@ -352,7 +352,6 @@ tx(db, () => {
|
||||||
org_logo: IMAGE,
|
org_logo: IMAGE,
|
||||||
event_logo: IMAGE,
|
event_logo: IMAGE,
|
||||||
color: "#d62976",
|
color: "#d62976",
|
||||||
gradient: "linear-gradient(160deg, rgba(214,41,118,0.10), rgba(19,139,160,0.10))",
|
|
||||||
card_image: IMAGE,
|
card_image: IMAGE,
|
||||||
is_published: 1,
|
is_published: 1,
|
||||||
is_listed: LISTED,
|
is_listed: LISTED,
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
"title": "Next Generation of Unity",
|
"title": "Next Generation of Unity",
|
||||||
"url": "https://nextgenerationofunity.org",
|
"url": "https://nextgenerationofunity.org",
|
||||||
"description": "",
|
"description": "",
|
||||||
|
"privacyEmail": "",
|
||||||
"robots": {
|
"robots": {
|
||||||
"index": true
|
"index": true
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -33,13 +33,14 @@
|
||||||
visible even if the renderer hasn't caught up with it.
|
visible even if the renderer hasn't caught up with it.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { blockMedia } from '../lib/media.ts'
|
import { mediaUrl } from '../lib/media.ts'
|
||||||
import type { ContentBlock } from '../lib/useContent.ts'
|
import type { ContentBlock } from '../lib/useContent.ts'
|
||||||
import { Anchor, Inline, Paragraphs } from './InlineText.tsx'
|
import { Anchor, Inline, Paragraphs } from './InlineText.tsx'
|
||||||
import VideoPlayer from './VideoPlayer.tsx'
|
import VideoPlayer from './VideoPlayer.tsx'
|
||||||
import ScheduleBlock from './ScheduleBlock.tsx'
|
import ScheduleBlock from './ScheduleBlock.tsx'
|
||||||
|
import { accentText } from '../lib/color.ts'
|
||||||
|
|
||||||
const BODY = '#4a6b72'
|
const BODY = 'var(--color-muted)'
|
||||||
|
|
||||||
export default function ContentBlocks({
|
export default function ContentBlocks({
|
||||||
blocks,
|
blocks,
|
||||||
|
|
@ -76,14 +77,14 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
|
||||||
switch (block.type) {
|
switch (block.type) {
|
||||||
case 'heading':
|
case 'heading':
|
||||||
return (
|
return (
|
||||||
<h3 className="text-2xl font-bold" style={{ color: accent }}>
|
<h3 className="text-2xl font-bold" style={{ color: accentText(accent) }}>
|
||||||
{text}
|
{text}
|
||||||
</h3>
|
</h3>
|
||||||
)
|
)
|
||||||
|
|
||||||
case 'subheading':
|
case 'subheading':
|
||||||
return (
|
return (
|
||||||
<h4 className="text-lg font-semibold" style={{ color: accent }}>
|
<h4 className="text-lg font-semibold" style={{ color: accentText(accent) }}>
|
||||||
{text}
|
{text}
|
||||||
</h4>
|
</h4>
|
||||||
)
|
)
|
||||||
|
|
@ -93,12 +94,12 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
|
||||||
<ul className="space-y-2">
|
<ul className="space-y-2">
|
||||||
{(block.items ?? []).map((item, index) => (
|
{(block.items ?? []).map((item, index) => (
|
||||||
<li key={index} className="flex gap-3">
|
<li key={index} className="flex gap-3">
|
||||||
<span aria-hidden="true" style={{ color: accent }}>
|
<span aria-hidden="true" style={{ color: accentText(accent) }}>
|
||||||
•
|
•
|
||||||
</span>
|
</span>
|
||||||
<span style={{ color: BODY }}>
|
<span style={{ color: BODY }}>
|
||||||
{item.url ? (
|
{item.url ? (
|
||||||
<Anchor href={item.url} className="underline" style={{ color: accent }}>
|
<Anchor href={item.url} className="underline" style={{ color: accentText(accent) }}>
|
||||||
{item.text}
|
{item.text}
|
||||||
</Anchor>
|
</Anchor>
|
||||||
) : (
|
) : (
|
||||||
|
|
@ -120,8 +121,8 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
|
||||||
<Anchor
|
<Anchor
|
||||||
key={index}
|
key={index}
|
||||||
href={item.url as string}
|
href={item.url as string}
|
||||||
className="rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-[#eef9fb]"
|
className="rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-tint"
|
||||||
style={{ borderColor: accent, color: accent }}
|
style={{ borderColor: accent, color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
{item.text}
|
{item.text}
|
||||||
</Anchor>
|
</Anchor>
|
||||||
|
|
@ -150,7 +151,7 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
|
||||||
<Inline text={text} accent={accent} />
|
<Inline text={text} accent={accent} />
|
||||||
</blockquote>
|
</blockquote>
|
||||||
{block.cite && (
|
{block.cite && (
|
||||||
<figcaption className="mt-2 text-sm font-semibold not-italic" style={{ color: accent }}>
|
<figcaption className="mt-2 text-sm font-semibold not-italic" style={{ color: accentText(accent) }}>
|
||||||
{block.cite}
|
{block.cite}
|
||||||
</figcaption>
|
</figcaption>
|
||||||
)}
|
)}
|
||||||
|
|
@ -162,14 +163,14 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
|
||||||
return (
|
return (
|
||||||
<aside
|
<aside
|
||||||
className="space-y-3 rounded-2xl border-l-4 px-6 py-5 leading-relaxed"
|
className="space-y-3 rounded-2xl border-l-4 px-6 py-5 leading-relaxed"
|
||||||
style={{ borderColor: accent, background: `color-mix(in srgb, ${accent} 8%, white)`, color: '#26454c' }}
|
style={{ borderColor: accent, background: `color-mix(in srgb, ${accent} 8%, var(--color-surface))`, color: 'var(--color-body)' }}
|
||||||
>
|
>
|
||||||
<Paragraphs text={text} accent={accent} />
|
<Paragraphs text={text} accent={accent} />
|
||||||
</aside>
|
</aside>
|
||||||
)
|
)
|
||||||
|
|
||||||
case 'image': {
|
case 'image': {
|
||||||
const src = blockMedia(block.media)
|
const src = mediaUrl(block.media)
|
||||||
if (!src) return null
|
if (!src) return null
|
||||||
const img = (
|
const img = (
|
||||||
<img
|
<img
|
||||||
|
|
@ -195,7 +196,7 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
|
||||||
return (
|
return (
|
||||||
<figure>
|
<figure>
|
||||||
<div className="overflow-hidden rounded-lg">
|
<div className="overflow-hidden rounded-lg">
|
||||||
<VideoPlayer url={block.href} still={blockMedia(block.media)} title={text || null} />
|
<VideoPlayer url={block.href} still={mediaUrl(block.media)} title={text || null} />
|
||||||
</div>
|
</div>
|
||||||
<Caption text={text} />
|
<Caption text={text} />
|
||||||
</figure>
|
</figure>
|
||||||
|
|
@ -213,7 +214,7 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
|
||||||
if (!text) return null
|
if (!text) return null
|
||||||
return block.href ? (
|
return block.href ? (
|
||||||
<p className="leading-relaxed" style={{ color: BODY }}>
|
<p className="leading-relaxed" style={{ color: BODY }}>
|
||||||
<Anchor href={block.href} className="underline" style={{ color: accent }}>
|
<Anchor href={block.href} className="underline" style={{ color: accentText(accent) }}>
|
||||||
{text}
|
{text}
|
||||||
</Anchor>
|
</Anchor>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import { useState } from 'react'
|
||||||
import HomeLink from '../pages/sections/home/HomeLink.tsx'
|
import HomeLink from '../pages/sections/home/HomeLink.tsx'
|
||||||
import VideoPlayer from './VideoPlayer.tsx'
|
import VideoPlayer from './VideoPlayer.tsx'
|
||||||
import { refHref } from '../lib/hrefs.ts'
|
import { refHref } from '../lib/hrefs.ts'
|
||||||
import { logoForKind } from '../lib/media.ts'
|
import { mediaUrl } from '../lib/media.ts'
|
||||||
import type { FeaturedCard } from '../lib/useFrontPage.ts'
|
import type { FeaturedCard } from '../lib/useFrontPage.ts'
|
||||||
|
|
||||||
/* Image kinds that are photographs, drawn edge to edge. Anything
|
/* Image kinds that are photographs, drawn edge to edge. Anything
|
||||||
|
|
@ -39,11 +39,11 @@ function hrefFor(card: FeaturedCard): string | null {
|
||||||
|
|
||||||
function Picture({ card }: { card: FeaturedCard }) {
|
function Picture({ card }: { card: FeaturedCard }) {
|
||||||
const [failed, setFailed] = useState(false)
|
const [failed, setFailed] = useState(false)
|
||||||
const src = card.image ? logoForKind(card.image.kind, card.image.file) : null
|
const src = card.image ? mediaUrl(card.image.file) : null
|
||||||
const photo = card.image ? PHOTO_KINDS.has(card.image.kind) : false
|
const photo = card.image ? PHOTO_KINDS.has(card.image.kind) : false
|
||||||
|
|
||||||
if (!src || failed) {
|
if (!src || failed) {
|
||||||
return <div className="aspect-video w-full bg-gradient-to-br from-[#eef9fb] to-[#d9f0f3]" />
|
return <div className="aspect-video w-full bg-tint" />
|
||||||
}
|
}
|
||||||
|
|
||||||
return photo ? (
|
return photo ? (
|
||||||
|
|
@ -55,7 +55,7 @@ function Picture({ card }: { card: FeaturedCard }) {
|
||||||
className="aspect-video w-full object-cover"
|
className="aspect-video w-full object-cover"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex aspect-video w-full items-center justify-center bg-[#eef9fb] p-8">
|
<div className="flex aspect-video w-full items-center justify-center bg-tint p-8">
|
||||||
<img
|
<img
|
||||||
src={src}
|
src={src}
|
||||||
alt=""
|
alt=""
|
||||||
|
|
@ -68,7 +68,7 @@ function Picture({ card }: { card: FeaturedCard }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function VideoPicture({ card }: { card: FeaturedCard }) {
|
function VideoPicture({ card }: { card: FeaturedCard }) {
|
||||||
const own = card.image ? logoForKind(card.image.kind, card.image.file) : null
|
const own = card.image ? mediaUrl(card.image.file) : null
|
||||||
return <VideoPlayer url={card.url} still={own} title={card.title} />
|
return <VideoPlayer url={card.url} still={own} title={card.title} />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,10 +78,10 @@ function Card({ card }: { card: FeaturedCard }) {
|
||||||
const text = (
|
const text = (
|
||||||
<div className="flex flex-1 flex-col p-6">
|
<div className="flex flex-1 flex-col p-6">
|
||||||
{card.eyebrow && (
|
{card.eyebrow && (
|
||||||
<p className="text-xs font-bold uppercase tracking-[0.2em] text-[#0f7183]">{card.eyebrow}</p>
|
<p className="text-xs font-bold uppercase tracking-[0.2em] text-link">{card.eyebrow}</p>
|
||||||
)}
|
)}
|
||||||
{card.title && (
|
{card.title && (
|
||||||
<h3 className="mt-2 font-display text-xl font-extrabold leading-snug text-[#073d4a]">
|
<h3 className="mt-2 font-display text-xl font-extrabold leading-snug text-ink">
|
||||||
{href ? (
|
{href ? (
|
||||||
// Stretched over the whole card, so the picture and the
|
// Stretched over the whole card, so the picture and the
|
||||||
// blurb are part of the click without nesting links.
|
// blurb are part of the click without nesting links.
|
||||||
|
|
@ -96,12 +96,12 @@ function Card({ card }: { card: FeaturedCard }) {
|
||||||
)}
|
)}
|
||||||
</h3>
|
</h3>
|
||||||
)}
|
)}
|
||||||
{card.blurb && <p className="mt-2 leading-relaxed text-[#4a6b72]">{card.blurb}</p>}
|
{card.blurb && <p className="mt-2 leading-relaxed text-muted">{card.blurb}</p>}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li className="relative flex flex-col overflow-hidden rounded-2xl border border-[#138ba0]/15 bg-white shadow-sm transition-shadow hover:shadow-lg">
|
<li className="relative flex flex-col overflow-hidden rounded-2xl border border-brand/15 bg-surface shadow-sm transition-shadow hover:shadow-lg">
|
||||||
{card.kind === 'video' ? (
|
{card.kind === 'video' ? (
|
||||||
// Above the stretched link, which a video card doesn't have
|
// Above the stretched link, which a video card doesn't have
|
||||||
// anyway, so the play button always gets the click.
|
// anyway, so the play button always gets the click.
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import { Fragment, type CSSProperties, type ReactNode } from 'react'
|
import { Fragment, type CSSProperties, type ReactNode } from 'react'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
|
import { accentText } from '../lib/color.ts'
|
||||||
|
|
||||||
const TOKEN = /\*\*(.+?)\*\*|\*(.+?)\*|\[([^\]]+)\]\(([^)\s]+)\)/g
|
const TOKEN = /\*\*(.+?)\*\*|\*(.+?)\*|\[([^\]]+)\]\(([^)\s]+)\)/g
|
||||||
const SAFE_URL = /^(\/(?!\/)|#|https?:\/\/|mailto:|tel:)/i
|
const SAFE_URL = /^(\/(?!\/)|#|https?:\/\/|mailto:|tel:)/i
|
||||||
|
|
@ -88,7 +89,7 @@ function line(text: string, accent: string, key: string): ReactNode[] {
|
||||||
else if (italic != null) out.push(<em key={k}>{italic}</em>)
|
else if (italic != null) out.push(<em key={k}>{italic}</em>)
|
||||||
else if (label != null && SAFE_URL.test(url)) {
|
else if (label != null && SAFE_URL.test(url)) {
|
||||||
out.push(
|
out.push(
|
||||||
<Anchor key={k} href={url} className="underline underline-offset-2" style={{ color: accent }}>
|
<Anchor key={k} href={url} className="underline underline-offset-2" style={{ color: accentText(accent) }}>
|
||||||
{label}
|
{label}
|
||||||
</Anchor>,
|
</Anchor>,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts";
|
||||||
import Banner from "./Banner.tsx";
|
import Banner from "./Banner.tsx";
|
||||||
import nguLogo from "../assets/logos/NGU_Logo.svg";
|
import nguLogo from "../assets/logos/NGU_Logo.svg";
|
||||||
import Footer from "./Footer.tsx";
|
import Footer from "./Footer.tsx";
|
||||||
|
import PrivacyNotice from "./PrivacyNotice.tsx";
|
||||||
|
import ThemeToggle from "./ThemeToggle.tsx";
|
||||||
|
import { scrollBehavior } from "../lib/motion.ts";
|
||||||
|
|
||||||
/* ── Right-side nav actions ──────────────────────────────── */
|
/* ── Right-side nav actions ──────────────────────────────── */
|
||||||
|
|
||||||
|
|
@ -115,7 +118,7 @@ export default function Layout() {
|
||||||
if (location.hash) {
|
if (location.hash) {
|
||||||
const el = document.querySelector(location.hash);
|
const el = document.querySelector(location.hash);
|
||||||
if (el) {
|
if (el) {
|
||||||
el.scrollIntoView({ behavior: "smooth" });
|
el.scrollIntoView({ behavior: scrollBehavior() });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -153,7 +156,7 @@ export default function Layout() {
|
||||||
<div className="min-h-screen overflow-x-hidden">
|
<div className="min-h-screen overflow-x-hidden">
|
||||||
<a
|
<a
|
||||||
href="#main"
|
href="#main"
|
||||||
className="sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[70] focus:rounded-full focus:bg-white focus:px-4 focus:py-2 focus:font-semibold focus:text-[#073d4a]"
|
className="sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[70] focus:rounded-full focus:bg-surface focus:px-4 focus:py-2 focus:font-semibold focus:text-ink"
|
||||||
>
|
>
|
||||||
Skip to content
|
Skip to content
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -206,6 +209,8 @@ export default function Layout() {
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ThemeToggle className="text-white/80 hover:bg-white/10 hover:text-white" />
|
||||||
|
|
||||||
<button
|
<button
|
||||||
className="md:hidden text-white p-2"
|
className="md:hidden text-white p-2"
|
||||||
aria-label="Open menu"
|
aria-label="Open menu"
|
||||||
|
|
@ -269,6 +274,7 @@ export default function Layout() {
|
||||||
{/*Site Footer applied to every page*/}
|
{/*Site Footer applied to every page*/}
|
||||||
<div inert={mobileMenuOpen}>
|
<div inert={mobileMenuOpen}>
|
||||||
<Footer />
|
<Footer />
|
||||||
|
<PrivacyNotice />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Mobile menu */}
|
{/* Mobile menu */}
|
||||||
|
|
|
||||||
46
src/components/LegalText.tsx
Normal file
46
src/components/LegalText.tsx
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
|
LEGAL TEXT
|
||||||
|
|
||||||
|
The Privacy and Terms pages: a list of headed parts, each a few
|
||||||
|
paragraphs or a bullet list, in a readable column. The words live
|
||||||
|
in the page files; this only lays them out the same way.
|
||||||
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
import type { ReactNode } from 'react'
|
||||||
|
|
||||||
|
export type LegalPart = {
|
||||||
|
/** Anchor for linking to one part, eg. 'cookies'. */
|
||||||
|
id: string
|
||||||
|
heading: string
|
||||||
|
body: ReactNode[]
|
||||||
|
list?: ReactNode[]
|
||||||
|
/** After the list. */
|
||||||
|
after?: ReactNode[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function LegalText({ parts }: { parts: LegalPart[] }) {
|
||||||
|
return (
|
||||||
|
<div className="mx-auto max-w-3xl space-y-10 px-6 leading-relaxed text-body">
|
||||||
|
{parts.map((part) => (
|
||||||
|
<section key={part.id} id={part.id} style={{ scrollMarginTop: '6rem' }}>
|
||||||
|
<h3 className="text-xl font-bold text-ink">{part.heading}</h3>
|
||||||
|
<div className="mt-3 space-y-3">
|
||||||
|
{part.body.map((paragraph, i) => (
|
||||||
|
<p key={i}>{paragraph}</p>
|
||||||
|
))}
|
||||||
|
{part.list && (
|
||||||
|
<ul className="list-disc space-y-2 pl-6">
|
||||||
|
{part.list.map((item, i) => (
|
||||||
|
<li key={i}>{item}</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
{part.after?.map((paragraph, i) => (
|
||||||
|
<p key={i}>{paragraph}</p>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
27
src/components/Logo.tsx
Normal file
27
src/components/Logo.tsx
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
|
LOGO
|
||||||
|
|
||||||
|
An <img> for a logo or mark that may not exist: no src, or a file
|
||||||
|
that 404s, and it draws `fallback` instead (initials, a colour dot,
|
||||||
|
or nothing). `src` is already resolved (mediaUrl in media.ts).
|
||||||
|
Decorative by default (alt ""), since a logo sits next to the
|
||||||
|
name it stands for.
|
||||||
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
import { useState, type ReactNode } from 'react'
|
||||||
|
|
||||||
|
export default function Logo({
|
||||||
|
src,
|
||||||
|
alt = '',
|
||||||
|
className,
|
||||||
|
fallback = null,
|
||||||
|
}: {
|
||||||
|
src?: string | null
|
||||||
|
alt?: string
|
||||||
|
className?: string
|
||||||
|
fallback?: ReactNode
|
||||||
|
}) {
|
||||||
|
const [failed, setFailed] = useState(false)
|
||||||
|
if (!src || failed) return <>{fallback}</>
|
||||||
|
return <img src={src} alt={alt} loading="lazy" className={className} onError={() => setFailed(true)} />
|
||||||
|
}
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
title: "Local Chapters",
|
title: "Local Chapters",
|
||||||
blurb: "Optional line under the section heading.",
|
blurb: "Optional line under the section heading.",
|
||||||
accent: "#0f7183", // heading, banner, rule
|
accent: "#0f7183", // heading, banner, rule
|
||||||
background: "#eef9fb",
|
background: "var(--color-tint)",
|
||||||
actions: <SomeButton />, // optional, right of the heading
|
actions: <SomeButton />, // optional, right of the heading
|
||||||
content: <YourStuff />,
|
content: <YourStuff />,
|
||||||
},
|
},
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
import { useEffect, type ReactNode } from "react";
|
import { useEffect, type ReactNode } from "react";
|
||||||
|
|
||||||
import { documentTitle } from "../lib/site.ts";
|
import { documentTitle } from "../lib/site.ts";
|
||||||
|
import { accentText } from '../lib/color.ts'
|
||||||
|
|
||||||
const TEAL = "#0f7183";
|
const TEAL = "#0f7183";
|
||||||
|
|
||||||
|
|
@ -75,10 +76,10 @@ export function Section({ section }: { section: ShellSection }) {
|
||||||
<div className="max-w-6xl mx-auto px-6 mb-10">
|
<div className="max-w-6xl mx-auto px-6 mb-10">
|
||||||
<div className="flex flex-wrap items-end justify-between gap-4">
|
<div className="flex flex-wrap items-end justify-between gap-4">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-4xl md:text-5xl font-extrabold" style={{ color: accent }}>
|
<h2 className="text-4xl md:text-5xl font-extrabold" style={{ color: accentText(accent) }}>
|
||||||
{title}
|
{title}
|
||||||
</h2>
|
</h2>
|
||||||
{blurb && <p className="mt-2 text-[#4a6b72] max-w-xl">{blurb}</p>}
|
{blurb && <p className="mt-2 text-muted max-w-xl">{blurb}</p>}
|
||||||
</div>
|
</div>
|
||||||
{actions}
|
{actions}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -101,12 +102,12 @@ export default function PageShell({ title, intro, sections }: PageShellProps) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Page header */}
|
{/* Page header */}
|
||||||
<div className="pt-24 pb-12 px-6" style={{ background: "#eef9fb" }}>
|
<div className="pt-24 pb-12 px-6" style={{ background: "var(--color-tint)" }}>
|
||||||
<div className="max-w-6xl mx-auto">
|
<div className="max-w-6xl mx-auto">
|
||||||
<h1 className="text-5xl md:text-6xl font-extrabold" style={{ color: TEAL }}>
|
<h1 className="text-5xl md:text-6xl font-extrabold" style={{ color: accentText(TEAL) }}>
|
||||||
{title}
|
{title}
|
||||||
</h1>
|
</h1>
|
||||||
{intro && <p className="mt-3 text-lg text-[#4a6b72] max-w-2xl">{intro}</p>}
|
{intro && <p className="mt-3 text-lg text-muted max-w-2xl">{intro}</p>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,10 @@
|
||||||
|
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import PageShell from './PageShell.tsx'
|
import PageShell from './PageShell.tsx'
|
||||||
|
import { accentText } from '../lib/color.ts'
|
||||||
|
|
||||||
const TEAL = '#0f7183'
|
const TEAL = '#0f7183'
|
||||||
const BODY = '#4a6b72'
|
const BODY = 'var(--color-muted)'
|
||||||
|
|
||||||
export default function PageState({
|
export default function PageState({
|
||||||
loading,
|
loading,
|
||||||
|
|
@ -51,8 +52,8 @@ export default function PageState({
|
||||||
</p>
|
</p>
|
||||||
<Link
|
<Link
|
||||||
to={backTo}
|
to={backTo}
|
||||||
className="mt-4 inline-block rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-[#eef9fb]"
|
className="mt-4 inline-block rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-tint"
|
||||||
style={{ borderColor: TEAL, color: TEAL }}
|
style={{ borderColor: TEAL, color: accentText(TEAL) }}
|
||||||
>
|
>
|
||||||
{backLabel}
|
{backLabel}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -66,8 +67,8 @@ export default function PageState({
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={onRetry}
|
onClick={onRetry}
|
||||||
className="mt-3 rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-[#eef9fb]"
|
className="mt-3 rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-tint"
|
||||||
style={{ borderColor: TEAL, color: TEAL }}
|
style={{ borderColor: TEAL, color: accentText(TEAL) }}
|
||||||
>
|
>
|
||||||
Try again
|
Try again
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -85,7 +86,7 @@ export default function PageState({
|
||||||
return (
|
return (
|
||||||
<PageShell
|
<PageShell
|
||||||
title={title}
|
title={title}
|
||||||
sections={[{ id: 'status', title: '', accent: TEAL, background: '#ffffff', content }]}
|
sections={[{ id: 'status', title: '', accent: TEAL, background: 'var(--color-surface)', content }]}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,11 @@
|
||||||
|
|
||||||
/* color */
|
/* color */
|
||||||
--pl-accent: #0f7183;
|
--pl-accent: #0f7183;
|
||||||
--pl-frame-bg: #fff;
|
--pl-frame-bg: var(--color-surface);
|
||||||
--pl-frame-edge: rgba(15, 23, 42, 0.1);
|
--pl-frame-edge: rgba(15, 23, 42, 0.1);
|
||||||
--pl-photo-bg: #e7edef;
|
--pl-photo-bg: color-mix(in srgb, var(--color-muted) 15%, var(--color-surface));
|
||||||
--pl-ink: #16262b;
|
--pl-ink: var(--color-ink);
|
||||||
--pl-muted: #4a6b72;
|
--pl-muted: var(--color-muted);
|
||||||
--pl-rule: rgba(45, 200, 224, 0.3);
|
--pl-rule: rgba(45, 200, 224, 0.3);
|
||||||
--pl-shadow: 0 1px 1px rgba(15, 23, 42, 0.06), 0 10px 18px -14px rgba(15, 23, 42, 0.5);
|
--pl-shadow: 0 1px 1px rgba(15, 23, 42, 0.06), 0 10px 18px -14px rgba(15, 23, 42, 0.5);
|
||||||
|
|
||||||
|
|
@ -249,7 +249,7 @@
|
||||||
padding: 1rem 1.1rem;
|
padding: 1rem 1.1rem;
|
||||||
border-left: 3px solid var(--pl-accent);
|
border-left: 3px solid var(--pl-accent);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background: color-mix(in srgb, var(--pl-accent) 7%, #fff);
|
background: color-mix(in srgb, var(--pl-accent) 7%, var(--color-surface));
|
||||||
max-width: 68ch;
|
max-width: 68ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -278,7 +278,7 @@
|
||||||
height: 1.75rem;
|
height: 1.75rem;
|
||||||
border: 1px solid var(--pl-frame-edge);
|
border: 1px solid var(--pl-frame-edge);
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: #fff;
|
background: var(--color-surface);
|
||||||
color: var(--pl-muted);
|
color: var(--pl-muted);
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
|
|
@ -309,7 +309,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.pl__fact a {
|
.pl__fact a {
|
||||||
color: var(--pl-accent);
|
color: color-mix(in srgb, var(--pl-accent) var(--accent-text-mix), #fff);
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
text-underline-offset: 2px;
|
text-underline-offset: 2px;
|
||||||
}
|
}
|
||||||
|
|
@ -326,7 +326,7 @@
|
||||||
margin-top: 0.75rem;
|
margin-top: 0.75rem;
|
||||||
font-size: 0.9375rem;
|
font-size: 0.9375rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--pl-accent);
|
color: color-mix(in srgb, var(--pl-accent) var(--accent-text-mix), #fff);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import { Link } from "react-router-dom";
|
||||||
|
|
||||||
import { get } from "../lib/api.ts";
|
import { get } from "../lib/api.ts";
|
||||||
import { isBadId, personHref } from "../lib/hrefs.ts";
|
import { isBadId, personHref } from "../lib/hrefs.ts";
|
||||||
import { initials, personPhoto } from "../lib/media.ts";
|
import { mediaUrl, initials } from "../lib/media.ts";
|
||||||
import "./PeopleTiles.css";
|
import "./PeopleTiles.css";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -548,7 +548,7 @@ function Tile({
|
||||||
const content = (
|
const content = (
|
||||||
<span className="pl__frame">
|
<span className="pl__frame">
|
||||||
<span className="pl__photo">
|
<span className="pl__photo">
|
||||||
<Photo src={personPhoto(person.photo)} name={person.name} />
|
<Photo src={mediaUrl(person.photo)} name={person.name} />
|
||||||
</span>
|
</span>
|
||||||
<span className="pl__caption">
|
<span className="pl__caption">
|
||||||
<span className="pl__name">{person.name}</span>
|
<span className="pl__name">{person.name}</span>
|
||||||
|
|
|
||||||
63
src/components/PrivacyNotice.tsx
Normal file
63
src/components/PrivacyNotice.tsx
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
|
PRIVACY NOTICE
|
||||||
|
|
||||||
|
A small note on a first visit, until closed: the site sets no
|
||||||
|
tracking cookies, and videos and maps from other companies wait
|
||||||
|
for a click (VideoPlayer, HeroStage, ScheduleBlock). Because
|
||||||
|
nothing loads before that, a notice is enough, rather than a
|
||||||
|
consent banner that blocks the page. If an embed ever loads on
|
||||||
|
its own, or analytics are added, this has to become a real
|
||||||
|
consent choice.
|
||||||
|
|
||||||
|
Closed is remembered in this browser; blocked storage just
|
||||||
|
means it shows again next time.
|
||||||
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
|
const STORAGE_KEY = 'ngu-privacy-notice-closed'
|
||||||
|
|
||||||
|
export default function PrivacyNotice() {
|
||||||
|
const [visible, setVisible] = useState(false)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
try {
|
||||||
|
if (!localStorage.getItem(STORAGE_KEY)) setVisible(true)
|
||||||
|
} catch {
|
||||||
|
setVisible(true)
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const close = () => {
|
||||||
|
setVisible(false)
|
||||||
|
try {
|
||||||
|
localStorage.setItem(STORAGE_KEY, '1')
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!visible) return null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
role="region"
|
||||||
|
aria-label="Privacy notice"
|
||||||
|
className="fixed bottom-4 left-4 right-4 z-40 mx-auto max-w-md rounded-2xl border border-brand/20 bg-surface p-4 text-sm text-body shadow-xl sm:right-auto"
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
No tracking cookies here. Videos and maps come from YouTube, Facebook or Google only when you press
|
||||||
|
play or show them, and those services may set their own cookies then.{' '}
|
||||||
|
<Link to="/privacy#cookies" className="font-semibold text-link underline underline-offset-2">
|
||||||
|
Privacy Policy
|
||||||
|
</Link>
|
||||||
|
</p>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={close}
|
||||||
|
className="mt-3 rounded-full bg-action px-4 py-1.5 font-semibold text-white hover:bg-action-hover"
|
||||||
|
>
|
||||||
|
Got it
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -24,11 +24,12 @@ import { useId, useState, type KeyboardEvent } from 'react'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
import { personHref } from '../lib/hrefs.ts'
|
import { personHref } from '../lib/hrefs.ts'
|
||||||
import { blockMedia, initials, personPhoto } from '../lib/media.ts'
|
import { mediaUrl, initials } from '../lib/media.ts'
|
||||||
import type { ContentBlockItem } from '../lib/useContent.ts'
|
import type { ContentBlockItem } from '../lib/useContent.ts'
|
||||||
import { Anchor, Paragraphs } from './InlineText.tsx'
|
import { Anchor, Paragraphs } from './InlineText.tsx'
|
||||||
|
import { withAlpha, accentText, readableOn } from '../lib/color.ts'
|
||||||
|
|
||||||
const BODY = '#4a6b72'
|
const BODY = 'var(--color-muted)'
|
||||||
const WEEKDAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']
|
const WEEKDAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']
|
||||||
|
|
||||||
type Day = { name: string; entries: ContentBlockItem[] }
|
type Day = { name: string; entries: ContentBlockItem[] }
|
||||||
|
|
@ -65,13 +66,13 @@ const mapLink = (place: string) =>
|
||||||
|
|
||||||
function Avatar({ person, size }: { person: NonNullable<ContentBlockItem['person']>; size: string }) {
|
function Avatar({ person, size }: { person: NonNullable<ContentBlockItem['person']>; size: string }) {
|
||||||
const [failed, setFailed] = useState(false)
|
const [failed, setFailed] = useState(false)
|
||||||
const src = personPhoto(person.photo)
|
const src = mediaUrl(person.photo)
|
||||||
return src && !failed ? (
|
return src && !failed ? (
|
||||||
<img src={src} alt="" onError={() => setFailed(true)} className={`${size} shrink-0 rounded-full object-cover`} />
|
<img src={src} alt="" onError={() => setFailed(true)} className={`${size} shrink-0 rounded-full object-cover`} />
|
||||||
) : (
|
) : (
|
||||||
<span
|
<span
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
className={`${size} flex shrink-0 items-center justify-center rounded-full bg-[#eef9fb] text-xs font-bold text-[#0f7183]`}
|
className={`${size} flex shrink-0 items-center justify-center rounded-full bg-tint text-xs font-bold text-link`}
|
||||||
>
|
>
|
||||||
{initials(person.name)}
|
{initials(person.name)}
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -80,13 +81,15 @@ function Avatar({ person, size }: { person: NonNullable<ContentBlockItem['person
|
||||||
|
|
||||||
function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
|
// Google's map loads only when asked for (Privacy page).
|
||||||
|
const [showMap, setShowMap] = useState(false)
|
||||||
const panelId = useId()
|
const panelId = useId()
|
||||||
const graphic = blockMedia(entry.media)
|
const graphic = mediaUrl(entry.media)
|
||||||
const place = entry.map?.trim()
|
const place = entry.map?.trim()
|
||||||
const more = Boolean(entry.description || graphic || place || entry.person)
|
const more = Boolean(entry.description || graphic || place || entry.person)
|
||||||
|
|
||||||
const title = entry.url ? (
|
const title = entry.url ? (
|
||||||
<Anchor href={entry.url} className="underline-offset-2 hover:underline" style={{ color: accent }}>
|
<Anchor href={entry.url} className="underline-offset-2 hover:underline" style={{ color: accentText(accent) }}>
|
||||||
{entry.text}
|
{entry.text}
|
||||||
</Anchor>
|
</Anchor>
|
||||||
) : (
|
) : (
|
||||||
|
|
@ -94,14 +97,14 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li className="border-b border-[#138ba0]/10 last:border-b-0">
|
<li className="border-b border-brand/10 last:border-b-0">
|
||||||
<div className="flex gap-4 py-4 sm:gap-6">
|
<div className="flex gap-4 py-4 sm:gap-6">
|
||||||
<p className="w-24 shrink-0 pt-0.5 text-sm font-semibold sm:w-32" style={{ color: accent }}>
|
<p className="w-24 shrink-0 pt-0.5 text-sm font-semibold sm:w-32" style={{ color: accentText(accent) }}>
|
||||||
{entry.time}
|
{entry.time}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<p className="font-semibold text-[#26454c]">{title}</p>
|
<p className="font-semibold text-body">{title}</p>
|
||||||
{(entry.location || entry.person) && (
|
{(entry.location || entry.person) && (
|
||||||
<p className="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm" style={{ color: BODY }}>
|
<p className="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm" style={{ color: BODY }}>
|
||||||
{entry.location && <span>{entry.location}</span>}
|
{entry.location && <span>{entry.location}</span>}
|
||||||
|
|
@ -127,8 +130,8 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
||||||
aria-expanded={open}
|
aria-expanded={open}
|
||||||
aria-controls={panelId}
|
aria-controls={panelId}
|
||||||
aria-label={open ? `Less about ${entry.text}` : `More about ${entry.text}`}
|
aria-label={open ? `Less about ${entry.text}` : `More about ${entry.text}`}
|
||||||
className="h-8 w-8 shrink-0 rounded-full border text-sm transition-colors hover:bg-[#eef9fb]"
|
className="h-8 w-8 shrink-0 rounded-full border text-sm transition-colors hover:bg-tint"
|
||||||
style={{ borderColor: `${accent}55`, color: accent }}
|
style={{ borderColor: `${withAlpha(accent, 33)}`, color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
<span aria-hidden="true" className={`inline-block transition-transform ${open ? 'rotate-180' : ''}`}>
|
<span aria-hidden="true" className={`inline-block transition-transform ${open ? 'rotate-180' : ''}`}>
|
||||||
▾
|
▾
|
||||||
|
|
@ -138,7 +141,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{more && open && (
|
{more && open && (
|
||||||
<div id={panelId} className="mb-5 space-y-5 rounded-2xl bg-[#f6fbfc] p-5 sm:ml-38">
|
<div id={panelId} className="mb-5 space-y-5 rounded-2xl bg-tint-soft p-5 sm:ml-38">
|
||||||
{entry.person && (
|
{entry.person && (
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<Avatar person={entry.person} size="h-16 w-16" />
|
<Avatar person={entry.person} size="h-16 w-16" />
|
||||||
|
|
@ -146,7 +149,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
||||||
<Link
|
<Link
|
||||||
to={personHref(entry.person.id)}
|
to={personHref(entry.person.id)}
|
||||||
className="font-semibold hover:underline"
|
className="font-semibold hover:underline"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
{entry.person.name}
|
{entry.person.name}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -169,19 +172,31 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
||||||
|
|
||||||
{place && (
|
{place && (
|
||||||
<div>
|
<div>
|
||||||
<iframe
|
{showMap ? (
|
||||||
src={mapEmbed(place)}
|
<iframe
|
||||||
title={`Map: ${place}`}
|
src={mapEmbed(place)}
|
||||||
loading="lazy"
|
title={`Map: ${place}`}
|
||||||
referrerPolicy="no-referrer-when-downgrade"
|
loading="lazy"
|
||||||
className="aspect-video w-full rounded-lg border-0"
|
referrerPolicy="no-referrer-when-downgrade"
|
||||||
/>
|
className="aspect-video w-full rounded-lg border-0"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setShowMap(true)}
|
||||||
|
className="flex aspect-video w-full flex-col items-center justify-center gap-1 rounded-lg border border-dashed text-sm"
|
||||||
|
style={{ borderColor: `${withAlpha(accent, 33)}`, color: BODY }}
|
||||||
|
>
|
||||||
|
<span className="font-semibold">Show map</span>
|
||||||
|
<span className="text-xs">{place}, from Google Maps</span>
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
<a
|
<a
|
||||||
href={mapLink(place)}
|
href={mapLink(place)}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
className="mt-2 inline-block text-sm underline"
|
className="mt-2 inline-block text-sm underline"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
Open in Google Maps
|
Open in Google Maps
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -244,8 +259,8 @@ export default function ScheduleBlock({
|
||||||
className="rounded-full border px-5 py-2 text-sm font-semibold transition-colors"
|
className="rounded-full border px-5 py-2 text-sm font-semibold transition-colors"
|
||||||
style={
|
style={
|
||||||
selected
|
selected
|
||||||
? { background: accent, borderColor: accent, color: '#ffffff' }
|
? { background: accent, borderColor: accent, color: readableOn(accent) }
|
||||||
: { borderColor: `${accent}55`, color: accent }
|
: { borderColor: `${withAlpha(accent, 33)}`, color: accentText(accent) }
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{day.name || 'Schedule'}
|
{day.name || 'Schedule'}
|
||||||
|
|
@ -259,7 +274,7 @@ export default function ScheduleBlock({
|
||||||
id={`${baseId}-panel`}
|
id={`${baseId}-panel`}
|
||||||
role={days.length > 1 ? 'tabpanel' : undefined}
|
role={days.length > 1 ? 'tabpanel' : undefined}
|
||||||
aria-labelledby={days.length > 1 ? `${baseId}-tab-${days.indexOf(current)}` : undefined}
|
aria-labelledby={days.length > 1 ? `${baseId}-tab-${days.indexOf(current)}` : undefined}
|
||||||
className="rounded-2xl border border-[#138ba0]/15 bg-white px-5"
|
className="rounded-2xl border border-brand/15 bg-surface px-5"
|
||||||
>
|
>
|
||||||
{current.entries.map((entry, index) => (
|
{current.entries.map((entry, index) => (
|
||||||
<Entry key={`${current.name}-${index}`} entry={entry} accent={accent} />
|
<Entry key={`${current.name}-${index}`} entry={entry} accent={accent} />
|
||||||
|
|
|
||||||
79
src/components/ThemeToggle.tsx
Normal file
79
src/components/ThemeToggle.tsx
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
|
THEME TOGGLE
|
||||||
|
|
||||||
|
Light or dark. The theme lives on <html data-theme>, which
|
||||||
|
index.html sets before the first paint (from this browser's
|
||||||
|
choice, else the system setting) so a dark visitor never sees a
|
||||||
|
white flash. Pressing this makes an explicit choice and remembers
|
||||||
|
it; until then the site follows the system, including a change
|
||||||
|
made while the page is open. Colours come from the tokens in
|
||||||
|
index.css.
|
||||||
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
|
type Theme = 'light' | 'dark'
|
||||||
|
|
||||||
|
export const THEME_STORAGE_KEY = 'ngu-theme'
|
||||||
|
|
||||||
|
const current = (): Theme =>
|
||||||
|
document.documentElement.dataset.theme === 'dark' ? 'dark' : 'light'
|
||||||
|
|
||||||
|
function chosen(): Theme | null {
|
||||||
|
try {
|
||||||
|
const value = localStorage.getItem(THEME_STORAGE_KEY)
|
||||||
|
return value === 'dark' || value === 'light' ? value : null
|
||||||
|
} catch {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function ThemeToggle({ className = '' }: { className?: string }) {
|
||||||
|
const [theme, setTheme] = useState<Theme>(current)
|
||||||
|
|
||||||
|
// No choice made: follow the system as it changes.
|
||||||
|
useEffect(() => {
|
||||||
|
const media = window.matchMedia('(prefers-color-scheme: dark)')
|
||||||
|
const follow = () => {
|
||||||
|
if (chosen()) return
|
||||||
|
const next: Theme = media.matches ? 'dark' : 'light'
|
||||||
|
document.documentElement.dataset.theme = next
|
||||||
|
setTheme(next)
|
||||||
|
}
|
||||||
|
media.addEventListener('change', follow)
|
||||||
|
return () => media.removeEventListener('change', follow)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const toggle = () => {
|
||||||
|
const next: Theme = theme === 'dark' ? 'light' : 'dark'
|
||||||
|
document.documentElement.dataset.theme = next
|
||||||
|
setTheme(next)
|
||||||
|
try {
|
||||||
|
localStorage.setItem(THEME_STORAGE_KEY, next)
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
const dark = theme === 'dark'
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={toggle}
|
||||||
|
aria-label={dark ? 'Switch to light mode' : 'Switch to dark mode'}
|
||||||
|
title={dark ? 'Light mode' : 'Dark mode'}
|
||||||
|
className={`flex h-9 w-9 items-center justify-center rounded-full transition-colors ${className}`}
|
||||||
|
>
|
||||||
|
{dark ? (
|
||||||
|
// Sun
|
||||||
|
<svg viewBox="0 0 24 24" className="h-5 w-5" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true">
|
||||||
|
<circle cx="12" cy="12" r="4" />
|
||||||
|
<path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" strokeLinecap="round" />
|
||||||
|
</svg>
|
||||||
|
) : (
|
||||||
|
// Moon
|
||||||
|
<svg viewBox="0 0 24 24" className="h-5 w-5" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true">
|
||||||
|
<path d="M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z" strokeLinejoin="round" />
|
||||||
|
</svg>
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -55,7 +55,7 @@ export default function VideoPlayer({
|
||||||
{image ? (
|
{image ? (
|
||||||
<img src={image} alt="" loading="lazy" className={`aspect-video w-full object-cover ${className}`} />
|
<img src={image} alt="" loading="lazy" className={`aspect-video w-full object-cover ${className}`} />
|
||||||
) : (
|
) : (
|
||||||
<div className={`aspect-video w-full bg-gradient-to-br from-[#073d4a] to-[#04262e] ${className}`} />
|
<div className={`aspect-video w-full bg-[#073d4a] ${className}`} />
|
||||||
)}
|
)}
|
||||||
<span
|
<span
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ export type MediaItem = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const button =
|
const button =
|
||||||
"rounded-full border border-[#138ba0] px-3 py-1 text-sm font-medium text-[#0f7183] " +
|
"rounded-full border border-brand px-3 py-1 text-sm font-medium text-link " +
|
||||||
"transition-colors hover:bg-[#eef9fb] disabled:cursor-default disabled:opacity-50";
|
"transition-colors hover:bg-tint disabled:cursor-default disabled:opacity-50";
|
||||||
|
|
||||||
/* A light checkerboard, so a white logo on a transparent background
|
/* A light checkerboard, so a white logo on a transparent background
|
||||||
is still visible in its thumbnail. */
|
is still visible in its thumbnail. */
|
||||||
|
|
@ -166,18 +166,18 @@ export function UploadButton({
|
||||||
className="hidden"
|
className="hidden"
|
||||||
onChange={(e) => send(e.target.files)}
|
onChange={(e) => send(e.target.files)}
|
||||||
/>
|
/>
|
||||||
<label htmlFor={keepId} className="flex items-center gap-1.5 text-xs text-[#4a6b72]">
|
<label htmlFor={keepId} className="flex items-center gap-1.5 text-xs text-muted">
|
||||||
<input
|
<input
|
||||||
id={keepId}
|
id={keepId}
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={keepOriginal}
|
checked={keepOriginal}
|
||||||
onChange={(e) => setKeepOriginal(e.target.checked)}
|
onChange={(e) => setKeepOriginal(e.target.checked)}
|
||||||
className="h-3.5 w-3.5 rounded border-[#4a6b72]/40 text-[#0f7183]"
|
className="h-3.5 w-3.5 rounded border-muted/40 text-link"
|
||||||
/>
|
/>
|
||||||
Keep original
|
Keep original
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
{error && <p className="mt-1 text-xs text-[#b3261e]">{error}</p>}
|
{error && <p className="mt-1 text-xs text-danger">{error}</p>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -200,7 +200,7 @@ export function MediaGrid({
|
||||||
renderActions?: (item: MediaItem) => ReactNode;
|
renderActions?: (item: MediaItem) => ReactNode;
|
||||||
}) {
|
}) {
|
||||||
if (items.length === 0) {
|
if (items.length === 0) {
|
||||||
return <p className="text-sm text-[#4a6b72]">Nothing here yet.</p>;
|
return <p className="text-sm text-muted">Nothing here yet.</p>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -214,7 +214,7 @@ export function MediaGrid({
|
||||||
// A still of the first frame; metadata only, not the file.
|
// A still of the first frame; metadata only, not the file.
|
||||||
<video src={item.url} preload="metadata" muted className="h-full w-full bg-black object-contain" />
|
<video src={item.url} preload="metadata" muted className="h-full w-full bg-black object-contain" />
|
||||||
) : item.content_type.startsWith("audio/") ? (
|
) : item.content_type.startsWith("audio/") ? (
|
||||||
<div className="flex h-full w-full items-center justify-center bg-[#eef9fb] text-3xl" aria-hidden="true">
|
<div className="flex h-full w-full items-center justify-center bg-tint text-3xl" aria-hidden="true">
|
||||||
♪
|
♪
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
|
@ -226,18 +226,18 @@ export function MediaGrid({
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<p className="mt-1.5 truncate text-xs font-medium text-[#26454c]" title={item.original_name}>
|
<p className="mt-1.5 truncate text-xs font-medium text-body" title={item.original_name}>
|
||||||
{item.original_name}
|
{item.original_name}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-[#4a6b72]/80">{mediaSize(item)}</p>
|
<p className="text-xs text-muted/80">{mediaSize(item)}</p>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li
|
<li
|
||||||
key={item.id}
|
key={item.id}
|
||||||
className={`rounded-xl border bg-white p-2 ${
|
className={`rounded-xl border bg-surface p-2 ${
|
||||||
isSelected ? "border-[#138ba0] ring-2 ring-[#138ba0]/30" : "border-[#4a6b72]/20"
|
isSelected ? "border-brand ring-2 ring-brand/30" : "border-muted/20"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{onPick ? (
|
{onPick ? (
|
||||||
|
|
@ -292,27 +292,27 @@ export function MediaPicker({
|
||||||
className="w-[min(56rem,calc(100vw-2rem))] rounded-2xl p-0 backdrop:bg-[#0f2f36]/40"
|
className="w-[min(56rem,calc(100vw-2rem))] rounded-2xl p-0 backdrop:bg-[#0f2f36]/40"
|
||||||
>
|
>
|
||||||
<div className="flex max-h-[85vh] flex-col">
|
<div className="flex max-h-[85vh] flex-col">
|
||||||
<div className="flex flex-wrap items-center gap-3 border-b border-[#138ba0]/15 px-5 py-4">
|
<div className="flex flex-wrap items-center gap-3 border-b border-brand/15 px-5 py-4">
|
||||||
<h2 className="text-lg font-semibold text-[#0f7183]">Choose an image</h2>
|
<h2 className="text-lg font-semibold text-link">Choose an image</h2>
|
||||||
<input
|
<input
|
||||||
type="search"
|
type="search"
|
||||||
value={query}
|
value={query}
|
||||||
onChange={(e) => setQuery(e.target.value)}
|
onChange={(e) => setQuery(e.target.value)}
|
||||||
placeholder="Search by file name"
|
placeholder="Search by file name"
|
||||||
className="ml-auto w-56 rounded-lg border border-[#4a6b72]/25 px-3 py-1.5 text-sm outline-none focus:border-[#138ba0]"
|
className="ml-auto w-56 rounded-lg border border-muted/25 px-3 py-1.5 text-sm outline-none focus:border-brand"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => dialogRef.current?.close()}
|
onClick={() => dialogRef.current?.close()}
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
className="h-8 w-8 rounded-full text-[#4a6b72] hover:bg-[#eef9fb]"
|
className="h-8 w-8 rounded-full text-muted hover:bg-tint"
|
||||||
>
|
>
|
||||||
✕
|
✕
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{roleCanWrite(user) && (
|
{roleCanWrite(user) && (
|
||||||
<div className="border-b border-[#138ba0]/10 px-5 py-3">
|
<div className="border-b border-brand/10 px-5 py-3">
|
||||||
<UploadButton
|
<UploadButton
|
||||||
label="Upload new"
|
label="Upload new"
|
||||||
onUploaded={(item) => {
|
onUploaded={(item) => {
|
||||||
|
|
@ -321,15 +321,15 @@ export function MediaPicker({
|
||||||
dialogRef.current?.close();
|
dialogRef.current?.close();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<p className="mt-1 text-xs text-[#4a6b72]">{UPLOAD_HELP}</p>
|
<p className="mt-1 text-xs text-muted">{UPLOAD_HELP}</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="overflow-y-auto px-5 py-4">
|
<div className="overflow-y-auto px-5 py-4">
|
||||||
{error ? (
|
{error ? (
|
||||||
<p className="text-sm text-[#b3261e]">{error}</p>
|
<p className="text-sm text-danger">{error}</p>
|
||||||
) : items === null ? (
|
) : items === null ? (
|
||||||
<p className="text-sm text-[#4a6b72]">Loading…</p>
|
<p className="text-sm text-muted">Loading…</p>
|
||||||
) : (
|
) : (
|
||||||
<MediaGrid
|
<MediaGrid
|
||||||
items={items}
|
items={items}
|
||||||
|
|
@ -375,13 +375,13 @@ export function ImageInput({
|
||||||
return (
|
return (
|
||||||
<div className="flex gap-3">
|
<div className="flex gap-3">
|
||||||
<div
|
<div
|
||||||
className="flex h-20 w-20 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[#4a6b72]/20"
|
className="flex h-20 w-20 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-muted/20"
|
||||||
style={CHECKER}
|
style={CHECKER}
|
||||||
>
|
>
|
||||||
{src && !broken ? (
|
{src && !broken ? (
|
||||||
<img src={src} alt="" className="h-full w-full object-contain" onError={() => setBroken(true)} />
|
<img src={src} alt="" className="h-full w-full object-contain" onError={() => setBroken(true)} />
|
||||||
) : (
|
) : (
|
||||||
<span className="px-1 text-center text-[10px] text-[#4a6b72]/70">
|
<span className="px-1 text-center text-[10px] text-muted/70">
|
||||||
{src ? "Not found" : "No image"}
|
{src ? "Not found" : "No image"}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
@ -406,7 +406,7 @@ export function ImageInput({
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => onChange("")}
|
onClick={() => onChange("")}
|
||||||
className="px-2 py-1 text-sm text-[#4a6b72] hover:text-[#b3261e]"
|
className="px-2 py-1 text-sm text-muted hover:text-danger"
|
||||||
>
|
>
|
||||||
Clear
|
Clear
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -498,7 +498,7 @@ export function LinkPreviewInput({
|
||||||
{busy ? "Fetching…" : "Fetch preview"}
|
{busy ? "Fetching…" : "Fetch preview"}
|
||||||
</button>
|
</button>
|
||||||
{note && (
|
{note && (
|
||||||
<span className={`text-xs ${note.tone === "ok" ? "text-[#0f7183]" : "text-[#b3261e]"}`}>
|
<span className={`text-xs ${note.tone === "ok" ? "text-link" : "text-danger"}`}>
|
||||||
{note.text}
|
{note.text}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
import { scrollBehavior } from "../../lib/motion.ts";
|
||||||
|
|
||||||
export type EditorSection = {
|
export type EditorSection = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -63,7 +64,7 @@ function useActiveSection(sections: EditorSection[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function jump(id: string) {
|
function jump(id: string) {
|
||||||
document.getElementById(id)?.scrollIntoView({ behavior: "smooth", block: "start" });
|
document.getElementById(id)?.scrollIntoView({ behavior: scrollBehavior(), block: "start" });
|
||||||
}
|
}
|
||||||
|
|
||||||
function Label({ section }: { section: EditorSection }) {
|
function Label({ section }: { section: EditorSection }) {
|
||||||
|
|
@ -71,10 +72,10 @@ function Label({ section }: { section: EditorSection }) {
|
||||||
<>
|
<>
|
||||||
<span className="truncate">{section.label}</span>
|
<span className="truncate">{section.label}</span>
|
||||||
{section.count != null && (
|
{section.count != null && (
|
||||||
<span className="text-xs text-[#4a6b72]/70">({section.count})</span>
|
<span className="text-xs text-muted/70">({section.count})</span>
|
||||||
)}
|
)}
|
||||||
{section.hasError && (
|
{section.hasError && (
|
||||||
<span aria-label="needs attention" className="h-1.5 w-1.5 shrink-0 rounded-full bg-[#b3261e]" />
|
<span aria-label="needs attention" className="h-1.5 w-1.5 shrink-0 rounded-full bg-danger" />
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
@ -87,10 +88,10 @@ export function SectionNav({ sections }: { sections: EditorSection[] }) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav aria-label="Sections" className="hidden max-h-[calc(100vh-8rem)] overflow-y-auto lg:block">
|
<nav aria-label="Sections" className="hidden max-h-[calc(100vh-8rem)] overflow-y-auto lg:block">
|
||||||
<p className="mb-2 px-3 text-xs font-semibold uppercase tracking-wider text-[#4a6b72]/70">
|
<p className="mb-2 px-3 text-xs font-semibold uppercase tracking-wider text-muted/70">
|
||||||
On this page
|
On this page
|
||||||
</p>
|
</p>
|
||||||
<ul className="space-y-0.5 border-l border-[#138ba0]/15">
|
<ul className="space-y-0.5 border-l border-brand/15">
|
||||||
{sections.map((section) => {
|
{sections.map((section) => {
|
||||||
const lit = section.id === active;
|
const lit = section.id === active;
|
||||||
return (
|
return (
|
||||||
|
|
@ -101,8 +102,8 @@ export function SectionNav({ sections }: { sections: EditorSection[] }) {
|
||||||
aria-current={lit ? "location" : undefined}
|
aria-current={lit ? "location" : undefined}
|
||||||
className={`-ml-px flex w-full items-center gap-1.5 border-l-2 px-3 py-1.5 text-left text-sm transition-colors ${
|
className={`-ml-px flex w-full items-center gap-1.5 border-l-2 px-3 py-1.5 text-left text-sm transition-colors ${
|
||||||
lit
|
lit
|
||||||
? "border-[#138ba0] font-semibold text-[#0f7183]"
|
? "border-brand font-semibold text-link"
|
||||||
: "border-transparent text-[#4a6b72] hover:border-[#138ba0]/40 hover:text-[#0f7183]"
|
: "border-transparent text-muted hover:border-brand/40 hover:text-link"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<Label section={section} />
|
<Label section={section} />
|
||||||
|
|
@ -120,13 +121,13 @@ export function SectionJump({ sections }: { sections: EditorSection[] }) {
|
||||||
const active = useActiveSection(sections);
|
const active = useActiveSection(sections);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="sticky top-0 z-20 -mx-6 mt-4 mb-2 border-b border-[#138ba0]/15 bg-[#f6fbfc]/95 px-6 py-2 backdrop-blur lg:hidden">
|
<div className="sticky top-0 z-20 -mx-6 mt-4 mb-2 border-b border-brand/15 bg-tint-soft/95 px-6 py-2 backdrop-blur lg:hidden">
|
||||||
<label className="flex items-center gap-3 text-sm text-[#4a6b72]">
|
<label className="flex items-center gap-3 text-sm text-muted">
|
||||||
<span className="shrink-0">Jump to</span>
|
<span className="shrink-0">Jump to</span>
|
||||||
<select
|
<select
|
||||||
value={active ?? ""}
|
value={active ?? ""}
|
||||||
onChange={(e) => jump(e.target.value)}
|
onChange={(e) => jump(e.target.value)}
|
||||||
className="w-full rounded-lg border border-[#4a6b72]/25 bg-white px-3 py-1.5 text-sm text-[#26454c] outline-none focus:border-[#138ba0]"
|
className="w-full rounded-lg border border-muted/25 bg-surface px-3 py-1.5 text-sm text-body outline-none focus:border-brand"
|
||||||
>
|
>
|
||||||
{sections.map((section) => (
|
{sections.map((section) => (
|
||||||
<option key={section.id} value={section.id}>
|
<option key={section.id} value={section.id}>
|
||||||
|
|
|
||||||
|
|
@ -104,24 +104,24 @@ const PREVIEWS = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const input =
|
const input =
|
||||||
"w-full rounded-lg border border-[#4a6b72]/25 bg-white px-3 py-2 text-sm text-[#26454c] " +
|
"w-full rounded-lg border border-muted/25 bg-surface px-3 py-2 text-sm text-body " +
|
||||||
"outline-none transition-colors focus:border-[#138ba0] focus:ring-2 focus:ring-[#138ba0]/25";
|
"outline-none transition-colors focus:border-brand focus:ring-2 focus:ring-brand/25";
|
||||||
|
|
||||||
/* Same box, but lit by the real input nested inside it. */
|
/* Same box, but lit by the real input nested inside it. */
|
||||||
const inputShell =
|
const inputShell =
|
||||||
"flex w-full items-center rounded-lg border border-[#4a6b72]/25 bg-white px-3 py-2 text-sm " +
|
"flex w-full items-center rounded-lg border border-muted/25 bg-surface px-3 py-2 text-sm " +
|
||||||
"text-[#26454c] transition-colors focus-within:border-[#138ba0] focus-within:ring-2 " +
|
"text-body transition-colors focus-within:border-brand focus-within:ring-2 " +
|
||||||
"focus-within:ring-[#138ba0]/25";
|
"focus-within:ring-brand/25";
|
||||||
|
|
||||||
const inputError = "border-[#b3261e] focus:border-[#b3261e] focus:ring-[#b3261e]/20";
|
const inputError = "border-danger focus:border-danger focus:ring-danger/20";
|
||||||
const shellError =
|
const shellError =
|
||||||
"border-[#b3261e] focus-within:border-[#b3261e] focus-within:ring-[#b3261e]/20";
|
"border-danger focus-within:border-danger focus-within:ring-danger/20";
|
||||||
|
|
||||||
/* Reads as settled fact rather than as an empty box someone forgot
|
/* Reads as settled fact rather than as an empty box someone forgot
|
||||||
to fill in. */
|
to fill in. */
|
||||||
const inputLocked =
|
const inputLocked =
|
||||||
"w-full rounded-lg border border-[#4a6b72]/20 bg-[#f6fbfc] px-3 py-2 text-sm " +
|
"w-full rounded-lg border border-muted/20 bg-tint-soft px-3 py-2 text-sm " +
|
||||||
"text-[#4a6b72] outline-none cursor-default focus:border-[#4a6b72]/40";
|
"text-muted outline-none cursor-default focus:border-muted/40";
|
||||||
|
|
||||||
/* ── Dotted paths ────────────────────────────────────────────── */
|
/* ── Dotted paths ────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
|
@ -226,21 +226,21 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={field.full ? "sm:col-span-2" : ""}>
|
<div className={field.full ? "sm:col-span-2" : ""}>
|
||||||
<label htmlFor={id} className="block text-sm font-medium text-[#26454c]">
|
<label htmlFor={id} className="block text-sm font-medium text-body">
|
||||||
{typeof field.label === "function" ? field.label(row) : field.label}
|
{typeof field.label === "function" ? field.label(row) : field.label}
|
||||||
{field.required && !locked && <span className="ml-1 text-[#b3261e]">*</span>}
|
{field.required && !locked && <span className="ml-1 text-danger">*</span>}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div className="mt-1.5">
|
<div className="mt-1.5">
|
||||||
{widget === "checkbox" ? (
|
{widget === "checkbox" ? (
|
||||||
<label className="flex items-center gap-2 text-sm text-[#4a6b72]">
|
<label className="flex items-center gap-2 text-sm text-muted">
|
||||||
<input
|
<input
|
||||||
id={id}
|
id={id}
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={value === 1 || value === true}
|
checked={value === 1 || value === true}
|
||||||
disabled={locked}
|
disabled={locked}
|
||||||
onChange={(e) => onChange(e.target.checked ? 1 : 0)}
|
onChange={(e) => onChange(e.target.checked ? 1 : 0)}
|
||||||
className="h-4 w-4 rounded border-[#4a6b72]/40 text-[#0f7183] focus:ring-[#138ba0]/40 disabled:opacity-50"
|
className="h-4 w-4 rounded border-muted/40 text-link focus:ring-brand/40 disabled:opacity-50"
|
||||||
/>
|
/>
|
||||||
{helpText(field, row) ?? "Yes"}
|
{helpText(field, row) ?? "Yes"}
|
||||||
</label>
|
</label>
|
||||||
|
|
@ -277,7 +277,7 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
||||||
value={/^#[0-9a-f]{6}$/i.test(value ?? "") ? value : "#138ba0"}
|
value={/^#[0-9a-f]{6}$/i.test(value ?? "") ? value : "#138ba0"}
|
||||||
disabled={locked}
|
disabled={locked}
|
||||||
onChange={(e) => onChange(e.target.value)}
|
onChange={(e) => onChange(e.target.value)}
|
||||||
className="h-9 w-12 shrink-0 rounded border border-[#4a6b72]/25 bg-white disabled:opacity-50"
|
className="h-9 w-12 shrink-0 rounded border border-muted/25 bg-surface disabled:opacity-50"
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
{...common}
|
{...common}
|
||||||
|
|
@ -318,7 +318,7 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
||||||
<span
|
<span
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
className={`shrink-0 select-none ${
|
className={`shrink-0 select-none ${
|
||||||
field.prefixPending ? "text-[#4a6b72]/45" : "text-[#4a6b72]"
|
field.prefixPending ? "text-muted/45" : "text-muted"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{field.prefix}
|
{field.prefix}
|
||||||
|
|
@ -329,7 +329,7 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
||||||
value={value ?? ""}
|
value={value ?? ""}
|
||||||
onChange={(e) => onChange(e.target.value)}
|
onChange={(e) => onChange(e.target.value)}
|
||||||
placeholder={field.placeholder}
|
placeholder={field.placeholder}
|
||||||
className="w-full border-0 bg-transparent p-0 text-[#26454c] outline-none placeholder:text-[#4a6b72]/45"
|
className="w-full border-0 bg-transparent p-0 text-body outline-none placeholder:text-muted/45"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
|
@ -347,15 +347,15 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{error ? (
|
{error ? (
|
||||||
<p className="mt-1 text-xs text-[#b3261e]">{error}</p>
|
<p className="mt-1 text-xs text-danger">{error}</p>
|
||||||
) : orphaned && !locked ? (
|
) : orphaned && !locked ? (
|
||||||
<p className="mt-1 text-xs text-[#b3261e]">
|
<p className="mt-1 text-xs text-danger">
|
||||||
This points at something that has been deleted. Pick a replacement before saving.
|
This points at something that has been deleted. Pick a replacement before saving.
|
||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
helpText(field, row) &&
|
helpText(field, row) &&
|
||||||
widget !== "checkbox" && (
|
widget !== "checkbox" && (
|
||||||
<p className="mt-1 text-xs text-[#4a6b72]">{helpText(field, row)}</p>
|
<p className="mt-1 text-xs text-muted">{helpText(field, row)}</p>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -467,25 +467,25 @@ export function Repeater({
|
||||||
return (
|
return (
|
||||||
<section className={className}>
|
<section className={className}>
|
||||||
<div className="flex flex-wrap items-center gap-3">
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
<h3 className="text-base font-semibold text-[#26454c]">
|
<h3 className="text-base font-semibold text-body">
|
||||||
{spec.label}
|
{spec.label}
|
||||||
{list.length > 0 && (
|
{list.length > 0 && (
|
||||||
<span className="ml-2 text-sm font-normal text-[#4a6b72]/80">{list.length}</span>
|
<span className="ml-2 text-sm font-normal text-muted/80">{list.length}</span>
|
||||||
)}
|
)}
|
||||||
</h3>
|
</h3>
|
||||||
{list.length > 1 && (
|
{list.length > 1 && (
|
||||||
<div className="flex gap-3 text-xs text-[#4a6b72]">
|
<div className="flex gap-3 text-xs text-muted">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setOpen(new Set(list.map((_, i) => i)))}
|
onClick={() => setOpen(new Set(list.map((_, i) => i)))}
|
||||||
className="hover:text-[#0f7183] hover:underline"
|
className="hover:text-link hover:underline"
|
||||||
>
|
>
|
||||||
Expand all
|
Expand all
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setOpen(new Set())}
|
onClick={() => setOpen(new Set())}
|
||||||
className="hover:text-[#0f7183] hover:underline"
|
className="hover:text-link hover:underline"
|
||||||
>
|
>
|
||||||
Collapse all
|
Collapse all
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -494,15 +494,15 @@ export function Repeater({
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={add}
|
onClick={add}
|
||||||
className="ml-auto rounded-full border border-[#138ba0] px-3 py-1 text-sm font-medium text-[#0f7183] transition-colors hover:bg-[#eef9fb]"
|
className="ml-auto rounded-full border border-brand px-3 py-1 text-sm font-medium text-link transition-colors hover:bg-tint"
|
||||||
>
|
>
|
||||||
{spec.addLabel ?? "Add"}
|
{spec.addLabel ?? "Add"}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{spec.note && <p className="mt-1 text-sm text-[#4a6b72]">{spec.note}</p>}
|
{spec.note && <p className="mt-1 text-sm text-muted">{spec.note}</p>}
|
||||||
|
|
||||||
{list.length === 0 && <p className="mt-2 text-sm text-[#4a6b72]">None yet.</p>}
|
{list.length === 0 && <p className="mt-2 text-sm text-muted">None yet.</p>}
|
||||||
|
|
||||||
<div className="mt-3 space-y-3">
|
<div className="mt-3 space-y-3">
|
||||||
{list.map((row, index) => {
|
{list.map((row, index) => {
|
||||||
|
|
@ -533,10 +533,10 @@ export function Repeater({
|
||||||
endDrag();
|
endDrag();
|
||||||
}}
|
}}
|
||||||
className={
|
className={
|
||||||
`rounded-xl border bg-[#f6fbfc] ${expanded ? "p-4" : "px-4 py-2.5"} transition-colors ` +
|
`rounded-xl border bg-tint-soft ${expanded ? "p-4" : "px-4 py-2.5"} transition-colors ` +
|
||||||
(over
|
(over
|
||||||
? "border-[#138ba0] ring-2 ring-[#138ba0]/25 "
|
? "border-brand ring-2 ring-brand/25 "
|
||||||
: "border-[#4a6b72]/20 ") +
|
: "border-muted/20 ") +
|
||||||
(dragging ? "opacity-50" : "")
|
(dragging ? "opacity-50" : "")
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
@ -556,7 +556,7 @@ export function Repeater({
|
||||||
onDragEnd={endDrag}
|
onDragEnd={endDrag}
|
||||||
title="Drag to reorder"
|
title="Drag to reorder"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
className="cursor-grab select-none px-1 text-[#4a6b72]/60 active:cursor-grabbing"
|
className="cursor-grab select-none px-1 text-muted/60 active:cursor-grabbing"
|
||||||
>
|
>
|
||||||
⠿
|
⠿
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -565,11 +565,11 @@ export function Repeater({
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => toggle(index)}
|
onClick={() => toggle(index)}
|
||||||
aria-expanded={expanded}
|
aria-expanded={expanded}
|
||||||
className="flex min-w-0 flex-1 items-center gap-2 text-left text-sm font-medium text-[#26454c] hover:text-[#0f7183]"
|
className="flex min-w-0 flex-1 items-center gap-2 text-left text-sm font-medium text-body hover:text-link"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
className={`inline-block text-xs text-[#4a6b72] transition-transform ${
|
className={`inline-block text-xs text-muted transition-transform ${
|
||||||
expanded ? "rotate-90" : ""
|
expanded ? "rotate-90" : ""
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
|
|
@ -579,7 +579,7 @@ export function Repeater({
|
||||||
{spec.title ? spec.title(row, options) : `#${index + 1}`}
|
{spec.title ? spec.title(row, options) : `#${index + 1}`}
|
||||||
</span>
|
</span>
|
||||||
{!expanded && hasError(index) && (
|
{!expanded && hasError(index) && (
|
||||||
<span className="text-xs text-[#b3261e]">needs attention</span>
|
<span className="text-xs text-danger">needs attention</span>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
@ -642,7 +642,7 @@ export function Repeater({
|
||||||
{(spec.children ?? [])
|
{(spec.children ?? [])
|
||||||
.filter((nested) => fieldShown(nested, row, parentRow))
|
.filter((nested) => fieldShown(nested, row, parentRow))
|
||||||
.map((nested) => (
|
.map((nested) => (
|
||||||
<div key={nested.key} className="mt-4 border-t border-[#4a6b72]/15 pt-4">
|
<div key={nested.key} className="mt-4 border-t border-muted/15 pt-4">
|
||||||
<Repeater
|
<Repeater
|
||||||
spec={nested}
|
spec={nested}
|
||||||
rows={row[nested.key]}
|
rows={row[nested.key]}
|
||||||
|
|
@ -657,8 +657,8 @@ export function Repeater({
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{spec.preview && PREVIEWS[spec.preview] && (
|
{spec.preview && PREVIEWS[spec.preview] && (
|
||||||
<div className="mt-4 rounded-lg border border-dashed border-[#138ba0]/30 bg-white p-4">
|
<div className="mt-4 rounded-lg border border-dashed border-brand/30 bg-surface p-4">
|
||||||
<p className="mb-3 text-xs font-semibold uppercase tracking-wider text-[#4a6b72]/70">
|
<p className="mb-3 text-xs font-semibold uppercase tracking-wider text-muted/70">
|
||||||
Preview
|
Preview
|
||||||
</p>
|
</p>
|
||||||
{PREVIEWS[spec.preview](row, options)}
|
{PREVIEWS[spec.preview](row, options)}
|
||||||
|
|
@ -685,10 +685,10 @@ function IconButton({ label, onClick, danger = false, disabled = false, children
|
||||||
className={
|
className={
|
||||||
"h-7 w-7 rounded-full border text-sm leading-none transition-colors " +
|
"h-7 w-7 rounded-full border text-sm leading-none transition-colors " +
|
||||||
(disabled
|
(disabled
|
||||||
? "cursor-default border-[#4a6b72]/20 text-[#4a6b72]/40"
|
? "cursor-default border-muted/20 text-muted/40"
|
||||||
: danger
|
: danger
|
||||||
? "border-[#b3261e]/30 text-[#b3261e] hover:bg-[#fdf3f2]"
|
? "border-danger/30 text-danger hover:bg-danger-tint"
|
||||||
: "border-[#4a6b72]/30 text-[#4a6b72] hover:bg-white")
|
: "border-muted/30 text-muted hover:bg-surface")
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@
|
||||||
the server isn't in this workspace, and it's the thing that
|
the server isn't in this workspace, and it's the thing that
|
||||||
decides what's storable.
|
decides what's storable.
|
||||||
|
|
||||||
|
DATA_REQUEST is kept out of the tiles: the Privacy page's form
|
||||||
|
sends it (FeedbackForm's fixedType), with an email required.
|
||||||
|
|
||||||
'general' isn't offered anywhere; it's the server's fallback for
|
'general' isn't offered anywhere; it's the server's fallback for
|
||||||
a type it doesn't recognise, so old rows still read sensibly.
|
a type it doesn't recognise, so old rows still read sensibly.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
@ -44,7 +47,13 @@ export const FEEDBACK_TYPES = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const BY_ID = new Map(FEEDBACK_TYPES.map((t) => [t.id, t.label]));
|
export const DATA_REQUEST = {
|
||||||
|
id: "privacy",
|
||||||
|
label: "Privacy or data request",
|
||||||
|
hint: "A question about your data, or a request to see or delete it",
|
||||||
|
};
|
||||||
|
|
||||||
|
const BY_ID = new Map([...FEEDBACK_TYPES, DATA_REQUEST].map((t) => [t.id, t.label]));
|
||||||
|
|
||||||
export function feedbackTypeLabel(id) {
|
export function feedbackTypeLabel(id) {
|
||||||
return BY_ID.get(id) ?? (id === "general" ? "Unsorted" : id);
|
return BY_ID.get(id) ?? (id === "general" ? "Unsorted" : id);
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,74 @@
|
||||||
@theme {
|
@theme {
|
||||||
--font-display: 'Poppins', sans-serif;
|
--font-display: 'Poppins', sans-serif;
|
||||||
--font-body: 'Montserrat', sans-serif;
|
--font-body: 'Montserrat', sans-serif;
|
||||||
|
|
||||||
|
/* ── Colour tokens ─────────────────────────────────────────────
|
||||||
|
Named for what they do, not what they look like, because dark
|
||||||
|
mode (below) swaps the values. Use them as utilities
|
||||||
|
(text-muted, bg-surface, border-brand/20) or, in a style prop,
|
||||||
|
as var(--color-muted). Every text colour passes WCAG AA (4.5:1)
|
||||||
|
on surface, tint and tint-soft in both modes.
|
||||||
|
|
||||||
|
A colour that must stay the same in both modes (white text on
|
||||||
|
a dark band, a platform's own colour) stays a literal. Colours
|
||||||
|
that arrive as data (page accents, event and region colours) go
|
||||||
|
through withAlpha() and accentText() in src/lib/color.ts. */
|
||||||
|
--color-ink: #073d4a; /* headings */
|
||||||
|
--color-body: #26454c; /* body text */
|
||||||
|
--color-muted: #4a6b72; /* secondary text, quiet borders */
|
||||||
|
--color-link: #0f7183; /* links and teal text */
|
||||||
|
--color-brand: #138ba0; /* decoration: borders, rings, rules */
|
||||||
|
--color-action: #0f7183; /* button fills, under white text */
|
||||||
|
--color-action-hover: #0b5c6a;
|
||||||
|
--color-surface: #ffffff; /* page and cards */
|
||||||
|
--color-tint: #eef9fb; /* tinted sections and panels */
|
||||||
|
--color-tint-soft: #f6fbfc; /* hover rows, faint panels */
|
||||||
|
--color-danger: #b3261e;
|
||||||
|
--color-danger-tint: #fdf3f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* How much of an accent colour its text keeps (src/lib/color.ts,
|
||||||
|
accentText): all of it on light, half (the rest white) on dark. */
|
||||||
|
:root {
|
||||||
|
--accent-text-mix: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dark mode: the visitor's system setting, unless the header toggle
|
||||||
|
chose (data-theme on <html>, set before first paint in index.html
|
||||||
|
and by ThemeToggle). */
|
||||||
|
@custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));
|
||||||
|
|
||||||
|
@layer base {
|
||||||
|
:root[data-theme="dark"] {
|
||||||
|
--color-ink: #eaf6f8;
|
||||||
|
--color-body: #cde0e4;
|
||||||
|
--color-muted: #9fb9bf;
|
||||||
|
--color-link: #5ccbdc;
|
||||||
|
--color-brand: #2aa7bc;
|
||||||
|
--color-surface: #0c1d21;
|
||||||
|
--color-tint: #11292e;
|
||||||
|
--color-tint-soft: #0f2428;
|
||||||
|
--color-danger: #ff8a80;
|
||||||
|
--color-danger-tint: #3b1714;
|
||||||
|
--accent-text-mix: 50%;
|
||||||
|
color-scheme: dark;
|
||||||
|
}
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root:not([data-theme="light"]) {
|
||||||
|
--color-ink: #eaf6f8;
|
||||||
|
--color-body: #cde0e4;
|
||||||
|
--color-muted: #9fb9bf;
|
||||||
|
--color-link: #5ccbdc;
|
||||||
|
--color-brand: #2aa7bc;
|
||||||
|
--color-surface: #0c1d21;
|
||||||
|
--color-tint: #11292e;
|
||||||
|
--color-tint-soft: #0f2428;
|
||||||
|
--color-danger: #ff8a80;
|
||||||
|
--color-danger-tint: #3b1714;
|
||||||
|
--accent-text-mix: 50%;
|
||||||
|
color-scheme: dark;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
|
|
@ -24,7 +92,7 @@ html {
|
||||||
/* One visible focus ring for keyboard users, wherever a component
|
/* One visible focus ring for keyboard users, wherever a component
|
||||||
doesn't draw its own. */
|
doesn't draw its own. */
|
||||||
:focus-visible {
|
:focus-visible {
|
||||||
outline: 2px solid #0f7183;
|
outline: 2px solid var(--color-link);
|
||||||
outline-offset: 2px;
|
outline-offset: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -45,8 +113,8 @@ html {
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: 'Montserrat', sans-serif;
|
font-family: 'Montserrat', sans-serif;
|
||||||
background-color: #ffffff;
|
background-color: var(--color-surface);
|
||||||
color: #073d4a;
|
color: var(--color-ink);
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
54
src/lib/adminSchema/awards.ts
Normal file
54
src/lib/adminSchema/awards.ts
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
import { mediaUrl } from "../media.ts";
|
||||||
|
import { PUBLISH_FIELDS } from "./shared.ts";
|
||||||
|
|
||||||
|
/* ── Awards ──────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
export const awards = {
|
||||||
|
key: "awards",
|
||||||
|
label: "Awards",
|
||||||
|
singular: "award",
|
||||||
|
idLabel: "URL ID",
|
||||||
|
slugFrom: "name",
|
||||||
|
|
||||||
|
list: {
|
||||||
|
columns: [
|
||||||
|
{ key: "name", label: "Name", primary: true },
|
||||||
|
{ key: "org_id", label: "Awarded by" },
|
||||||
|
{ key: "description", label: "Description" },
|
||||||
|
{ key: "is_published", label: "Live", widget: "bool" },
|
||||||
|
{ key: "is_listed", label: "Listed", widget: "bool" },
|
||||||
|
],
|
||||||
|
filters: [
|
||||||
|
{ key: "org_id", label: "Awarded by", optionsFrom: "organizations" },
|
||||||
|
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
||||||
|
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
legend: "Identity",
|
||||||
|
note:
|
||||||
|
"An award exists whether or not anyone has received it. " +
|
||||||
|
"Who received it is edited on the person.",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "org_id",
|
||||||
|
label: "Awarded by",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "organizations",
|
||||||
|
blankLabel: "- unattributed -",
|
||||||
|
help: "The organization that gives this award",
|
||||||
|
},
|
||||||
|
{ path: "name", label: "Name", required: true },
|
||||||
|
{ path: "description", label: "Description", widget: "textarea", full: true },
|
||||||
|
{ path: "logo", label: "Logo", widget: "image", resolve: mediaUrl, full: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Publishing",
|
||||||
|
note: "An unpublished award is a draft: off the site, and a 404 at its own page.",
|
||||||
|
fields: PUBLISH_FIELDS,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
184
src/lib/adminSchema/blog.ts
Normal file
184
src/lib/adminSchema/blog.ts
Normal file
|
|
@ -0,0 +1,184 @@
|
||||||
|
import { preview } from "../text.ts";
|
||||||
|
import { mediaUrl } from "../media.ts";
|
||||||
|
import { PUBLISHED_FIELD, LISTED_FIELD, FEATURED_KINDS, featuredCardsChild, blocksChild } from "./shared.ts";
|
||||||
|
|
||||||
|
/* ── Blog (031_blog.sql) ─────────────────────────────────────────
|
||||||
|
Posts at /blog/:id, and the Community page's blog section. The
|
||||||
|
section's community posts reuse the featured cards, limited to
|
||||||
|
links: a pinned Substack post is a link card, and Fetch preview
|
||||||
|
fills it from the post. */
|
||||||
|
|
||||||
|
/* A post's body is the content blocks without the card/body choice:
|
||||||
|
a post only has a body. */
|
||||||
|
const blogBlocksChild = {
|
||||||
|
...blocksChild,
|
||||||
|
label: "Post body",
|
||||||
|
note: "The post, top to bottom. The first paragraph doubles as the excerpt when that's left blank.",
|
||||||
|
fields: blocksChild.fields.filter((field) => field.path !== "slot"),
|
||||||
|
};
|
||||||
|
|
||||||
|
export const blogPosts = {
|
||||||
|
key: "blog_posts",
|
||||||
|
label: "Blog posts",
|
||||||
|
singular: "blog post",
|
||||||
|
idLabel: "URL ID",
|
||||||
|
slugFrom: "title",
|
||||||
|
|
||||||
|
list: {
|
||||||
|
columns: [
|
||||||
|
{ key: "title", label: "Title", primary: true },
|
||||||
|
{ key: "published_on", label: "Date" },
|
||||||
|
{ key: "tags", label: "Tags" },
|
||||||
|
{ key: "is_published", label: "Live", widget: "bool" },
|
||||||
|
{ key: "is_listed", label: "Listed", widget: "bool" },
|
||||||
|
],
|
||||||
|
filters: [
|
||||||
|
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Draft"]] },
|
||||||
|
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
legend: "Post",
|
||||||
|
fields: [
|
||||||
|
{ path: "title", label: "Title", required: true, full: true },
|
||||||
|
{ path: "published_on", label: "Date", widget: "date", help: "Newest first on the Community page" },
|
||||||
|
{ path: "tags", label: "Tags", help: "Comma separated, eg. Reflection, Event recap" },
|
||||||
|
{
|
||||||
|
path: "excerpt",
|
||||||
|
label: "Excerpt",
|
||||||
|
widget: "textarea",
|
||||||
|
full: true,
|
||||||
|
help: "A sentence or two for the card. Default: the body's first paragraph.",
|
||||||
|
},
|
||||||
|
{ path: "cover_image", label: "Cover image", widget: "image", resolve: mediaUrl, full: true },
|
||||||
|
{
|
||||||
|
path: "cover_alt",
|
||||||
|
label: "Cover description",
|
||||||
|
full: true,
|
||||||
|
help: "For screen readers: what the cover shows. Default: skipped as decoration.",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Guest author",
|
||||||
|
note: "For a writer with no People record. People who wrote it go under Authors below; both can be set.",
|
||||||
|
fields: [
|
||||||
|
{ path: "guest_author", label: "Name" },
|
||||||
|
{ path: "guest_photo", label: "Photo", widget: "image", resolve: mediaUrl, full: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Publishing",
|
||||||
|
note: "A new post is a draft until Published is ticked. Unlisted posts keep their page and can still be pinned.",
|
||||||
|
fields: [PUBLISHED_FIELD, LISTED_FIELD],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "authors",
|
||||||
|
label: "Authors",
|
||||||
|
note: "Shown as person tiles at the end of the post, in this order.",
|
||||||
|
addLabel: "Add author",
|
||||||
|
title: (row, options) =>
|
||||||
|
options?.people?.find((p) => p.id === row.person_id)?.label ?? "New author",
|
||||||
|
blank: { person_id: "" },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "person_id",
|
||||||
|
label: "Person",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "people",
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
blogBlocksChild,
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export const communityPage = {
|
||||||
|
key: "community_page",
|
||||||
|
label: "Community blog section",
|
||||||
|
singular: "community blog section",
|
||||||
|
idLabel: "Page",
|
||||||
|
singleton: "community",
|
||||||
|
|
||||||
|
list: { columns: [], filters: [] },
|
||||||
|
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
legend: "Section",
|
||||||
|
note: "The first section of the Community page.",
|
||||||
|
fields: [
|
||||||
|
{ path: "blog_title", label: "Heading", help: "Default: Community Blog" },
|
||||||
|
{ path: "blog_blurb", label: "Blurb", widget: "textarea", full: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Our posts",
|
||||||
|
note: "Pinned posts first, then the newest published, listed posts, up to the number of slots.",
|
||||||
|
fields: [
|
||||||
|
{ path: "internal_title", label: "Heading", help: "Default: From NGU" },
|
||||||
|
{ path: "internal_slots", label: "Slots", widget: "number", help: "0 to 12. Default: 3" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Community posts",
|
||||||
|
note: "Pinned cards first, then the newest items from the feeds below, up to the number of slots.",
|
||||||
|
fields: [
|
||||||
|
{ path: "external_title", label: "Heading", help: "Default: From our community" },
|
||||||
|
{ path: "external_slots", label: "Slots", widget: "number", help: "0 to 12. Default: 3" },
|
||||||
|
{ path: "external_url", label: "Button link", help: "eg. https://ngu.substack.com", full: true },
|
||||||
|
{ path: "external_label", label: "Button text", help: "Default: Read more on Substack" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "pinned_posts",
|
||||||
|
label: "Pinned posts (ours)",
|
||||||
|
note: "Always shown, before the newest.",
|
||||||
|
addLabel: "Pin a post",
|
||||||
|
title: (row, options) =>
|
||||||
|
options?.blog_posts?.find((p) => p.id === row.post_id)?.label ?? "New pin",
|
||||||
|
blank: { post_id: "" },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "post_id",
|
||||||
|
label: "Post",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "blog_posts",
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...featuredCardsChild,
|
||||||
|
label: "Pinned community posts",
|
||||||
|
note: "Always shown, before the feeds' newest. Paste a post's link and press Fetch preview.",
|
||||||
|
addLabel: "Pin a post",
|
||||||
|
blank: { kind: "", url: "", title: "" },
|
||||||
|
fields: featuredCardsChild.fields.map((field) =>
|
||||||
|
field.path === "kind"
|
||||||
|
? { ...field, options: FEATURED_KINDS.filter(([kind]) => kind !== "record") }
|
||||||
|
: field,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "feeds",
|
||||||
|
label: "Feeds",
|
||||||
|
note: "RSS or Atom feeds whose newest posts fill the community slots. Read about every 30 minutes.",
|
||||||
|
addLabel: "Add feed",
|
||||||
|
title: (row) => row.label || row.url || "New feed",
|
||||||
|
blank: { url: "", label: "" },
|
||||||
|
fields: [
|
||||||
|
{ path: "url", label: "Feed URL", required: true, full: true, help: "eg. https://ngu.substack.com/feed" },
|
||||||
|
{ path: "label", label: "Source name", help: "Shown on its cards. Default: the feed's own title" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
203
src/lib/adminSchema/events.ts
Normal file
203
src/lib/adminSchema/events.ts
Normal file
|
|
@ -0,0 +1,203 @@
|
||||||
|
import { mediaUrl } from "../media.ts";
|
||||||
|
import { PLACE_FIELDS, PUBLISHED_FIELD, LISTED_FIELD, timelineGroup, timelineDetailGroup, linksChild, hostsChild, blocksChild } from "./shared.ts";
|
||||||
|
|
||||||
|
/* ── Events ──────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
/* The panel the Series checkbox opens. Starts and Ends above stay
|
||||||
|
the series' bounds (the first meeting and the last day it can
|
||||||
|
meet), so nothing here repeats them. */
|
||||||
|
const SERIES_WEEKDAYS = [
|
||||||
|
["sun", "Sunday"],
|
||||||
|
["mon", "Monday"],
|
||||||
|
["tue", "Tuesday"],
|
||||||
|
["wed", "Wednesday"],
|
||||||
|
["thu", "Thursday"],
|
||||||
|
["fri", "Friday"],
|
||||||
|
["sat", "Saturday"],
|
||||||
|
];
|
||||||
|
|
||||||
|
const seriesGroup = {
|
||||||
|
legend: "Series",
|
||||||
|
when: { path: "is_series", value: 1 },
|
||||||
|
note:
|
||||||
|
"Starts is the first meeting and anchors the schedule; Ends, if set, is the last " +
|
||||||
|
"day it can meet. The weekdays only apply to a weekly series; with none ticked it " +
|
||||||
|
"meets on the start date's day. Leave Date label blank and the site describes " +
|
||||||
|
"the schedule itself.",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "series_frequency",
|
||||||
|
label: "Repeats",
|
||||||
|
widget: "select",
|
||||||
|
options: [
|
||||||
|
["weekly", "Weekly, on the days ticked below"],
|
||||||
|
["monthly_date", "Monthly, on the day of the start date (eg. the 13th)"],
|
||||||
|
["monthly_weekday", "Monthly, on the weekday of the start date (eg. 2nd Tuesday)"],
|
||||||
|
],
|
||||||
|
blankLabel: "Default: weekly",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "series_interval",
|
||||||
|
label: "Every",
|
||||||
|
widget: "number",
|
||||||
|
help: "1 for every week or month, 2 for every other, and so on",
|
||||||
|
},
|
||||||
|
{ path: "series_start_time", label: "Start time", widget: "time" },
|
||||||
|
{ path: "series_end_time", label: "End time", widget: "time" },
|
||||||
|
{
|
||||||
|
path: "series_count",
|
||||||
|
label: "Number of meetings",
|
||||||
|
widget: "number",
|
||||||
|
help: "Stops after this many. Blank to run until Ends, or indefinitely",
|
||||||
|
},
|
||||||
|
...SERIES_WEEKDAYS.map(([day, name]) => ({
|
||||||
|
path: `series_${day}`,
|
||||||
|
label: name,
|
||||||
|
widget: "checkbox",
|
||||||
|
help: `Meets on ${name}s`,
|
||||||
|
})),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export const events = {
|
||||||
|
key: "events",
|
||||||
|
label: "Events",
|
||||||
|
singular: "event",
|
||||||
|
idLabel: "URL ID",
|
||||||
|
slugFrom: "title",
|
||||||
|
|
||||||
|
list: {
|
||||||
|
columns: [
|
||||||
|
{ key: "title", label: "Title", primary: true },
|
||||||
|
{ key: "scope_id", label: "Scope" },
|
||||||
|
{ key: "event_type", label: "Type" },
|
||||||
|
{ key: "date_label", label: "Dates" },
|
||||||
|
{ key: "status", label: "Status" },
|
||||||
|
{ key: "is_published", label: "Live", widget: "bool" },
|
||||||
|
{ key: "is_listed", label: "Listed", widget: "bool" },
|
||||||
|
],
|
||||||
|
filters: [
|
||||||
|
{ key: "scope_id", label: "Scope", optionsFrom: "event_scopes" },
|
||||||
|
{
|
||||||
|
key: "event_type",
|
||||||
|
label: "Type",
|
||||||
|
options: ["retreat", "class", "workshop", "meeting", "other"],
|
||||||
|
},
|
||||||
|
{ key: "status", label: "Status", options: ["upcoming", "past", "cancelled"] },
|
||||||
|
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
||||||
|
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
legend: "Identity",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "scope_id",
|
||||||
|
label: "Scope",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "event_scopes",
|
||||||
|
required: true,
|
||||||
|
help: "Whose gathering this is.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "event_type",
|
||||||
|
label: "Type",
|
||||||
|
widget: "select",
|
||||||
|
options: ["retreat", "class", "workshop", "meeting", "other"],
|
||||||
|
required: true,
|
||||||
|
help: "What kind of gathering. Independent of the scope",
|
||||||
|
},
|
||||||
|
{ path: "title", label: "Title", required: true },
|
||||||
|
{ path: "theme", label: "Theme" },
|
||||||
|
{ path: "tagline", label: "Tagline", full: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "When",
|
||||||
|
fields: [
|
||||||
|
{ path: "starts_on", label: "Starts", widget: "date" },
|
||||||
|
{ path: "ends_on", label: "Ends", widget: "date" },
|
||||||
|
{
|
||||||
|
path: "date_label",
|
||||||
|
label: "Date label",
|
||||||
|
help: "Text override of what the card shows (eg. March/April 2026)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "status",
|
||||||
|
label: "Status",
|
||||||
|
widget: "select",
|
||||||
|
options: ["upcoming", "past", "cancelled"],
|
||||||
|
blankLabel: "Default: derive from end date",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "is_series",
|
||||||
|
label: "Series",
|
||||||
|
widget: "checkbox",
|
||||||
|
help: "Repeats on a schedule, such as a weekly class, a monthly meeting",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
seriesGroup,
|
||||||
|
{ legend: "Where", fields: PLACE_FIELDS },
|
||||||
|
{
|
||||||
|
legend: "Appearance",
|
||||||
|
fields: [
|
||||||
|
{ path: "event_logo", label: "Event logo", widget: "image", resolve: mediaUrl, full: true },
|
||||||
|
{ path: "org_logo", label: "Org logo override", widget: "image", resolve: mediaUrl, full: true },
|
||||||
|
{ path: "color", label: "Colour", widget: "color" },
|
||||||
|
{
|
||||||
|
path: "card_image",
|
||||||
|
label: "Card background",
|
||||||
|
widget: "image",
|
||||||
|
resolve: mediaUrl,
|
||||||
|
full: true,
|
||||||
|
help: "A photo behind the event's card, faded so the text stays readable.",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
timelineGroup("event"),
|
||||||
|
timelineDetailGroup("event"),
|
||||||
|
{ legend: "Publishing", fields: [PUBLISHED_FIELD, LISTED_FIELD] },
|
||||||
|
],
|
||||||
|
|
||||||
|
children: [
|
||||||
|
hostsChild,
|
||||||
|
{
|
||||||
|
key: "event_people",
|
||||||
|
label: "People at this event",
|
||||||
|
addLabel: "Add person",
|
||||||
|
title: (row, options) =>
|
||||||
|
options?.people?.find((p) => p.id === row.person_id)?.label ?? "New person",
|
||||||
|
blank: { person_id: "", role: "speaker", is_public: 1 },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "person_id",
|
||||||
|
label: "Person",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "people",
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "role",
|
||||||
|
label: "Role",
|
||||||
|
widget: "select",
|
||||||
|
options: [
|
||||||
|
"speaker",
|
||||||
|
"leader",
|
||||||
|
"facilitator",
|
||||||
|
"host",
|
||||||
|
"musician",
|
||||||
|
"volunteer",
|
||||||
|
"attendee",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ path: "title", label: "Title", help: "eg. Keynote Speaker" },
|
||||||
|
{ path: "is_public", label: "Show on the site", widget: "checkbox" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
linksChild,
|
||||||
|
blocksChild,
|
||||||
|
],
|
||||||
|
};
|
||||||
244
src/lib/adminSchema/frontPage.ts
Normal file
244
src/lib/adminSchema/frontPage.ts
Normal file
|
|
@ -0,0 +1,244 @@
|
||||||
|
import { mediaUrl } from "../media.ts";
|
||||||
|
import { featuredCardsChild } from "./shared.ts";
|
||||||
|
|
||||||
|
/* ── Front page ──────────────────────────────────────────────────
|
||||||
|
|
||||||
|
One record (see the singleton note in server/src/admin-schema.js).
|
||||||
|
The groups are the hero; the collections below are the rest of
|
||||||
|
the page. Photos, the livestream and the featured video are
|
||||||
|
editable whatever the mode, so each can be ready before the
|
||||||
|
switch is flipped.
|
||||||
|
|
||||||
|
Section keys and stat sources are the CHECK lists on
|
||||||
|
front_page_sections and front_page_stats. The labels here are what the admin reads; the values are
|
||||||
|
what the page and the API key on. */
|
||||||
|
|
||||||
|
const FRONT_PAGE_SECTIONS = [
|
||||||
|
["countdown", "Event Countdown"],
|
||||||
|
["retreats", "Events Carousel (National Retreats)"],
|
||||||
|
["calendar", "Event Calendar"],
|
||||||
|
["stats", "Stats"],
|
||||||
|
["timeline", "Featured Timeline"],
|
||||||
|
["connect", "Connect Nav"],
|
||||||
|
["featured", "Featured Content"],
|
||||||
|
];
|
||||||
|
|
||||||
|
const STAT_SOURCES = [
|
||||||
|
["manual", "Print Value Field"],
|
||||||
|
["years_since", "Years Since Value"],
|
||||||
|
["regions", "Count: regions"],
|
||||||
|
["chapters", "Count: chapters"],
|
||||||
|
["partners", "Count: partners"],
|
||||||
|
["events_held", "Count: past events"],
|
||||||
|
["retreats_held", "Count: past retreats"],
|
||||||
|
["people", "Count: people in database"],
|
||||||
|
["awards_given", "Count: public awards given"],
|
||||||
|
];
|
||||||
|
|
||||||
|
export const frontPage = {
|
||||||
|
key: "front_page",
|
||||||
|
label: "Front page",
|
||||||
|
singular: "front page",
|
||||||
|
idLabel: "Page",
|
||||||
|
singleton: "home",
|
||||||
|
|
||||||
|
list: { columns: [], filters: [] },
|
||||||
|
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
legend: "Hero - Primary Section",
|
||||||
|
note: "The first thing a visitor sees. Blank buttons don't render.",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "hero_backdrop",
|
||||||
|
label: "Background",
|
||||||
|
widget: "select",
|
||||||
|
options: [
|
||||||
|
["brand", "Brand: animated colour and the dove"],
|
||||||
|
["photos", "Photos: cycles through the photos below"],
|
||||||
|
],
|
||||||
|
blankLabel: "Default: brand",
|
||||||
|
help: "Photos with none added shows the brand background",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "hero_feature",
|
||||||
|
label: "Feature",
|
||||||
|
widget: "select",
|
||||||
|
options: [
|
||||||
|
["none", "Nothing: No additional overlay"],
|
||||||
|
["livestream", "Livestream: the stream, with a LIVE badge"],
|
||||||
|
["video", "Featured video: click to play"],
|
||||||
|
["event", "Featured event: an event's card"],
|
||||||
|
],
|
||||||
|
blankLabel: "Default: nothing",
|
||||||
|
help: "Switch to Livestream when you go live, and back when you're done",
|
||||||
|
},
|
||||||
|
{ path: "eyebrow", label: "Eyebrow", help: "Small line above the headline" },
|
||||||
|
{ path: "headline", label: "Headline", full: true },
|
||||||
|
{ path: "subhead", label: "Subhead", widget: "textarea", full: true },
|
||||||
|
{ path: "primary_label", label: "Main button label" },
|
||||||
|
{ path: "primary_url", label: "Main button link", help: "/page, #section-id or a full URL" },
|
||||||
|
{ path: "secondary_label", label: "Second button label" },
|
||||||
|
{ path: "secondary_url", label: "Second button link" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Photos, livestream, video and event",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "slide_seconds",
|
||||||
|
label: "Seconds per photo",
|
||||||
|
widget: "number",
|
||||||
|
help: "Photos Background. Set from 3 to 60 seconds",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "livestream_url",
|
||||||
|
label: "Livestream link",
|
||||||
|
full: true,
|
||||||
|
help: "A YouTube, Facebook or Vimeo link, or any embed URL",
|
||||||
|
},
|
||||||
|
{ path: "livestream_title", label: "Livestream title", full: true },
|
||||||
|
{
|
||||||
|
path: "video_url",
|
||||||
|
label: "Featured video",
|
||||||
|
full: true,
|
||||||
|
help:
|
||||||
|
"A YouTube, Vimeo or Facebook link, or a video file: a filename in " +
|
||||||
|
"the uploads folder, or a link ending in .mp4 or .webm",
|
||||||
|
},
|
||||||
|
{ path: "video_title", label: "Video title", full: true, help: "Shown after \"Featured video\" above the headline" },
|
||||||
|
{
|
||||||
|
path: "hero_event_id",
|
||||||
|
label: "Featured event",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "events",
|
||||||
|
blankLabel: "Default: the countdown's event",
|
||||||
|
full: true,
|
||||||
|
help: "For the Featured event feature. A pinned event that's over falls back to the countdown's",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Countdown",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "countdown_event_id",
|
||||||
|
label: "Count down to",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "events",
|
||||||
|
blankLabel: "Default: the next upcoming event",
|
||||||
|
help: "Leave blank almost always. A pinned event that's over falls back to the next one",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "countdown_scope_id",
|
||||||
|
label: "Only this scope",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "event_scopes",
|
||||||
|
blankLabel: "Default: any scope",
|
||||||
|
help: "Narrows the next upcoming event. Ignored when an event is pinned above",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "countdown_event_type",
|
||||||
|
label: "Only this type",
|
||||||
|
widget: "select",
|
||||||
|
options: [
|
||||||
|
["retreat", "Retreat"],
|
||||||
|
["class", "Class"],
|
||||||
|
["workshop", "Workshop"],
|
||||||
|
["meeting", "Meeting"],
|
||||||
|
["other", "Other"],
|
||||||
|
],
|
||||||
|
blankLabel: "Default: any type",
|
||||||
|
help: "Combines with the scope: National + Retreat counts down to the next national retreat",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "sections",
|
||||||
|
label: "Page sections",
|
||||||
|
note: "Drag to reorder. Each section can appear once; leave one out to drop it.",
|
||||||
|
addLabel: "Add section",
|
||||||
|
title: (row) =>
|
||||||
|
FRONT_PAGE_SECTIONS.find(([key]) => key === row.section)?.[1] ?? "New section",
|
||||||
|
blank: { section: "", title: "", blurb: "" },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "section",
|
||||||
|
label: "Section",
|
||||||
|
widget: "select",
|
||||||
|
options: FRONT_PAGE_SECTIONS,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{ path: "title", label: "Heading", help: "Heading Override" },
|
||||||
|
{ path: "blurb", label: "Blurb", full: true },
|
||||||
|
{ path: "is_hidden", label: "Hidden", widget: "checkbox", help: "Hide for now" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "slides",
|
||||||
|
label: "Hero photos",
|
||||||
|
note: "Shown in Photos mode, in this order.",
|
||||||
|
addLabel: "Add photo",
|
||||||
|
title: (row) => row.caption || row.media || "New photo",
|
||||||
|
blank: { media: "", alt: "", caption: "" },
|
||||||
|
fields: [
|
||||||
|
{ path: "media", label: "Photo", required: true, widget: "image", resolve: mediaUrl, full: true },
|
||||||
|
{ path: "alt", label: "Description", help: "For screen readers" },
|
||||||
|
{ path: "caption", label: "Caption", full: true },
|
||||||
|
{ path: "link_url", label: "Link", help: "Optional; makes the caption a link" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "stats",
|
||||||
|
label: "Numbers",
|
||||||
|
note: "Counts update themselves. A typed-in number with no value is left out.",
|
||||||
|
addLabel: "Add number",
|
||||||
|
title: (row) => row.label || "New number",
|
||||||
|
blank: { label: "", source: "", value: "" },
|
||||||
|
fields: [
|
||||||
|
{ path: "label", label: "Label", required: true },
|
||||||
|
{
|
||||||
|
path: "source",
|
||||||
|
label: "Number Source",
|
||||||
|
widget: "select",
|
||||||
|
options: STAT_SOURCES,
|
||||||
|
blankLabel: "Default: Print Value",
|
||||||
|
},
|
||||||
|
{ path: "value", label: "Value", help: "The number thats printed" },
|
||||||
|
{ path: "suffix", label: "Suffix", help: "+, k, % …" },
|
||||||
|
{ path: "note", label: "Note", full: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
featuredCardsChild,
|
||||||
|
{
|
||||||
|
key: "paths",
|
||||||
|
label: "Connect Nav",
|
||||||
|
note: "Each path is a choice a visitor can pick; its actions appear when they do.",
|
||||||
|
addLabel: "Add path",
|
||||||
|
title: (row) => [row.icon, row.label].filter(Boolean).join(" ") || "New path",
|
||||||
|
blank: { label: "", icon: "", blurb: "" },
|
||||||
|
fields: [
|
||||||
|
{ path: "label", label: "Label", required: true, help: "eg. Attend, Serve…" },
|
||||||
|
{ path: "icon", label: "Icon", help: "Emoji" },
|
||||||
|
{ path: "blurb", label: "Blurb", full: true },
|
||||||
|
],
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "actions",
|
||||||
|
label: "Actions",
|
||||||
|
addLabel: "Add action",
|
||||||
|
title: (row) => row.label || "New action",
|
||||||
|
blank: { label: "", url: "" },
|
||||||
|
fields: [
|
||||||
|
{ path: "label", label: "Label", required: true },
|
||||||
|
{ path: "url", label: "Link", required: true },
|
||||||
|
{ path: "description", label: "Description", full: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
107
src/lib/adminSchema/organizations.ts
Normal file
107
src/lib/adminSchema/organizations.ts
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
import { mediaUrl } from "../media.ts";
|
||||||
|
import { PLACE_FIELDS, PUBLISH_FIELDS, timelineGroup, timelineDetailGroup, linksChild, blocksChild } from "./shared.ts";
|
||||||
|
|
||||||
|
/* ── Organizations ───────────────────────────────────────────── */
|
||||||
|
|
||||||
|
export const organizations = {
|
||||||
|
key: "organizations",
|
||||||
|
label: "Organizations",
|
||||||
|
singular: "organization",
|
||||||
|
idLabel: "URL ID",
|
||||||
|
slugFrom: "name",
|
||||||
|
|
||||||
|
list: {
|
||||||
|
columns: [
|
||||||
|
{ key: "name", label: "Name", primary: true },
|
||||||
|
{ key: "kind", label: "Kind" },
|
||||||
|
{ key: "locality", label: "City" },
|
||||||
|
{ key: "state_code", label: "State" },
|
||||||
|
{ key: "is_published", label: "Live", widget: "bool" },
|
||||||
|
{ key: "is_listed", label: "Listed", widget: "bool" },
|
||||||
|
],
|
||||||
|
filters: [
|
||||||
|
{ key: "kind", label: "Kind", options: ["national", "region", "chapter", "partner"] },
|
||||||
|
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
||||||
|
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
legend: "Identity",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "kind",
|
||||||
|
label: "Kind",
|
||||||
|
widget: "select",
|
||||||
|
options: ["national", "region", "chapter", "partner"],
|
||||||
|
required: true,
|
||||||
|
help: "Changing this swaps which extra fields apply",
|
||||||
|
},
|
||||||
|
{ path: "name", label: "Name", required: true },
|
||||||
|
{ path: "short_name", label: "Short name" },
|
||||||
|
{ path: "tagline", label: "Tagline", full: true },
|
||||||
|
{ path: "color", label: "Colour", widget: "color" },
|
||||||
|
{ path: "logo", label: "Logo", widget: "image", resolve: mediaUrl, full: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Region",
|
||||||
|
when: { path: "kind", value: "region" },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "region.scope",
|
||||||
|
label: "Scope",
|
||||||
|
widget: "select",
|
||||||
|
options: ["domestic", "international", "virtual"],
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{ path: "region.map_note", label: "Map note", full: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Chapter",
|
||||||
|
when: { path: "kind", value: "chapter" },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "chapter.region_id",
|
||||||
|
label: "Region",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "regions",
|
||||||
|
blankLabel: "Default: none",
|
||||||
|
},
|
||||||
|
{ path: "chapter.meets", label: "Meets", help: "2nd Sundays, 6:00pm" },
|
||||||
|
{ path: "chapter.started", label: "Started", help: "Since 2021" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ legend: "Place", fields: PLACE_FIELDS },
|
||||||
|
timelineGroup("organization"),
|
||||||
|
timelineDetailGroup("organization"),
|
||||||
|
{ legend: "Publishing", fields: PUBLISH_FIELDS },
|
||||||
|
],
|
||||||
|
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "region_areas",
|
||||||
|
label: "Map areas",
|
||||||
|
when: { path: "kind", value: "region" },
|
||||||
|
addLabel: "Add area",
|
||||||
|
title: (row) => row.area_code || "New area",
|
||||||
|
blank: { area_code: "", share: 1 },
|
||||||
|
fields: [
|
||||||
|
{ path: "area_code", label: "Area code", required: true, help: "Two letter state code or Country name" },
|
||||||
|
{ path: "share", label: "Share", widget: "number", help: "1 for the whole tile, 0.5 for half" },
|
||||||
|
{
|
||||||
|
path: "edge",
|
||||||
|
label: "Edge",
|
||||||
|
widget: "select",
|
||||||
|
options: ["top", "bottom"],
|
||||||
|
blankLabel: "Default: whole tile",
|
||||||
|
},
|
||||||
|
{ path: "note", label: "Note", help: "details to explain why it's half or other note" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
linksChild,
|
||||||
|
blocksChild,
|
||||||
|
],
|
||||||
|
};
|
||||||
148
src/lib/adminSchema/people.ts
Normal file
148
src/lib/adminSchema/people.ts
Normal file
|
|
@ -0,0 +1,148 @@
|
||||||
|
import { mediaUrl } from "../media.ts";
|
||||||
|
import { PUBLISHED_FIELD, LISTED_FIELD, AFFILIATION_ROLE_FIELDS, linksChild, blocksChild } from "./shared.ts";
|
||||||
|
|
||||||
|
/* ── People ──────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
export const people = {
|
||||||
|
key: "people",
|
||||||
|
label: "People",
|
||||||
|
singular: "person",
|
||||||
|
idLabel: "URL ID",
|
||||||
|
slugFrom: "display_name",
|
||||||
|
|
||||||
|
list: {
|
||||||
|
columns: [
|
||||||
|
{ key: "display_name", label: "Name", primary: true },
|
||||||
|
{ key: "tagline", label: "Tagline" },
|
||||||
|
{ key: "locality", label: "City" },
|
||||||
|
{ key: "is_published", label: "Live", widget: "bool" },
|
||||||
|
{ key: "is_listed", label: "Listed", widget: "bool" },
|
||||||
|
],
|
||||||
|
filters: [
|
||||||
|
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
||||||
|
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
legend: "Identity",
|
||||||
|
fields: [
|
||||||
|
{ path: "display_name", label: "Display name", required: true },
|
||||||
|
{ path: "sort_name", label: "Sort name", help: "Doe, Jane" },
|
||||||
|
{ path: "pronouns", label: "Pronouns" },
|
||||||
|
{ path: "tagline", label: "Tagline", full: true },
|
||||||
|
{ path: "photo", label: "Photo", widget: "image", resolve: mediaUrl, full: true },
|
||||||
|
{
|
||||||
|
path: "primary_org_id",
|
||||||
|
label: "Home organization",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "organizations",
|
||||||
|
blankLabel: "Default: none",
|
||||||
|
help: "Optional. Shown above their bio",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "bio",
|
||||||
|
label: "Bio",
|
||||||
|
widget: "textarea",
|
||||||
|
full: true,
|
||||||
|
help: "Leave a blank line between paragraphs",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Public contact",
|
||||||
|
fields: [
|
||||||
|
{ path: "public_email", label: "Email", help: "Printed on the site" },
|
||||||
|
{ path: "public_phone", label: "Phone" },
|
||||||
|
{ path: "locality", label: "City" },
|
||||||
|
{ path: "state_code", label: "State" },
|
||||||
|
{ path: "country", label: "Country" },
|
||||||
|
{ path: "location_label", label: "Display location" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Private",
|
||||||
|
note: "Never sent to the public site. Only admins see this.",
|
||||||
|
fields: [
|
||||||
|
{ path: "private.birth_date", label: "Birth date", widget: "date" },
|
||||||
|
{ path: "private.private_email", label: "Email" },
|
||||||
|
{ path: "private.private_phone", label: "Phone" },
|
||||||
|
{ path: "private.address", label: "Address", full: true },
|
||||||
|
{ path: "private.notes", label: "Notes", widget: "textarea", full: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Publishing",
|
||||||
|
note: "Unpublished people are invisible everywhere.",
|
||||||
|
fields: [PUBLISHED_FIELD, LISTED_FIELD],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "affiliations",
|
||||||
|
label: "Roles and organizations",
|
||||||
|
addLabel: "Add role",
|
||||||
|
note:
|
||||||
|
"Where someone appears within a team is set on that team's page, " +
|
||||||
|
"not by the order of this list.",
|
||||||
|
title: (row, options) =>
|
||||||
|
[row.title, options?.organizations?.find((o) => o.id === row.org_id)?.label]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(" · ") || "New role",
|
||||||
|
blank: { org_id: "", role: "member", is_public: 1, is_owner: 0 },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "org_id",
|
||||||
|
label: "Organization",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "organizations",
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "team_id",
|
||||||
|
label: "Team",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "teams",
|
||||||
|
blankLabel: "Default: none",
|
||||||
|
// A team belongs to an org; offering one from another
|
||||||
|
// org would fail the composite foreign key on save.
|
||||||
|
filterBy: (option, row) => option.org_id === row.org_id,
|
||||||
|
help: "Only teams of the chosen organization",
|
||||||
|
},
|
||||||
|
...AFFILIATION_ROLE_FIELDS,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "person_awards",
|
||||||
|
label: "Awards",
|
||||||
|
addLabel: "Add award",
|
||||||
|
title: (row, options) =>
|
||||||
|
options?.awards?.find((a) => a.id === row.award_id)?.label ?? "New award",
|
||||||
|
blank: { award_id: "", is_public: 1 },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "award_id",
|
||||||
|
label: "Award",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "awards",
|
||||||
|
required: true,
|
||||||
|
help: "Labelled with the organization that gives it",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "event_id",
|
||||||
|
label: "Presented at",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "events",
|
||||||
|
blankLabel: "Default: none",
|
||||||
|
},
|
||||||
|
{ path: "awarded_on", label: "Date", widget: "date" },
|
||||||
|
{ path: "citation", label: "Citation", widget: "textarea", full: true },
|
||||||
|
{ path: "is_public", label: "Public", widget: "checkbox" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
linksChild,
|
||||||
|
blocksChild,
|
||||||
|
],
|
||||||
|
};
|
||||||
446
src/lib/adminSchema/shared.ts
Normal file
446
src/lib/adminSchema/shared.ts
Normal file
|
|
@ -0,0 +1,446 @@
|
||||||
|
/* Field sets, groups and child collections shared by several entity
|
||||||
|
manifests (adminSchema.ts has the overview). */
|
||||||
|
|
||||||
|
import { preview } from "../text.ts";
|
||||||
|
import { PLATFORMS } from "../platforms.ts";
|
||||||
|
import { FORMATTING_HELP } from "../../components/InlineText.tsx";
|
||||||
|
import { mediaUrl } from "../media.ts";
|
||||||
|
|
||||||
|
export const PLACE_FIELDS = [
|
||||||
|
{ path: "venue", label: "Venue" },
|
||||||
|
{ path: "address", label: "Address", full: true },
|
||||||
|
{ path: "locality", label: "City" },
|
||||||
|
{ path: "state_code", label: "State", help: "Two letters, US only" },
|
||||||
|
{ path: "country", label: "Country", help: "Defaults to US" },
|
||||||
|
{ path: "location_label", label: "Display location", help: "Overrides the line built from city and state" },
|
||||||
|
{ path: "latitude", label: "Latitude", widget: "number" },
|
||||||
|
{ path: "longitude", label: "Longitude", widget: "number" },
|
||||||
|
{ path: "is_online", label: "Online", widget: "checkbox" },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const PUBLISHED_FIELD = { path: "is_published", label: "Published", widget: "checkbox" };
|
||||||
|
|
||||||
|
/* Only means anything on a published record. Unticked, its own page
|
||||||
|
still works but the site's lists, counts and the QR page leave it
|
||||||
|
out. See 027_listed.sql for exactly which. */
|
||||||
|
export const LISTED_FIELD = {
|
||||||
|
path: "is_listed",
|
||||||
|
label: "Listed",
|
||||||
|
widget: "checkbox",
|
||||||
|
help: "Unticked: only reachable by its link",
|
||||||
|
};
|
||||||
|
|
||||||
|
/* For entities whose lists the site orders by hand. Events sort by
|
||||||
|
date and people by sort_name, so they take the first two alone. */
|
||||||
|
export const PUBLISH_FIELDS = [
|
||||||
|
PUBLISHED_FIELD,
|
||||||
|
LISTED_FIELD,
|
||||||
|
{ path: "sort_order", label: "Sort order", widget: "number" },
|
||||||
|
];
|
||||||
|
|
||||||
|
/* The parts of an affiliation that read the same from either end:
|
||||||
|
the person's list of roles, and the team's list of members. */
|
||||||
|
export const AFFILIATION_ROLE_FIELDS = [
|
||||||
|
{ path: "title", label: "Title", help: "eg. Board Chair, Team Lead" },
|
||||||
|
{
|
||||||
|
path: "role",
|
||||||
|
label: "Role",
|
||||||
|
widget: "select",
|
||||||
|
options: ["lead", "board", "staff", "volunteer", "member"],
|
||||||
|
},
|
||||||
|
{ path: "is_owner", label: "Owner", widget: "checkbox", help: "Listed first (can be more than one)" },
|
||||||
|
{ path: "started_on", label: "Started", widget: "date" },
|
||||||
|
{ path: "ended_on", label: "Ended", widget: "date", help: "Blank means current" },
|
||||||
|
{ path: "is_public", label: "Public", widget: "checkbox" },
|
||||||
|
];
|
||||||
|
|
||||||
|
/* The timeline panel that appears on an event or organization once the
|
||||||
|
box is ticked. Paths are prefixed with the extension key, exactly as
|
||||||
|
'region.scope' and 'private.notes' are.
|
||||||
|
|
||||||
|
Everything here is an override. Left blank, the history page falls
|
||||||
|
back to the record's own title, date and logo through v_timeline,
|
||||||
|
which is the point of referencing rather than copying. */
|
||||||
|
export const timelineExtensionFields = (noun) => [
|
||||||
|
{
|
||||||
|
path: "timeline.occurred_on",
|
||||||
|
label: "Date on the timeline",
|
||||||
|
help: `Blank uses the ${noun}'s own date. Partial dates are fine: 2012, 2012-06`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "timeline.precision",
|
||||||
|
label: "Date precision",
|
||||||
|
widget: "select",
|
||||||
|
options: ["year", "month", "day"],
|
||||||
|
help: "How much of the date to trust. 'year' files it under 'Elsewhere in 2012'",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "timeline.title",
|
||||||
|
label: "Title override",
|
||||||
|
full: true,
|
||||||
|
help: `Blank uses the ${noun}'s name`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "timeline.blurb",
|
||||||
|
label: "Blurb override",
|
||||||
|
widget: "textarea",
|
||||||
|
full: true,
|
||||||
|
help: `Blank uses the ${noun}'s tagline`,
|
||||||
|
},
|
||||||
|
{ path: "timeline.meta", label: "Secondary line", help: "Region, venue, recipient" },
|
||||||
|
{
|
||||||
|
path: "timeline.link_url",
|
||||||
|
label: "Link override",
|
||||||
|
help: `Blank links to the ${noun}'s own page`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "timeline.is_featured",
|
||||||
|
label: "Featured",
|
||||||
|
widget: "checkbox",
|
||||||
|
help: "Shown large, above the month list for its year",
|
||||||
|
},
|
||||||
|
{ path: "timeline.is_published", label: "Visible on the history page", widget: "checkbox" },
|
||||||
|
{ path: "timeline.sort_order", label: "Sort order", widget: "number" },
|
||||||
|
];
|
||||||
|
|
||||||
|
/* The checkbox itself, plus the panel it gates. One entry in `groups`. */
|
||||||
|
export const timelineGroup = (noun) => ({
|
||||||
|
legend: "Timeline",
|
||||||
|
note:
|
||||||
|
`Adds this ${noun} to the history page. Nothing is copied, the entry ` +
|
||||||
|
`reads this record, so editing it here updates the timeline too.`,
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "in_timeline",
|
||||||
|
label: "On the timeline",
|
||||||
|
widget: "checkbox",
|
||||||
|
help: "Show this on the history page",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
export const timelineDetailGroup = (noun) => ({
|
||||||
|
legend: "Timeline entry",
|
||||||
|
when: { path: "in_timeline", value: 1 },
|
||||||
|
note: "Every field here is optional. Blank means \u201cuse the record's own value\u201d.",
|
||||||
|
fields: timelineExtensionFields(noun),
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Featured cards (030_featured_cards.sql), a front page collection
|
||||||
|
now and the Community blog's next, so it's written once. Fields
|
||||||
|
show by kind; switching kind clears the ones that stop applying
|
||||||
|
(see `when` in fields.tsx). */
|
||||||
|
export const FEATURED_KINDS = [
|
||||||
|
["record", "A page on this site (event, org, person…)"],
|
||||||
|
["link", "A link (article, post, any URL)"],
|
||||||
|
["video", "A video (YouTube, Vimeo, Facebook)"],
|
||||||
|
];
|
||||||
|
|
||||||
|
export const featuredCardsChild = {
|
||||||
|
key: "featured_cards",
|
||||||
|
label: "Featured cards",
|
||||||
|
note: "Shown by the Featured Content section, in this order.",
|
||||||
|
addLabel: "Add card",
|
||||||
|
title: (row, options) =>
|
||||||
|
row.title ||
|
||||||
|
options?.record_refs?.find((o) => o.kind === row.ref_kind && o.id === row.ref_id)?.label ||
|
||||||
|
row.url ||
|
||||||
|
"New card",
|
||||||
|
blank: { kind: "", ref_kind: "", ref_id: "", url: "", title: "" },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "kind",
|
||||||
|
label: "Card type",
|
||||||
|
widget: "select",
|
||||||
|
options: FEATURED_KINDS,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "ref_kind",
|
||||||
|
label: "Record type",
|
||||||
|
widget: "select",
|
||||||
|
options: ["event", "organization", "person", "team", "award"],
|
||||||
|
required: true,
|
||||||
|
when: { path: "kind", value: "record" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "ref_id",
|
||||||
|
label: "Record",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "record_refs",
|
||||||
|
filterBy: (option, row) => option.kind === row.ref_kind,
|
||||||
|
required: true,
|
||||||
|
when: { path: "kind", value: "record" },
|
||||||
|
help: "Its title, picture and link fill the card. Anything typed below overrides them.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "url",
|
||||||
|
label: "URL",
|
||||||
|
widget: "linkPreview",
|
||||||
|
previewWhen: { path: "kind", value: "link" },
|
||||||
|
required: true,
|
||||||
|
full: true,
|
||||||
|
when: { path: "kind", value: ["link", "video"] },
|
||||||
|
},
|
||||||
|
{ path: "eyebrow", label: "Label", help: "Small text above the title, eg. Article, Watch" },
|
||||||
|
{ path: "title", label: "Title" },
|
||||||
|
{ path: "blurb", label: "Blurb", widget: "textarea", full: true },
|
||||||
|
{
|
||||||
|
path: "image",
|
||||||
|
label: "Image",
|
||||||
|
widget: "image",
|
||||||
|
resolve: mediaUrl,
|
||||||
|
full: true,
|
||||||
|
help: "Default: the record's own picture, or for a YouTube video, its thumbnail.",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The two collections every entity carries. */
|
||||||
|
export const linksChild = {
|
||||||
|
key: "links",
|
||||||
|
label: "Links and socials",
|
||||||
|
addLabel: "Add link",
|
||||||
|
title: (row) => row.label || row.url || "New link",
|
||||||
|
blank: { kind: "action", label: "", url: "", is_primary: 0 },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "kind",
|
||||||
|
label: "Kind",
|
||||||
|
widget: "select",
|
||||||
|
options: ["action", "social", "website", "email"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "platform",
|
||||||
|
label: "Platform",
|
||||||
|
widget: "select",
|
||||||
|
options: PLATFORMS.map((platform) => [platform.id, platform.label]),
|
||||||
|
blankLabel: "Default: no icon",
|
||||||
|
help: "Shows the platform's icon on the button.",
|
||||||
|
},
|
||||||
|
{ path: "label", label: "Label", required: true },
|
||||||
|
{ path: "url", label: "URL", required: true, full: true },
|
||||||
|
{ path: "is_primary", label: "Primary", widget: "checkbox" },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Hosts. One row is one host, ordered, and each is either an
|
||||||
|
organization or a person, never both, which the CHECK on
|
||||||
|
event_hosts enforces and this form can only ask nicely about.
|
||||||
|
|
||||||
|
The first row supplies the logo and colour when the event sets
|
||||||
|
neither, so the order here is data rather than a display choice.
|
||||||
|
A person supplies neither: there is no colour on a person and a
|
||||||
|
headshot is not a logo, so a person-hosted event with no colour
|
||||||
|
of its own falls through to the section default. */
|
||||||
|
export const hostsChild = {
|
||||||
|
key: "event_hosts",
|
||||||
|
label: "Hosts",
|
||||||
|
addLabel: "Add host",
|
||||||
|
title: (row, options) =>
|
||||||
|
options?.organizations?.find((o) => o.id === row.org_id)?.label ??
|
||||||
|
options?.people?.find((p) => p.id === row.person_id)?.label ??
|
||||||
|
"New host",
|
||||||
|
blank: { org_id: "", person_id: "" },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "org_id",
|
||||||
|
label: "Organization",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "organizations",
|
||||||
|
blankLabel: "Default: none",
|
||||||
|
help: "Host Organization"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "person_id",
|
||||||
|
label: "Person",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "people",
|
||||||
|
blankLabel: "Default: none",
|
||||||
|
help: "Use if the host is an individual, choose between person and org host, not both.",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Content blocks. The type decides which fields appear (`when`),
|
||||||
|
what the text box is for (`help` as a function), and whether the
|
||||||
|
block has items; the preview under each open block is the site's
|
||||||
|
own renderer. Types and what they read: ContentBlocks.tsx. */
|
||||||
|
export const BLOCK_TYPES = [
|
||||||
|
["paragraph", "Paragraph", "Body text. Formatting: " + FORMATTING_HELP],
|
||||||
|
["heading", "Heading", "A section heading."],
|
||||||
|
["subheading", "Subheading", "A smaller heading under a heading."],
|
||||||
|
["callout", "Callout", "A note or announcement in a tinted box. Formatting: " + FORMATTING_HELP],
|
||||||
|
["quote", "Quote", "A quotation, with who said it. Formatting: " + FORMATTING_HELP],
|
||||||
|
["list", "List", "Bulleted items, each optionally linked, with an optional detail."],
|
||||||
|
["links", "Link buttons", "A row of outlined buttons, one per item."],
|
||||||
|
["button", "Button", "One filled call-to-action button, eg. Register, Donate."],
|
||||||
|
["image", "Image", "A picture, with alt text and an optional caption and link."],
|
||||||
|
["video", "Video", "A YouTube, Vimeo or Facebook video, or a video file, played in place."],
|
||||||
|
["schedule", "Schedule", "Entries in one tab per day, each folding out for more. The text is an optional intro."],
|
||||||
|
["divider", "Divider", "A thin line between parts."],
|
||||||
|
];
|
||||||
|
|
||||||
|
/* An item field that only a schedule's entries have. */
|
||||||
|
export const SCHEDULE_ENTRY = { scope: "parent", path: "type", value: "schedule" };
|
||||||
|
|
||||||
|
export const blockTypeLabel = (type) => BLOCK_TYPES.find(([value]) => value === type)?.[1] ?? type;
|
||||||
|
|
||||||
|
export const TEXT_TYPES = ["paragraph", "heading", "subheading", "callout", "quote", "button", "image", "video", "schedule"];
|
||||||
|
|
||||||
|
export const TEXT_HELP = {
|
||||||
|
paragraph: FORMATTING_HELP,
|
||||||
|
callout: FORMATTING_HELP,
|
||||||
|
quote: FORMATTING_HELP,
|
||||||
|
button: "The button's label, eg. Register now",
|
||||||
|
image: "Caption shown under the image. Optional.",
|
||||||
|
video: "Caption shown under the video. Optional.",
|
||||||
|
schedule: "Optional intro above the tabs. " + FORMATTING_HELP,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const TEXT_LABEL = { button: "Label", image: "Caption", video: "Caption", schedule: "Intro" };
|
||||||
|
|
||||||
|
export const HREF_HELP = {
|
||||||
|
paragraph: "Optional. Makes the whole paragraph one link. For a link inside the text, use [text](url).",
|
||||||
|
button: "Where the button goes, eg. /give or https://…",
|
||||||
|
image: "Optional. Makes the image a link.",
|
||||||
|
video: "The video's page, eg. https://www.youtube.com/watch?v=…, or a video file",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const blocksChild = {
|
||||||
|
key: "content_blocks",
|
||||||
|
label: "Content blocks",
|
||||||
|
addLabel: "Add block",
|
||||||
|
preview: "contentBlock",
|
||||||
|
title: (row) => {
|
||||||
|
const label = blockTypeLabel(row.type) || "Block";
|
||||||
|
const text = preview(row.text || row.href || row.media || "", 40);
|
||||||
|
return text ? `${label}: ${text}` : label;
|
||||||
|
},
|
||||||
|
blank: { slot: "body", type: "paragraph", text: "" },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "slot",
|
||||||
|
label: "Shown in",
|
||||||
|
widget: "select",
|
||||||
|
options: [
|
||||||
|
["body", "The page"],
|
||||||
|
["card", "The card (paragraphs only)"],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "type",
|
||||||
|
label: "Type",
|
||||||
|
widget: "select",
|
||||||
|
options: BLOCK_TYPES.map(([value, label]) => [value, label]),
|
||||||
|
help: (row) => BLOCK_TYPES.find(([value]) => value === row?.type)?.[2],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "text",
|
||||||
|
label: (row) => TEXT_LABEL[row?.type] ?? "Text",
|
||||||
|
widget: "textarea",
|
||||||
|
full: true,
|
||||||
|
when: { path: "type", value: TEXT_TYPES },
|
||||||
|
help: (row) => TEXT_HELP[row?.type],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "cite",
|
||||||
|
label: "Attribution",
|
||||||
|
help: "Who said it, eg. Jane Doe, Retreat 2024",
|
||||||
|
full: true,
|
||||||
|
when: { path: "type", value: "quote" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "href",
|
||||||
|
label: "Link",
|
||||||
|
full: true,
|
||||||
|
when: { path: "type", value: ["paragraph", "button", "image", "video"] },
|
||||||
|
help: (row) => HREF_HELP[row?.type],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "media",
|
||||||
|
label: "Image",
|
||||||
|
widget: "image",
|
||||||
|
resolve: mediaUrl,
|
||||||
|
full: true,
|
||||||
|
when: { path: "type", value: ["image", "video"] },
|
||||||
|
help: (row) =>
|
||||||
|
row?.type === "video" ? "Still shown before it plays. Default: YouTube's own thumbnail." : undefined,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "alt",
|
||||||
|
label: "Alt text",
|
||||||
|
full: true,
|
||||||
|
when: { path: "type", value: "image" },
|
||||||
|
help: "Describes the picture for someone who can't see it, eg. Campers around a fire at dusk",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "items",
|
||||||
|
label: "Items",
|
||||||
|
addLabel: "Add item",
|
||||||
|
when: { path: "type", value: ["list", "links", "schedule"] },
|
||||||
|
title: (row) => [row.day, row.time, row.text].filter(Boolean).join(" · ") || "New item",
|
||||||
|
blank: { text: "" },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "day",
|
||||||
|
label: "Day",
|
||||||
|
help: "The tab it's under, eg. Friday. Entries with the same day share a tab, in this order.",
|
||||||
|
when: SCHEDULE_ENTRY,
|
||||||
|
},
|
||||||
|
{ path: "time", label: "Time", help: "eg. 7:00pm, or 9:00 to 10:30am", when: SCHEDULE_ENTRY },
|
||||||
|
{ path: "text", label: "Text", required: true, help: "Schedules: the entry's title" },
|
||||||
|
{
|
||||||
|
path: "location",
|
||||||
|
label: "Location",
|
||||||
|
help: "eg. Main Hall",
|
||||||
|
when: SCHEDULE_ENTRY,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "person_id",
|
||||||
|
label: "Person",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "people",
|
||||||
|
blankLabel: "Default: none",
|
||||||
|
help: "Who hosts or speaks: shown with their photo, linked to their page",
|
||||||
|
when: SCHEDULE_ENTRY,
|
||||||
|
},
|
||||||
|
{ path: "detail", label: "Detail", help: "A line under the text. Lists: shown after the text" },
|
||||||
|
{ path: "url", label: "URL", help: "Blank for plain text. Link buttons need one." },
|
||||||
|
{
|
||||||
|
path: "description",
|
||||||
|
label: "More",
|
||||||
|
widget: "textarea",
|
||||||
|
full: true,
|
||||||
|
help: "Shown when the entry is folded out. " + FORMATTING_HELP,
|
||||||
|
when: SCHEDULE_ENTRY,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "media",
|
||||||
|
label: "Graphic",
|
||||||
|
widget: "image",
|
||||||
|
resolve: mediaUrl,
|
||||||
|
full: true,
|
||||||
|
help: "Optional, in the fold-out: a map of the site, a slide, a poster",
|
||||||
|
when: SCHEDULE_ENTRY,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "media_alt",
|
||||||
|
label: "Graphic description",
|
||||||
|
full: true,
|
||||||
|
help: "For screen readers: what the graphic shows, eg. a map of the camp. Default: skipped as decoration.",
|
||||||
|
when: SCHEDULE_ENTRY,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "map",
|
||||||
|
label: "Map",
|
||||||
|
full: true,
|
||||||
|
help: "Optional, in the fold-out: a place or address for a Google map, eg. Camp Hebron, Halifax PA",
|
||||||
|
when: SCHEDULE_ENTRY,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
120
src/lib/adminSchema/siteSettings.ts
Normal file
120
src/lib/adminSchema/siteSettings.ts
Normal file
|
|
@ -0,0 +1,120 @@
|
||||||
|
import siteConfiguration from "../../../site.json";
|
||||||
|
import { mediaUrl } from "../media.ts";
|
||||||
|
|
||||||
|
/* ── Site settings (035_site_settings.sql) ───────────────────────
|
||||||
|
Overrides for site.json, superadmins only: every blank falls back
|
||||||
|
to what site.json says, which is shown as the default. */
|
||||||
|
const SITE_PAGES: [string, string][] = Object.entries(siteConfiguration.pages).map(
|
||||||
|
([path, page]) => [path, `${page.title} (${path})`],
|
||||||
|
);
|
||||||
|
|
||||||
|
export const siteSettings = {
|
||||||
|
key: "site_settings",
|
||||||
|
label: "Site settings",
|
||||||
|
singular: "site settings",
|
||||||
|
idLabel: "Settings",
|
||||||
|
singleton: "site",
|
||||||
|
writeRole: "superadmin",
|
||||||
|
|
||||||
|
list: { columns: [], filters: [] },
|
||||||
|
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
legend: "The site",
|
||||||
|
note: "Anything left blank uses site.json, so the build and these settings agree until you change one.",
|
||||||
|
fields: [
|
||||||
|
{ path: "site_name", label: "Site name", help: `Default: ${siteConfiguration.title}` },
|
||||||
|
{
|
||||||
|
path: "description",
|
||||||
|
label: "Description",
|
||||||
|
widget: "textarea",
|
||||||
|
full: true,
|
||||||
|
help: "Search engines and link previews show this for pages without their own. Default: site.json's, or the front page's subhead.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "preview_image",
|
||||||
|
label: "Preview image",
|
||||||
|
widget: "image",
|
||||||
|
resolve: mediaUrl,
|
||||||
|
full: true,
|
||||||
|
help: "Shown when a page without its own image is shared. 1200 × 630 works everywhere.",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Icons",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "favicon",
|
||||||
|
label: "Favicon",
|
||||||
|
widget: "image",
|
||||||
|
resolve: mediaUrl,
|
||||||
|
full: true,
|
||||||
|
help: "The browser-tab icon: a square PNG (512px) or an SVG. Keep original when uploading an SVG.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "apple_touch_icon",
|
||||||
|
label: "Home-screen icon",
|
||||||
|
widget: "image",
|
||||||
|
resolve: mediaUrl,
|
||||||
|
full: true,
|
||||||
|
help: "For iPhones saving the site to their home screen: a square PNG, 180px, no transparency.",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Search engines",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "indexing",
|
||||||
|
label: "Let search engines list this site",
|
||||||
|
widget: "select",
|
||||||
|
options: [
|
||||||
|
["on", "On: pages can appear in Google"],
|
||||||
|
["off", "Off: hidden from search (use on the dev server)"],
|
||||||
|
],
|
||||||
|
blankLabel: `Default: site.json (${siteConfiguration.robots?.index === false ? "off" : "on"})`,
|
||||||
|
help: "Applies to this server's database only, so dev can be off while production is on.",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Privacy",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "privacy_email",
|
||||||
|
label: "Privacy contact email",
|
||||||
|
help: `The Privacy page gives this for privacy questions and data requests, eg. privacy@nextgenerationofunity.org. ${
|
||||||
|
siteConfiguration.privacyEmail ? `Default: ${siteConfiguration.privacyEmail}` : "Default: none, the page offers its request form only"
|
||||||
|
}.`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "pages",
|
||||||
|
label: "Page titles and intros",
|
||||||
|
note: "Change a static page's heading and intro, which are also its search title and description. Blank fields keep site.json's.",
|
||||||
|
addLabel: "Change a page",
|
||||||
|
title: (row) => SITE_PAGES.find(([path]) => path === row.path)?.[1] ?? "New page",
|
||||||
|
blank: { path: "", title: "", description: "" },
|
||||||
|
fields: [
|
||||||
|
{ path: "path", label: "Page", widget: "select", options: SITE_PAGES, required: true },
|
||||||
|
{
|
||||||
|
path: "title",
|
||||||
|
label: "Title",
|
||||||
|
help: (row) => (row?.path ? `Default: ${siteConfiguration.pages[row.path]?.title ?? ""}` : undefined),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "description",
|
||||||
|
label: "Intro",
|
||||||
|
widget: "textarea",
|
||||||
|
full: true,
|
||||||
|
help: (row) => (row?.path ? `Default: ${siteConfiguration.pages[row.path]?.description ?? ""}` : undefined),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
83
src/lib/adminSchema/teams.ts
Normal file
83
src/lib/adminSchema/teams.ts
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
import { mediaUrl } from "../media.ts";
|
||||||
|
import { PUBLISH_FIELDS, AFFILIATION_ROLE_FIELDS, linksChild, blocksChild } from "./shared.ts";
|
||||||
|
|
||||||
|
/* ── Teams ───────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
export const teams = {
|
||||||
|
key: "teams",
|
||||||
|
label: "Teams",
|
||||||
|
singular: "team",
|
||||||
|
idLabel: "URL ID",
|
||||||
|
// teams.id is a global primary key, not scoped to the org, so
|
||||||
|
// 'board' can only exist once across the whole site. Composing
|
||||||
|
// the slug from both fields is what keeps NGU's board and the
|
||||||
|
// Northwest's board from colliding.
|
||||||
|
slugFrom: ["org_id", "name"],
|
||||||
|
|
||||||
|
list: {
|
||||||
|
columns: [
|
||||||
|
{ key: "name", label: "Name", primary: true },
|
||||||
|
{ key: "org_id", label: "Organization" },
|
||||||
|
{ key: "tagline", label: "Tagline" },
|
||||||
|
{ key: "is_published", label: "Live", widget: "bool" },
|
||||||
|
{ key: "is_listed", label: "Listed", widget: "bool" },
|
||||||
|
],
|
||||||
|
filters: [
|
||||||
|
{ key: "org_id", label: "Organization", optionsFrom: "organizations" },
|
||||||
|
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
||||||
|
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
legend: "Identity",
|
||||||
|
note:
|
||||||
|
"Pick the organization first: the id is built from it, " +
|
||||||
|
"and it can't be changed once anyone is filed under this team.",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "org_id",
|
||||||
|
label: "Organization",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "organizations",
|
||||||
|
required: true,
|
||||||
|
help: "Who this team belongs to",
|
||||||
|
},
|
||||||
|
{ path: "name", label: "Name", required: true, help: "Board, Leadership Team" },
|
||||||
|
{ path: "tagline", label: "Tagline", full: true },
|
||||||
|
{ path: "color", label: "Colour", widget: "color" },
|
||||||
|
{ path: "logo", label: "Logo", widget: "image", resolve: mediaUrl, full: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ legend: "Publishing", fields: PUBLISH_FIELDS },
|
||||||
|
],
|
||||||
|
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "members",
|
||||||
|
label: "Members",
|
||||||
|
addLabel: "Add member",
|
||||||
|
note:
|
||||||
|
"This order is the order they appear on the site. Owners are " +
|
||||||
|
"still listed first, in this order among themselves.",
|
||||||
|
title: (row, options) =>
|
||||||
|
[options?.people?.find((p) => p.id === row.person_id)?.label, row.title]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(" · ") || "New member",
|
||||||
|
blank: { person_id: "", role: "member", is_public: 1, is_owner: 0 },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "person_id",
|
||||||
|
label: "Person",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "people",
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
...AFFILIATION_ROLE_FIELDS,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
linksChild,
|
||||||
|
blocksChild,
|
||||||
|
],
|
||||||
|
};
|
||||||
152
src/lib/adminSchema/timeline.ts
Normal file
152
src/lib/adminSchema/timeline.ts
Normal file
|
|
@ -0,0 +1,152 @@
|
||||||
|
/* ── Timeline ─────────────────────────────────────────── */
|
||||||
|
|
||||||
|
// The only entity with no slug: the table assigns the id, because an
|
||||||
|
// entry referencing an event has no name of its own and one gets
|
||||||
|
// created every time somebody ticks a checkbox. `idKind: "auto"` tells
|
||||||
|
// EntityEdit to show the id rather than ask for it.
|
||||||
|
//
|
||||||
|
// Most rows here are created from an event or organization page, not
|
||||||
|
// this one. What this page is for: hand-authored milestones with no
|
||||||
|
// record behind them, 'people' entries about a team forming, and fixing
|
||||||
|
// up the entries the checkboxes made.
|
||||||
|
export const timeline = {
|
||||||
|
key: "timeline",
|
||||||
|
label: "Timeline",
|
||||||
|
singular: "entry",
|
||||||
|
idLabel: "Entry",
|
||||||
|
idKind: "auto",
|
||||||
|
titleFrom: "title",
|
||||||
|
|
||||||
|
list: {
|
||||||
|
columns: [
|
||||||
|
{ key: "title", label: "Title", primary: true },
|
||||||
|
{ key: "occurred_on", label: "Date" },
|
||||||
|
{ key: "kind", label: "Kind" },
|
||||||
|
{ key: "ref_id", label: "References" },
|
||||||
|
{ key: "is_featured", label: "Featured", widget: "bool" },
|
||||||
|
{ key: "is_published", label: "Live", widget: "bool" },
|
||||||
|
],
|
||||||
|
filters: [
|
||||||
|
{
|
||||||
|
key: "kind",
|
||||||
|
label: "Kind",
|
||||||
|
options: ["milestone", "event", "organization", "award", "people"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "ref_kind",
|
||||||
|
label: "References",
|
||||||
|
options: ["event", "organization", "award", "person", "team"],
|
||||||
|
},
|
||||||
|
{ key: "is_featured", label: "Featured", options: [["1", "Featured"], ["0", "Normal"]] },
|
||||||
|
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
legend: "What this is",
|
||||||
|
note:
|
||||||
|
"An entry either points at a record or stands on its own. " +
|
||||||
|
"Pointing at one means its title, date and logo come from that " +
|
||||||
|
"record and nothing is copied, so editing the record updates this.",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "kind",
|
||||||
|
label: "Kind",
|
||||||
|
widget: "select",
|
||||||
|
options: ["milestone", "event", "organization", "award", "people"],
|
||||||
|
required: true,
|
||||||
|
help: "Drives the marker and the layout. 'people' renders a roster",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "ref_kind",
|
||||||
|
label: "Points at",
|
||||||
|
widget: "select",
|
||||||
|
options: ["event", "organization", "award", "person", "team"],
|
||||||
|
blankLabel: "Default: nothing",
|
||||||
|
help: "Changing this leaves the record below orphaned, pick a new one",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "ref_id",
|
||||||
|
label: "Record",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "record_refs",
|
||||||
|
blankLabel: "Default: none",
|
||||||
|
// One flat list of every referenceable row, narrowed to the
|
||||||
|
// kind chosen above. Five dropdowns of which four are always
|
||||||
|
// wrong would be worse.
|
||||||
|
filterBy: (option, row) => option.kind === row.ref_kind,
|
||||||
|
help: "Only records of the kind chosen above",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "When",
|
||||||
|
note:
|
||||||
|
"Blank takes the referenced record's own date. Precision is what " +
|
||||||
|
"says how much of the date to believe, a backfilled entry that " +
|
||||||
|
"only knows the year should say so.",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "occurred_on",
|
||||||
|
label: "Date",
|
||||||
|
help: "2012, 2012-06 or 2012-06-14",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "precision",
|
||||||
|
label: "Precision",
|
||||||
|
widget: "select",
|
||||||
|
options: ["year", "month", "day"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Text",
|
||||||
|
note: "All optional. Blank uses the referenced record's own wording.",
|
||||||
|
fields: [
|
||||||
|
{ path: "title", label: "Title", full: true },
|
||||||
|
{ path: "blurb", label: "Blurb", widget: "textarea", full: true },
|
||||||
|
{ path: "meta", label: "Secondary line", help: "Region, venue, recipient" },
|
||||||
|
{ path: "link_url", label: "Link", help: "Blank links to the record's own page" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
legend: "Publishing",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "is_featured",
|
||||||
|
label: "Featured",
|
||||||
|
widget: "checkbox",
|
||||||
|
help: "Shown large, above the month list for its year",
|
||||||
|
},
|
||||||
|
{ path: "is_published", label: "Published", widget: "checkbox" },
|
||||||
|
{ path: "sort_order", label: "Sort order", widget: "number" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: "people",
|
||||||
|
label: "People",
|
||||||
|
addLabel: "Add person",
|
||||||
|
note:
|
||||||
|
"For an entry about people. A 'people' entry pointing at a team " +
|
||||||
|
"already shows that team's members, this is for the cases where " +
|
||||||
|
"the list is editorial rather than structural.",
|
||||||
|
title: (row, options) =>
|
||||||
|
options?.people?.find((p) => p.id === row.person_id)?.label ?? "New person",
|
||||||
|
blank: { person_id: "" },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
path: "person_id",
|
||||||
|
label: "Person",
|
||||||
|
widget: "select",
|
||||||
|
optionsFrom: "people",
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{ path: "note", label: "Note", help: "Founding lead, first chair" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
@ -83,7 +83,7 @@ export function RequireAuth() {
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<div className="flex min-h-screen items-center justify-center text-[#4a6b72]">
|
<div className="flex min-h-screen items-center justify-center text-muted">
|
||||||
Checking your session…
|
Checking your session…
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
39
src/lib/color.ts
Normal file
39
src/lib/color.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
|
COLOR
|
||||||
|
|
||||||
|
Two helpers for colours that arrive as data (a page's accent, an
|
||||||
|
event's or region's colour), so they work with the theme tokens
|
||||||
|
in index.css as well as with hex.
|
||||||
|
|
||||||
|
withAlpha(color, 20) is that colour at 20% opacity, for tints and
|
||||||
|
borders. It replaces `${color}33`, which only works on hex.
|
||||||
|
|
||||||
|
accentText(color) is that colour as text: itself in light mode,
|
||||||
|
mixed halfway to white in dark mode (--accent-text-mix), so an
|
||||||
|
accent picked for a white page still reads on a dark one.
|
||||||
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
export const withAlpha = (color: string, percent: number): string =>
|
||||||
|
`color-mix(in srgb, ${color} ${percent}%, transparent)`
|
||||||
|
|
||||||
|
export const accentText = (color: string): string =>
|
||||||
|
`color-mix(in srgb, ${color} var(--accent-text-mix), #ffffff)`
|
||||||
|
|
||||||
|
/* Text for on top of a colour that arrives as data: white or deep
|
||||||
|
ink, whichever has more contrast (WCAG), so a pale colour an admin
|
||||||
|
picks still gets readable text. Anything that isn't #rrggbb (a
|
||||||
|
CSS variable, say) gets white, which suits the site's own dark
|
||||||
|
accents. */
|
||||||
|
export function readableOn(color: string): string {
|
||||||
|
const hex = /^#([0-9a-f]{6})$/i.exec(color ?? '')?.[1]
|
||||||
|
if (!hex) return '#ffffff'
|
||||||
|
const channel = (i: number) => {
|
||||||
|
const c = parseInt(hex.slice(i, i + 2), 16) / 255
|
||||||
|
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4
|
||||||
|
}
|
||||||
|
const lum = 0.2126 * channel(0) + 0.7152 * channel(2) + 0.0722 * channel(4)
|
||||||
|
const INK_LUM = 0.0161 // #04262e
|
||||||
|
const onWhite = 1.05 / (lum + 0.05)
|
||||||
|
const onInk = (lum + 0.05) / (INK_LUM + 0.05)
|
||||||
|
return onWhite >= onInk ? '#ffffff' : '#04262e'
|
||||||
|
}
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
hand a file to <video> and a link to an <iframe>.
|
hand a file to <video> and a link to an <iframe>.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { heroVideo } from './media.ts'
|
import { mediaUrl } from './media.ts'
|
||||||
|
|
||||||
const VIDEO_FILE = /\.(mp4|webm|m4v|mov|ogv)$/i
|
const VIDEO_FILE = /\.(mp4|webm|m4v|mov|ogv)$/i
|
||||||
|
|
||||||
|
|
@ -91,7 +91,7 @@ export function videoSource(raw?: string | null): VideoSource | null {
|
||||||
|
|
||||||
if (VIDEO_FILE.test(value.split(/[?#]/)[0])) {
|
if (VIDEO_FILE.test(value.split(/[?#]/)[0])) {
|
||||||
if (/^https:\/\//i.test(value) || !/^[a-z][a-z0-9+.-]*:/i.test(value)) {
|
if (/^https:\/\//i.test(value) || !/^[a-z][a-z0-9+.-]*:/i.test(value)) {
|
||||||
const src = heroVideo(value)
|
const src = mediaUrl(value)
|
||||||
if (src) return { kind: 'file', src }
|
if (src) return { kind: 'file', src }
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
|
|
||||||
|
|
@ -152,8 +152,6 @@ export function refHref(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* What to call the kind in a breadcrumb or a back link. */
|
|
||||||
|
|
||||||
/* Where "back" goes from a record page. A chapter belongs to
|
/* Where "back" goes from a record page. A chapter belongs to
|
||||||
/community, a retreat to /retreats. */
|
/community, a retreat to /retreats. */
|
||||||
export function orgListHref(kind?: string | null): { to: string; label: string } {
|
export function orgListHref(kind?: string | null): { to: string; label: string } {
|
||||||
|
|
|
||||||
|
|
@ -24,72 +24,17 @@
|
||||||
|
|
||||||
const ABSOLUTE = /^(https?:|\/|data:)/
|
const ABSOLUTE = /^(https?:|\/|data:)/
|
||||||
|
|
||||||
function inDir(dir: string) {
|
const UPLOADS = '/uploads'
|
||||||
return (file?: string | null): string | null => {
|
|
||||||
if (!file) return null
|
|
||||||
if (ABSOLUTE.test(file)) return file
|
|
||||||
return `${dir}/${file}`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const UPLOADS = '/uploads'
|
/* Any record image or media field (photos, logos, backgrounds, hero
|
||||||
|
slides and video files, block and card images, blog covers), and
|
||||||
const inUploads = inDir(UPLOADS)
|
the timeline's and featured cards' `{ file, kind }` logos by their
|
||||||
|
file. One rule for all of them; if a kind ever needs its own
|
||||||
/* One helper per field, all the same rule, so a caller says what the
|
directory, that's the time to add a parameter. */
|
||||||
image is and a future exception is one line here. */
|
export function mediaUrl(file?: string | null): string | null {
|
||||||
export const personPhoto = inUploads
|
|
||||||
export const eventLogo = inUploads
|
|
||||||
export const eventBackground = inUploads
|
|
||||||
export const orgLogo = inUploads
|
|
||||||
export const teamLogo = inUploads
|
|
||||||
export const awardLogo = inUploads
|
|
||||||
|
|
||||||
/* front_page_slides.media, the hero's photos. */
|
|
||||||
export const heroPhoto = inUploads
|
|
||||||
|
|
||||||
/* front_page.video_url when it names a file rather than a link.
|
|
||||||
Videos can't be uploaded through the media library, so a file is
|
|
||||||
one copied into the uploads directory by hand. */
|
|
||||||
export const heroVideo = inUploads
|
|
||||||
|
|
||||||
/* content_blocks.media and content_block_items.media. */
|
|
||||||
export const blockMedia = inUploads
|
|
||||||
|
|
||||||
/* featured_cards.image. */
|
|
||||||
export const featuredImage = inUploads
|
|
||||||
|
|
||||||
/* blog_posts.cover_image and guest_photo. */
|
|
||||||
export const blogImage = inUploads
|
|
||||||
|
|
||||||
/* ── By record kind ────────────────────────────────────────────
|
|
||||||
The timeline sends `logo: { file, kind }` rather than a path,
|
|
||||||
because v_timeline COALESCEs across five tables and only the
|
|
||||||
ref_kind says which one the filename came from. Featured cards
|
|
||||||
send the same shape. Every kind resolves to the uploads directory
|
|
||||||
today; the map is what lets one kind differ later.
|
|
||||||
───────────────────────────────────────────────────────────── */
|
|
||||||
|
|
||||||
const BY_KIND: Record<string, (file?: string | null) => string | null> = {
|
|
||||||
event: eventLogo,
|
|
||||||
organization: orgLogo,
|
|
||||||
team: teamLogo,
|
|
||||||
award: awardLogo,
|
|
||||||
person: personPhoto,
|
|
||||||
// Featured cards (loadFeaturedCards in shape.js) add two of their own.
|
|
||||||
'event-background': eventBackground,
|
|
||||||
featured: featuredImage,
|
|
||||||
}
|
|
||||||
|
|
||||||
export function logoForKind(
|
|
||||||
kind?: string | null,
|
|
||||||
file?: string | null,
|
|
||||||
): string | null {
|
|
||||||
if (!file) return null
|
if (!file) return null
|
||||||
// An unrecognised kind still renders: a filename with no home
|
if (ABSOLUTE.test(file)) return file
|
||||||
// directory is a bug, but a broken <img> says so louder than a
|
return `${UPLOADS}/${file}`
|
||||||
// silently absent one.
|
|
||||||
return (BY_KIND[kind ?? ''] ?? blockMedia)(file)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initials for a photo that is missing or fails to load. Same
|
/* Initials for a photo that is missing or fails to load. Same
|
||||||
|
|
|
||||||
5
src/lib/motion.ts
Normal file
5
src/lib/motion.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
/* Smooth scrolling, unless the visitor has asked for less motion.
|
||||||
|
index.css covers CSS scrolling; this is for scrollIntoView and
|
||||||
|
scrollTo calls, which don't read that setting themselves. */
|
||||||
|
export const scrollBehavior = (): ScrollBehavior =>
|
||||||
|
window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth'
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
fetch.
|
fetch.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
import { isBadId, orgHref } from "./hrefs.ts";
|
||||||
import { useResource } from "./useResource.ts";
|
import { useResource } from "./useResource.ts";
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -41,20 +42,15 @@ export function useOrganizations(kind) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Where an organization's page lives ────────────────────────
|
/* ── Where an organization's page lives ────────────────────────
|
||||||
One place to change when routes move. Kinds with no page of
|
The route is hrefs.ts's (orgHref). A list links only the kinds
|
||||||
their own return null, and a list should render no link rather
|
with a page of their own, and renders no link rather than a dead
|
||||||
than a dead one.
|
one for the rest (NGU itself) or a bad id.
|
||||||
───────────────────────────────────────────────────────────── */
|
───────────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
const PATHS = {
|
const WITH_PAGE = new Set(["region", "chapter", "partner"]);
|
||||||
region: "/regions",
|
|
||||||
chapter: "/chapters",
|
|
||||||
partner: "/partners",
|
|
||||||
};
|
|
||||||
|
|
||||||
export function orgPath(org) {
|
export function orgPath(org) {
|
||||||
const base = PATHS[org?.kind];
|
return WITH_PAGE.has(org?.kind) && !isBadId(org.id) ? orgHref(org.id, org.kind) : null;
|
||||||
return base ? `${base}/${org.id}` : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── "AK, ID, MT, OR, UT (Salt Lake City area), WA" ────────────
|
/* ── "AK, ID, MT, OR, UT (Salt Lake City area), WA" ────────────
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import siteConfiguration from '../../site.json'
|
||||||
|
|
||||||
type PageText = { title: string; description: string }
|
type PageText = { title: string; description: string }
|
||||||
|
|
||||||
type SiteText = { title?: string; pages?: Record<string, PageText> }
|
type SiteText = { title?: string; pages?: Record<string, PageText>; privacyEmail?: string }
|
||||||
|
|
||||||
/* What the server wrote into the page, if it did. */
|
/* What the server wrote into the page, if it did. */
|
||||||
const fromServer: SiteText =
|
const fromServer: SiteText =
|
||||||
|
|
@ -34,12 +34,15 @@ export const SITE_NAME: string = fromServer.title || siteConfiguration.title
|
||||||
|
|
||||||
export const SITE_ORIGIN: string = siteConfiguration.url
|
export const SITE_ORIGIN: string = siteConfiguration.url
|
||||||
|
|
||||||
|
/** Where privacy questions and data requests go (Panel → Site
|
||||||
|
* settings, else site.json). Blank: the Privacy page's form only. */
|
||||||
|
export const PRIVACY_EMAIL: string = fromServer.privacyEmail ?? siteConfiguration.privacyEmail
|
||||||
|
|
||||||
/** A site path as a full URL on the live site. */
|
/** A site path as a full URL on the live site. */
|
||||||
export const siteUrl = (path: string): string => new URL(path, SITE_ORIGIN).href
|
export const siteUrl = (path: string): string => new URL(path, SITE_ORIGIN).href
|
||||||
|
|
||||||
const PAGES: Record<string, PageText> = { ...siteConfiguration.pages, ...fromServer.pages }
|
const PAGES: Record<string, PageText> = { ...siteConfiguration.pages, ...fromServer.pages }
|
||||||
|
|
||||||
/** The static pages site.json knows, for the admin's page list. */
|
|
||||||
/** A static page's title and intro, from site.json's "pages". */
|
/** A static page's title and intro, from site.json's "pages". */
|
||||||
export function sitePage(path: string): PageText {
|
export function sitePage(path: string): PageText {
|
||||||
const page = PAGES[path]
|
const page = PAGES[path]
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { refHref } from './hrefs.ts'
|
import { refHref } from './hrefs.ts'
|
||||||
import { logoForKind, personPhoto } from './media.ts'
|
import { mediaUrl } from './media.ts'
|
||||||
import type { TimelineItem } from './timeline.ts'
|
import type { TimelineItem } from './timeline.ts'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -58,18 +58,9 @@ export function hrefFor(item: TimelineItem): string | null {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The entry's image, resolved against the directory for whatever
|
* The entry's image, whatever kind of record the filename came from.
|
||||||
* kind of record the filename came from.
|
|
||||||
*/
|
*/
|
||||||
export function logoSrc(item: TimelineItem): string | null {
|
export function logoSrc(item: TimelineItem): string | null {
|
||||||
if (!item.logo) return null
|
if (!item.logo) return null
|
||||||
return logoForKind(item.logo.kind, item.logo.file)
|
return mediaUrl(item.logo.file)
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A roster member's photo. Same rule as everywhere else, the API
|
|
||||||
* sends a bare filename.
|
|
||||||
*/
|
|
||||||
export function photoSrc(photo?: string | null): string | null {
|
|
||||||
return personPhoto(photo)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,6 @@ export type EventRecord = {
|
||||||
org_logo?: string | null
|
org_logo?: string | null
|
||||||
event_logo?: string | null
|
event_logo?: string | null
|
||||||
color?: string | null
|
color?: string | null
|
||||||
gradient?: string | null
|
|
||||||
/** Behind the card. See 029_event_card_image.sql. */
|
/** Behind the card. See 029_event_card_image.sql. */
|
||||||
card_image?: string | null
|
card_image?: string | null
|
||||||
/* In billing order. The first is the one `color` and `org_logo`
|
/* In billing order. The first is the one `color` and `org_logo`
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ export type FeaturedCard = {
|
||||||
eyebrow?: string | null
|
eyebrow?: string | null
|
||||||
title?: string | null
|
title?: string | null
|
||||||
blurb?: string | null
|
blurb?: string | null
|
||||||
/** Resolve with logoForKind in media.ts. */
|
/** Resolve the file with mediaUrl in media.ts. */
|
||||||
image: { file: string; kind: string } | null
|
image: { file: string; kind: string } | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,83 +1,17 @@
|
||||||
/**
|
/**
|
||||||
* Loads the history timeline from `GET /api/history`.
|
* Loads the history timeline from `GET /api/history`, through
|
||||||
|
* useRecord (its `items`), so it shares the cache, the reload that
|
||||||
|
* invalidates first, and the error handling with every detail page.
|
||||||
*
|
*
|
||||||
* Goes through the shared client, so the request is deduped and cached
|
* The API also sends `undated`, the number of published entries it
|
||||||
* for 60s like every other read. Two consequences worth knowing:
|
* left out for having no date. Nothing shows it; read it here if the
|
||||||
*
|
* admin ever wants a warning.
|
||||||
* · `reload` has to invalidate before it refetches. Without that, the
|
|
||||||
* retry button inside the TTL would hand back the same settled
|
|
||||||
* promise and look like it did nothing. A *failed* request is
|
|
||||||
* already evicted by the client, so this matters for the refresh
|
|
||||||
* case rather than the error case.
|
|
||||||
*
|
|
||||||
* · there's no AbortController. `get` shares one promise between
|
|
||||||
* callers, so aborting on unmount would cancel someone else's
|
|
||||||
* request. The `live` flag drops the result instead.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* `undated` is the number of published entries the API left out because
|
|
||||||
* nothing gave them a date. Not rendered publicly, a visitor can't act
|
|
||||||
* on it, but returned so it's reachable if you want a warning in the
|
|
||||||
* admin later.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { useCallback, useEffect, useState } from 'react'
|
|
||||||
import { get, invalidate, ApiError } from './api.ts'
|
|
||||||
import type { TimelineItem } from './timeline.ts'
|
import type { TimelineItem } from './timeline.ts'
|
||||||
|
import { useRecord } from './useRecord.ts'
|
||||||
|
|
||||||
const PATH = '/history'
|
export function useHistory() {
|
||||||
|
const { data, loading, error, reload } = useRecord<TimelineItem[]>('/history', 'items')
|
||||||
type HistoryResponse = {
|
return { items: data ?? [], loading, error, reload }
|
||||||
items?: TimelineItem[]
|
|
||||||
undated?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
type State = {
|
|
||||||
items: TimelineItem[]
|
|
||||||
undated: number
|
|
||||||
loading: boolean
|
|
||||||
error: string | null
|
|
||||||
reload: () => void
|
|
||||||
}
|
|
||||||
|
|
||||||
export function useHistory(): State {
|
|
||||||
const [items, setItems] = useState<TimelineItem[]>([])
|
|
||||||
const [undated, setUndated] = useState(0)
|
|
||||||
const [loading, setLoading] = useState(true)
|
|
||||||
const [error, setError] = useState<string | null>(null)
|
|
||||||
const [attempt, setAttempt] = useState(0)
|
|
||||||
|
|
||||||
const reload = useCallback(() => {
|
|
||||||
invalidate(PATH)
|
|
||||||
setAttempt((n) => n + 1)
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
let live = true
|
|
||||||
|
|
||||||
async function load() {
|
|
||||||
setLoading(true)
|
|
||||||
setError(null)
|
|
||||||
try {
|
|
||||||
const data: HistoryResponse = await get(PATH)
|
|
||||||
if (!live) return
|
|
||||||
setItems(Array.isArray(data?.items) ? data.items : [])
|
|
||||||
setUndated(Number(data?.undated) || 0)
|
|
||||||
} catch (err) {
|
|
||||||
if (!live) return
|
|
||||||
setError(
|
|
||||||
err instanceof ApiError ? err.message : "Couldn't reach the server.",
|
|
||||||
)
|
|
||||||
} finally {
|
|
||||||
if (live) setLoading(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
load()
|
|
||||||
return () => {
|
|
||||||
live = false
|
|
||||||
}
|
|
||||||
}, [attempt])
|
|
||||||
|
|
||||||
return { items, undated, loading, error, reload }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* useRecord, one record from one endpoint, on the useHistory
|
* useRecord, one record (one top-level key) from one endpoint.
|
||||||
* pattern.
|
|
||||||
*
|
*
|
||||||
* Named for what it returns, and deliberately not useResource:
|
* Named for what it returns, and deliberately not useResource:
|
||||||
* src/lib/useResource.ts is a different hook, it hands back the
|
* src/lib/useResource.ts is a different hook, it hands back the
|
||||||
|
|
@ -21,7 +20,7 @@
|
||||||
* out would silently use a stale closure. A string has neither
|
* out would silently use a stale closure. A string has neither
|
||||||
* problem.
|
* problem.
|
||||||
*
|
*
|
||||||
* Carried over from useHistory, and worth restating:
|
* Worth knowing:
|
||||||
*
|
*
|
||||||
* · `reload` invalidates before it refetches. Without that, the
|
* · `reload` invalidates before it refetches. Without that, the
|
||||||
* retry button inside the 60s TTL hands back the same settled
|
* retry button inside the 60s TTL hands back the same settled
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,11 @@ import PageShell from '../components/PageShell.tsx'
|
||||||
import PageState from '../components/PageState.tsx'
|
import PageState from '../components/PageState.tsx'
|
||||||
import { useAward, type Recipient } from '../lib/useContent.ts'
|
import { useAward, type Recipient } from '../lib/useContent.ts'
|
||||||
import { eventHref, orgHref, personHref } from '../lib/hrefs.ts'
|
import { eventHref, orgHref, personHref } from '../lib/hrefs.ts'
|
||||||
import { awardLogo, initials, personPhoto } from '../lib/media.ts'
|
import { mediaUrl, initials } from '../lib/media.ts'
|
||||||
|
import { accentText } from '../lib/color.ts'
|
||||||
|
|
||||||
const TEAL = '#0f7183'
|
const TEAL = '#0f7183'
|
||||||
const BODY = '#4a6b72'
|
const BODY = 'var(--color-muted)'
|
||||||
|
|
||||||
export default function AwardDetail() {
|
export default function AwardDetail() {
|
||||||
const { id } = useParams()
|
const { id } = useParams()
|
||||||
|
|
@ -46,7 +47,7 @@ export default function AwardDetail() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const accent = TEAL
|
const accent = TEAL
|
||||||
const logo = awardLogo(award.logo)
|
const logo = mediaUrl(award.logo)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageShell
|
<PageShell
|
||||||
|
|
@ -61,7 +62,7 @@ export default function AwardDetail() {
|
||||||
? 'Nobody has received this yet.'
|
? 'Nobody has received this yet.'
|
||||||
: undefined,
|
: undefined,
|
||||||
accent,
|
accent,
|
||||||
background: '#ffffff',
|
background: 'var(--color-surface)',
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6 space-y-8">
|
<div className="max-w-6xl mx-auto px-6 space-y-8">
|
||||||
<div className="flex flex-wrap items-center gap-x-6 gap-y-3 text-sm">
|
<div className="flex flex-wrap items-center gap-x-6 gap-y-3 text-sm">
|
||||||
|
|
@ -75,7 +76,7 @@ export default function AwardDetail() {
|
||||||
<Link
|
<Link
|
||||||
to={orgHref(award.org.id, award.org.kind)}
|
to={orgHref(award.org.id, award.org.kind)}
|
||||||
className="font-medium hover:underline"
|
className="font-medium hover:underline"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
{award.org.name}
|
{award.org.name}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -104,7 +105,7 @@ export default function AwardDetail() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function RecipientRow({ recipient, accent }: { recipient: Recipient; accent: string }) {
|
function RecipientRow({ recipient, accent }: { recipient: Recipient; accent: string }) {
|
||||||
const photo = personPhoto(recipient.photo)
|
const photo = mediaUrl(recipient.photo)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex gap-5">
|
<div className="flex gap-5">
|
||||||
|
|
@ -131,7 +132,7 @@ function RecipientRow({ recipient, accent }: { recipient: Recipient; accent: str
|
||||||
<Link
|
<Link
|
||||||
to={personHref(recipient.id)}
|
to={personHref(recipient.id)}
|
||||||
className="hover:underline"
|
className="hover:underline"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
{recipient.name}
|
{recipient.name}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -150,7 +151,7 @@ function RecipientRow({ recipient, accent }: { recipient: Recipient; accent: str
|
||||||
<Link
|
<Link
|
||||||
to={eventHref(recipient.event.id)}
|
to={eventHref(recipient.event.id)}
|
||||||
className="hover:underline"
|
className="hover:underline"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
{recipient.event.title}
|
{recipient.event.title}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,12 @@ import PageShell, { type ShellSection } from '../components/PageShell.tsx'
|
||||||
import PageState from '../components/PageState.tsx'
|
import PageState from '../components/PageState.tsx'
|
||||||
import ContentBlocks from '../components/ContentBlocks.tsx'
|
import ContentBlocks from '../components/ContentBlocks.tsx'
|
||||||
import PeopleTiles from '../components/PeopleTiles.tsx'
|
import PeopleTiles from '../components/PeopleTiles.tsx'
|
||||||
import { blogImage, personPhoto } from '../lib/media.ts'
|
import { mediaUrl } from '../lib/media.ts'
|
||||||
import { postDate, useBlogPost } from '../lib/useBlog.ts'
|
import { postDate, useBlogPost } from '../lib/useBlog.ts'
|
||||||
|
import { accentText } from '../lib/color.ts'
|
||||||
|
|
||||||
const ACCENT = '#0f7183'
|
const ACCENT = '#0f7183'
|
||||||
const BODY = '#4a6b72'
|
const BODY = 'var(--color-muted)'
|
||||||
|
|
||||||
/* Where "back" goes: the section on the Community page. */
|
/* Where "back" goes: the section on the Community page. */
|
||||||
const BACK = { to: '/community#blog', label: 'Community Blog' }
|
const BACK = { to: '/community#blog', label: 'Community Blog' }
|
||||||
|
|
@ -44,7 +45,7 @@ export default function BlogPost() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const date = postDate(post.published_on)
|
const date = postDate(post.published_on)
|
||||||
const cover = blogImage(post.cover_image)
|
const cover = mediaUrl(post.cover_image)
|
||||||
const byline = [
|
const byline = [
|
||||||
...post.authors.map((author) => author.name),
|
...post.authors.map((author) => author.name),
|
||||||
...(post.guest ? [post.guest.name] : []),
|
...(post.guest ? [post.guest.name] : []),
|
||||||
|
|
@ -56,9 +57,9 @@ export default function BlogPost() {
|
||||||
name: author.name,
|
name: author.name,
|
||||||
tagline: author.tagline,
|
tagline: author.tagline,
|
||||||
pronouns: author.pronouns,
|
pronouns: author.pronouns,
|
||||||
photo: personPhoto(author.photo),
|
photo: mediaUrl(author.photo),
|
||||||
})),
|
})),
|
||||||
...(post.guest ? [{ name: post.guest.name, title: 'Guest author', photo: blogImage(post.guest.photo) }] : []),
|
...(post.guest ? [{ name: post.guest.name, title: 'Guest author', photo: mediaUrl(post.guest.photo) }] : []),
|
||||||
]
|
]
|
||||||
|
|
||||||
const sections: ShellSection[] = [
|
const sections: ShellSection[] = [
|
||||||
|
|
@ -66,7 +67,7 @@ export default function BlogPost() {
|
||||||
id: 'post',
|
id: 'post',
|
||||||
title: 'Post',
|
title: 'Post',
|
||||||
accent: ACCENT,
|
accent: ACCENT,
|
||||||
background: '#ffffff',
|
background: 'var(--color-surface)',
|
||||||
content: (
|
content: (
|
||||||
<article className="mx-auto max-w-3xl space-y-8 px-6">
|
<article className="mx-auto max-w-3xl space-y-8 px-6">
|
||||||
<div className="flex flex-wrap items-center gap-x-4 gap-y-2 text-sm" style={{ color: BODY }}>
|
<div className="flex flex-wrap items-center gap-x-4 gap-y-2 text-sm" style={{ color: BODY }}>
|
||||||
|
|
@ -76,12 +77,12 @@ export default function BlogPost() {
|
||||||
<span
|
<span
|
||||||
key={tag}
|
key={tag}
|
||||||
className="rounded-full px-3 py-0.5 text-xs font-semibold"
|
className="rounded-full px-3 py-0.5 text-xs font-semibold"
|
||||||
style={{ background: '#eef9fb', color: ACCENT }}
|
style={{ background: 'var(--color-tint)', color: accentText(ACCENT) }}
|
||||||
>
|
>
|
||||||
{tag}
|
{tag}
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
<Link to={BACK.to} className="ml-auto hover:underline" style={{ color: ACCENT }}>
|
<Link to={BACK.to} className="ml-auto hover:underline" style={{ color: accentText(ACCENT) }}>
|
||||||
{BACK.label}
|
{BACK.label}
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -101,7 +102,7 @@ export default function BlogPost() {
|
||||||
id: 'authors',
|
id: 'authors',
|
||||||
title: authors.length === 1 ? 'About the author' : 'About the authors',
|
title: authors.length === 1 ? 'About the author' : 'About the authors',
|
||||||
accent: ACCENT,
|
accent: ACCENT,
|
||||||
background: '#eef9fb',
|
background: 'var(--color-tint)',
|
||||||
content: (
|
content: (
|
||||||
<div className="mx-auto max-w-6xl px-6">
|
<div className="mx-auto max-w-6xl px-6">
|
||||||
<PeopleTiles size="md" accent={ACCENT} people={authors} />
|
<PeopleTiles size="md" accent={ACCENT} people={authors} />
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ const SECTIONS = [
|
||||||
blurb:
|
blurb:
|
||||||
"Young adult groups meeting in person and online across the movement.",
|
"Young adult groups meeting in person and online across the movement.",
|
||||||
accent: "#0f7183",
|
accent: "#0f7183",
|
||||||
background: "#eef9fb",
|
background: "var(--color-tint)",
|
||||||
Component: OrgListMap,
|
Component: OrgListMap,
|
||||||
views: { options: ["map", "grid"], default: "map", Toggle: OrgMapToggle },
|
views: { options: ["map", "grid"], default: "map", Toggle: OrgMapToggle },
|
||||||
},
|
},
|
||||||
|
|
@ -41,7 +41,7 @@ const SECTIONS = [
|
||||||
blurb:
|
blurb:
|
||||||
"The regional organizations that support chapters and host their own gatherings.",
|
"The regional organizations that support chapters and host their own gatherings.",
|
||||||
accent: "#4a6b72",
|
accent: "#4a6b72",
|
||||||
background: "#ffffff",
|
background: "var(--color-surface)",
|
||||||
Component: OrgListVertical,
|
Component: OrgListVertical,
|
||||||
props: {
|
props: {
|
||||||
kind: "region",
|
kind: "region",
|
||||||
|
|
@ -59,7 +59,7 @@ const SECTIONS = [
|
||||||
blurb:
|
blurb:
|
||||||
"Organizations we collaborate with across the Unity movement and beyond.",
|
"Organizations we collaborate with across the Unity movement and beyond.",
|
||||||
accent: "#7a5ea8",
|
accent: "#7a5ea8",
|
||||||
background: "#eef9fb",
|
background: "var(--color-tint)",
|
||||||
Component: OrgListCards,
|
Component: OrgListCards,
|
||||||
props: {
|
props: {
|
||||||
kind: "partner",
|
kind: "partner",
|
||||||
|
|
@ -78,7 +78,7 @@ export default function CommunityPage() {
|
||||||
title: blog?.title || BLOG_DEFAULT_TITLE,
|
title: blog?.title || BLOG_DEFAULT_TITLE,
|
||||||
blurb: blog?.blurb ?? undefined,
|
blurb: blog?.blurb ?? undefined,
|
||||||
accent: "#0f7183",
|
accent: "#0f7183",
|
||||||
background: "#ffffff",
|
background: "var(--color-surface)",
|
||||||
Component: CommunityBlog,
|
Component: CommunityBlog,
|
||||||
},
|
},
|
||||||
...SECTIONS,
|
...SECTIONS,
|
||||||
|
|
|
||||||
|
|
@ -30,13 +30,14 @@ import {
|
||||||
type EventRecord,
|
type EventRecord,
|
||||||
} from '../lib/useContent.ts'
|
} from '../lib/useContent.ts'
|
||||||
import { awardHref, personHref, refHref } from '../lib/hrefs.ts'
|
import { awardHref, personHref, refHref } from '../lib/hrefs.ts'
|
||||||
import { personPhoto } from '../lib/media.ts'
|
import { mediaUrl } from '../lib/media.ts'
|
||||||
import { eventTypeLabel } from '../lib/eventTypes.ts'
|
import { eventTypeLabel } from '../lib/eventTypes.ts'
|
||||||
import { occurrenceLabel, seriesLabel, seriesTimes, upcomingOccurrences } from '../lib/eventSeries.ts'
|
import { occurrenceLabel, seriesLabel, seriesTimes, upcomingOccurrences } from '../lib/eventSeries.ts'
|
||||||
import { capitalize } from '../lib/text.ts'
|
import { capitalize } from '../lib/text.ts'
|
||||||
|
import { accentText, readableOn } from '../lib/color.ts'
|
||||||
|
|
||||||
const TEAL = '#0f7183'
|
const TEAL = '#0f7183'
|
||||||
const BODY = '#4a6b72'
|
const BODY = 'var(--color-muted)'
|
||||||
|
|
||||||
/* Billing order. A role missing from here still renders, at the
|
/* Billing order. A role missing from here still renders, at the
|
||||||
end, under its own name, better than a speaker vanishing
|
end, under its own name, better than a speaker vanishing
|
||||||
|
|
@ -94,7 +95,7 @@ export default function EventDetail() {
|
||||||
title: event.theme || 'About',
|
title: event.theme || 'About',
|
||||||
blurb: event.theme ? event.tagline ?? undefined : undefined,
|
blurb: event.theme ? event.tagline ?? undefined : undefined,
|
||||||
accent,
|
accent,
|
||||||
background: '#ffffff',
|
background: 'var(--color-surface)',
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6 space-y-8">
|
<div className="max-w-6xl mx-auto px-6 space-y-8">
|
||||||
<Facts event={event} accent={accent} />
|
<Facts event={event} accent={accent} />
|
||||||
|
|
@ -145,17 +146,17 @@ export default function EventDetail() {
|
||||||
title: 'Upcoming dates',
|
title: 'Upcoming dates',
|
||||||
blurb: seriesLabel(event.series, event.starts_on) ?? undefined,
|
blurb: seriesLabel(event.series, event.starts_on) ?? undefined,
|
||||||
accent,
|
accent,
|
||||||
background: '#eef9fb',
|
background: 'var(--color-tint)',
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6">
|
<div className="max-w-6xl mx-auto px-6">
|
||||||
<ul className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
|
<ul className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
|
||||||
{upcoming.map((date) => (
|
{upcoming.map((date) => (
|
||||||
<li
|
<li
|
||||||
key={date}
|
key={date}
|
||||||
className="rounded-xl border-l-4 bg-white px-5 py-3"
|
className="rounded-xl border-l-4 bg-surface px-5 py-3"
|
||||||
style={{ borderColor: accent }}
|
style={{ borderColor: accent }}
|
||||||
>
|
>
|
||||||
<p className="font-semibold" style={{ color: accent }}>
|
<p className="font-semibold" style={{ color: accentText(accent) }}>
|
||||||
{occurrenceLabel(date)}
|
{occurrenceLabel(date)}
|
||||||
</p>
|
</p>
|
||||||
{times && (
|
{times && (
|
||||||
|
|
@ -176,7 +177,7 @@ export default function EventDetail() {
|
||||||
id: 'people',
|
id: 'people',
|
||||||
title: 'Who’s there',
|
title: 'Who’s there',
|
||||||
accent,
|
accent,
|
||||||
background: '#eef9fb',
|
background: 'var(--color-tint)',
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6">
|
<div className="max-w-6xl mx-auto px-6">
|
||||||
<PeopleTiles size="lg" groups={groups} accent={accent} />
|
<PeopleTiles size="lg" groups={groups} accent={accent} />
|
||||||
|
|
@ -191,7 +192,7 @@ export default function EventDetail() {
|
||||||
title: 'Presented here',
|
title: 'Presented here',
|
||||||
blurb: 'Awards given at this gathering.',
|
blurb: 'Awards given at this gathering.',
|
||||||
accent,
|
accent,
|
||||||
background: '#ffffff',
|
background: 'var(--color-surface)',
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6 space-y-6">
|
<div className="max-w-6xl mx-auto px-6 space-y-6">
|
||||||
{event.awards.map((entry, index) => (
|
{event.awards.map((entry, index) => (
|
||||||
|
|
@ -201,7 +202,7 @@ export default function EventDetail() {
|
||||||
style={{ borderColor: accent }}
|
style={{ borderColor: accent }}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<p className="font-semibold" style={{ color: accent }}>
|
<p className="font-semibold" style={{ color: accentText(accent) }}>
|
||||||
<Link to={awardHref(entry.award.id)} className="hover:underline">
|
<Link to={awardHref(entry.award.id)} className="hover:underline">
|
||||||
{entry.award.name}
|
{entry.award.name}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -254,7 +255,7 @@ function Facts({ event, accent }: { event: EventRecord; accent: string }) {
|
||||||
className="rounded-full px-3 py-1 font-semibold uppercase tracking-wide"
|
className="rounded-full px-3 py-1 font-semibold uppercase tracking-wide"
|
||||||
style={{
|
style={{
|
||||||
background: event.status === 'cancelled' ? '#b3261e' : accent,
|
background: event.status === 'cancelled' ? '#b3261e' : accent,
|
||||||
color: '#ffffff',
|
color: event.status === 'cancelled' ? '#ffffff' : readableOn(accent),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{STATUS_LABEL[event.status] ?? event.status}
|
{STATUS_LABEL[event.status] ?? event.status}
|
||||||
|
|
@ -269,7 +270,7 @@ function Facts({ event, accent }: { event: EventRecord; accent: string }) {
|
||||||
{event.event_type && (
|
{event.event_type && (
|
||||||
<span
|
<span
|
||||||
className="rounded-full px-3 py-1 font-semibold uppercase tracking-wide"
|
className="rounded-full px-3 py-1 font-semibold uppercase tracking-wide"
|
||||||
style={{ border: `1px solid ${accent}`, color: accent }}
|
style={{ border: `1px solid ${accent}`, color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
{eventTypeLabel(event.event_type)}
|
{eventTypeLabel(event.event_type)}
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -288,7 +289,7 @@ function Facts({ event, accent }: { event: EventRecord; accent: string }) {
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Link to="/retreats" className="ml-auto hover:underline" style={{ color: accent }}>
|
<Link to="/retreats" className="ml-auto hover:underline" style={{ color: accentText(accent) }}>
|
||||||
All retreats
|
All retreats
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -314,7 +315,7 @@ function HostList({ hosts, accent }: { hosts: EventHost[]; accent: string }) {
|
||||||
<Link
|
<Link
|
||||||
to={to}
|
to={to}
|
||||||
className="font-medium hover:underline"
|
className="font-medium hover:underline"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
{host.name}
|
{host.name}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -394,7 +395,7 @@ function peopleGroups(people: EventPerson[], accent: string): PeopleGroupInput[]
|
||||||
pronouns: person.pronouns,
|
pronouns: person.pronouns,
|
||||||
// PeopleTiles resolves a bare filename itself; this is here
|
// PeopleTiles resolves a bare filename itself; this is here
|
||||||
// so a hand-written entry elsewhere can't diverge.
|
// so a hand-written entry elsewhere can't diverge.
|
||||||
photo: personPhoto(person.photo),
|
photo: mediaUrl(person.photo),
|
||||||
})),
|
})),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ const SECTIONS = [
|
||||||
blurb:
|
blurb:
|
||||||
"Found a broken link, spotted something out of date, or want the site to do something it doesn't? This form goes straight to the people who maintain it.",
|
"Found a broken link, spotted something out of date, or want the site to do something it doesn't? This form goes straight to the people who maintain it.",
|
||||||
accent: ACCENT,
|
accent: ACCENT,
|
||||||
background: "#eef9fb",
|
background: "var(--color-tint)",
|
||||||
content: (
|
content: (
|
||||||
// Narrower than the usual max-w-6xl: full-width form fields
|
// Narrower than the usual max-w-6xl: full-width form fields
|
||||||
// are unpleasant to fill in.
|
// are unpleasant to fill in.
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ export default function GivingPage() {
|
||||||
blurb:
|
blurb:
|
||||||
"Your giving funds scholarships, retreats, leadership development and the continued growth of the Next Generation of Unity leaders, teachers and community members.",
|
"Your giving funds scholarships, retreats, leadership development and the continued growth of the Next Generation of Unity leaders, teachers and community members.",
|
||||||
accent: ACCENT,
|
accent: ACCENT,
|
||||||
background: "#eef9fb",
|
background: "var(--color-tint)",
|
||||||
content: <GivingPanel />,
|
content: <GivingPanel />,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ const PAGE = sitePage("/history");
|
||||||
const PROGRAM_START_YEAR = 2000;
|
const PROGRAM_START_YEAR = 2000;
|
||||||
|
|
||||||
const ACCENT = "#0f7183";
|
const ACCENT = "#0f7183";
|
||||||
const BACKGROUND = "#ffffff";
|
const BACKGROUND = "var(--color-surface)";
|
||||||
|
|
||||||
export default function History() {
|
export default function History() {
|
||||||
const { items, loading, error, reload } = useHistory();
|
const { items, loading, error, reload } = useHistory();
|
||||||
|
|
@ -37,7 +37,7 @@ export default function History() {
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
content = wrap(
|
content = wrap(
|
||||||
<p className="py-12 text-[#4a6b72]" role="status">
|
<p className="py-12 text-muted" role="status">
|
||||||
Loading the timeline…
|
Loading the timeline…
|
||||||
</p>,
|
</p>,
|
||||||
);
|
);
|
||||||
|
|
@ -47,11 +47,11 @@ export default function History() {
|
||||||
// organization with no history.
|
// organization with no history.
|
||||||
content = wrap(
|
content = wrap(
|
||||||
<div className="py-12">
|
<div className="py-12">
|
||||||
<p className="text-[#b3261e]">Couldn’t load the timeline. {error}</p>
|
<p className="text-danger">Couldn’t load the timeline. {error}</p>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={reload}
|
onClick={reload}
|
||||||
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
|
Try again
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -116,11 +116,11 @@ export default function Home() {
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<section className="px-6 py-24 text-center">
|
<section className="px-6 py-24 text-center">
|
||||||
<p className="text-[#b3261e]">Couldn’t load the front page. {error}</p>
|
<p className="text-danger">Couldn’t load the front page. {error}</p>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={reload}
|
onClick={reload}
|
||||||
className="mt-4 rounded-full border border-[#138ba0] px-5 py-2 font-semibold text-[#0f7183] hover:bg-[#eef9fb]"
|
className="mt-4 rounded-full border border-brand px-5 py-2 font-semibold text-link hover:bg-tint"
|
||||||
>
|
>
|
||||||
Try again
|
Try again
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ const SECTIONS = [
|
||||||
title: "Board & Staff",
|
title: "Board & Staff",
|
||||||
blurb: "The people guiding Next Generation of Unity day to day.",
|
blurb: "The people guiding Next Generation of Unity day to day.",
|
||||||
accent: "#0f7183",
|
accent: "#0f7183",
|
||||||
background: "#eef9fb",
|
background: "var(--color-tint)",
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6">
|
<div className="max-w-6xl mx-auto px-6">
|
||||||
<PeopleTiles size="lg" teams={{ id: "ngu-board",}} />
|
<PeopleTiles size="lg" teams={{ id: "ngu-board",}} />
|
||||||
|
|
@ -23,7 +23,7 @@ const SECTIONS = [
|
||||||
title: "Retreat Team",
|
title: "Retreat Team",
|
||||||
blurb: "Volunteers who plan and lead our gatherings throughout the year.",
|
blurb: "Volunteers who plan and lead our gatherings throughout the year.",
|
||||||
accent: "#4a7a2f",
|
accent: "#4a7a2f",
|
||||||
background: "#ffffff",
|
background: "var(--color-surface)",
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6">
|
<div className="max-w-6xl mx-auto px-6">
|
||||||
<PeopleTiles size="lg" teams="ngu-retreat-team" />
|
<PeopleTiles size="lg" teams="ngu-retreat-team" />
|
||||||
|
|
@ -35,7 +35,7 @@ const SECTIONS = [
|
||||||
title: "Committees & Volunteers",
|
title: "Committees & Volunteers",
|
||||||
blurb: "Additional roles and contributors.",
|
blurb: "Additional roles and contributors.",
|
||||||
accent: "#7a5ea8",
|
accent: "#7a5ea8",
|
||||||
background: "#eef9fb",
|
background: "var(--color-tint)",
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6">
|
<div className="max-w-6xl mx-auto px-6">
|
||||||
{/* Other roles content */}
|
{/* Other roles content */}
|
||||||
|
|
@ -47,7 +47,7 @@ const SECTIONS = [
|
||||||
title: "Contact Us",
|
title: "Contact Us",
|
||||||
blurb: "Reach out to our staff",
|
blurb: "Reach out to our staff",
|
||||||
accent: "#004c52",
|
accent: "#004c52",
|
||||||
background: "#ffffff",
|
background: "var(--color-surface)",
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6">
|
<div className="max-w-6xl mx-auto px-6">
|
||||||
<a
|
<a
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,12 @@ import {
|
||||||
type OrganizationRecord,
|
type OrganizationRecord,
|
||||||
} from '../lib/useContent.ts'
|
} from '../lib/useContent.ts'
|
||||||
import { orgHref, orgListHref, teamHref } from '../lib/hrefs.ts'
|
import { orgHref, orgListHref, teamHref } from '../lib/hrefs.ts'
|
||||||
import { orgLogo, personPhoto } from '../lib/media.ts'
|
import { initials, mediaUrl } from '../lib/media.ts'
|
||||||
|
import Logo from '../components/Logo.tsx'
|
||||||
|
import { withAlpha, accentText, readableOn } from '../lib/color.ts'
|
||||||
|
|
||||||
const TEAL = '#0f7183'
|
const TEAL = '#0f7183'
|
||||||
const BODY = '#4a6b72'
|
const BODY = 'var(--color-muted)'
|
||||||
|
|
||||||
export default function OrganizationDetail() {
|
export default function OrganizationDetail() {
|
||||||
const { id } = useParams()
|
const { id } = useParams()
|
||||||
|
|
@ -78,7 +80,7 @@ export default function OrganizationDetail() {
|
||||||
id: 'about',
|
id: 'about',
|
||||||
title: 'About',
|
title: 'About',
|
||||||
accent,
|
accent,
|
||||||
background: '#ffffff',
|
background: 'var(--color-surface)',
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6 space-y-8">
|
<div className="max-w-6xl mx-auto px-6 space-y-8">
|
||||||
<Facts org={org} accent={accent} back={back} />
|
<Facts org={org} accent={accent} back={back} />
|
||||||
|
|
@ -106,7 +108,7 @@ export default function OrganizationDetail() {
|
||||||
id: 'leadership',
|
id: 'leadership',
|
||||||
title: 'Who runs it',
|
title: 'Who runs it',
|
||||||
accent,
|
accent,
|
||||||
background: '#eef9fb',
|
background: 'var(--color-tint)',
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6 space-y-12">
|
<div className="max-w-6xl mx-auto px-6 space-y-12">
|
||||||
{teamBlocks.map((block) => (
|
{teamBlocks.map((block) => (
|
||||||
|
|
@ -117,14 +119,14 @@ export default function OrganizationDetail() {
|
||||||
<Link
|
<Link
|
||||||
to={teamHref(block.teamId)}
|
to={teamHref(block.teamId)}
|
||||||
className="hover:underline"
|
className="hover:underline"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
{block.label}
|
{block.label}
|
||||||
</Link>
|
</Link>
|
||||||
</h3>
|
</h3>
|
||||||
) : (
|
) : (
|
||||||
block.label && (
|
block.label && (
|
||||||
<h3 className="text-xl font-bold" style={{ color: accent }}>
|
<h3 className="text-xl font-bold" style={{ color: accentText(accent) }}>
|
||||||
{block.label}
|
{block.label}
|
||||||
</h3>
|
</h3>
|
||||||
)
|
)
|
||||||
|
|
@ -146,7 +148,7 @@ export default function OrganizationDetail() {
|
||||||
title: leader.title,
|
title: leader.title,
|
||||||
pronouns: leader.pronouns,
|
pronouns: leader.pronouns,
|
||||||
public_email: leader.public_email,
|
public_email: leader.public_email,
|
||||||
photo: personPhoto(leader.photo),
|
photo: mediaUrl(leader.photo),
|
||||||
is_owner: leader.is_owner,
|
is_owner: leader.is_owner,
|
||||||
}))}
|
}))}
|
||||||
/>
|
/>
|
||||||
|
|
@ -168,19 +170,19 @@ export default function OrganizationDetail() {
|
||||||
title: 'Chapters',
|
title: 'Chapters',
|
||||||
blurb: org.details.map_note ?? undefined,
|
blurb: org.details.map_note ?? undefined,
|
||||||
accent,
|
accent,
|
||||||
background: '#ffffff',
|
background: 'var(--color-surface)',
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
<div className="max-w-6xl mx-auto px-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||||
{(org.details.chapters ?? []).map((chapter) => (
|
{(org.details.chapters ?? []).map((chapter) => (
|
||||||
<Link
|
<Link
|
||||||
key={chapter.id}
|
key={chapter.id}
|
||||||
to={orgHref(chapter.id, 'chapter')}
|
to={orgHref(chapter.id, 'chapter')}
|
||||||
className="flex items-center gap-4 rounded-lg border p-4 transition-colors hover:bg-[#eef9fb]"
|
className="flex items-center gap-4 rounded-lg border p-4 transition-colors hover:bg-tint"
|
||||||
style={{ borderColor: `${accent}40` }}
|
style={{ borderColor: `${withAlpha(accent, 25)}` }}
|
||||||
>
|
>
|
||||||
<Logo file={chapter.logo} name={chapter.name} accent={accent} />
|
<ChapterMark file={chapter.logo} name={chapter.name} accent={accent} />
|
||||||
<span>
|
<span>
|
||||||
<span className="block font-semibold" style={{ color: accent }}>
|
<span className="block font-semibold" style={{ color: accentText(accent) }}>
|
||||||
{chapter.name}
|
{chapter.name}
|
||||||
</span>
|
</span>
|
||||||
{chapter.location_label && (
|
{chapter.location_label && (
|
||||||
|
|
@ -202,17 +204,17 @@ export default function OrganizationDetail() {
|
||||||
title: 'Awards',
|
title: 'Awards',
|
||||||
blurb: `Given by ${org.short_name || org.name}.`,
|
blurb: `Given by ${org.short_name || org.name}.`,
|
||||||
accent,
|
accent,
|
||||||
background: '#eef9fb',
|
background: 'var(--color-tint)',
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6 grid gap-4 sm:grid-cols-2">
|
<div className="max-w-6xl mx-auto px-6 grid gap-4 sm:grid-cols-2">
|
||||||
{org.awards.map((award) => (
|
{org.awards.map((award) => (
|
||||||
<Link
|
<Link
|
||||||
key={award.id}
|
key={award.id}
|
||||||
to={`/awards/${award.id}`}
|
to={`/awards/${award.id}`}
|
||||||
className="rounded-lg border bg-white p-5 transition-colors hover:bg-[#f6fbfc]"
|
className="rounded-lg border bg-surface p-5 transition-colors hover:bg-tint-soft"
|
||||||
style={{ borderColor: `${accent}40` }}
|
style={{ borderColor: `${withAlpha(accent, 25)}` }}
|
||||||
>
|
>
|
||||||
<span className="block font-semibold" style={{ color: accent }}>
|
<span className="block font-semibold" style={{ color: accentText(accent) }}>
|
||||||
{award.name}
|
{award.name}
|
||||||
</span>
|
</span>
|
||||||
{award.description && (
|
{award.description && (
|
||||||
|
|
@ -246,7 +248,7 @@ export default function OrganizationDetail() {
|
||||||
id: 'events',
|
id: 'events',
|
||||||
title: 'Gatherings',
|
title: 'Gatherings',
|
||||||
accent,
|
accent,
|
||||||
background: '#ffffff',
|
background: 'var(--color-surface)',
|
||||||
content: (
|
content: (
|
||||||
<EventListCards
|
<EventListCards
|
||||||
host={org.id}
|
host={org.id}
|
||||||
|
|
@ -304,7 +306,7 @@ function Facts({
|
||||||
)}
|
)}
|
||||||
{org.is_online && <span style={{ color: BODY }}>Online</span>}
|
{org.is_online && <span style={{ color: BODY }}>Online</span>}
|
||||||
|
|
||||||
<Link to={back.to} className="ml-auto hover:underline" style={{ color: accent }}>
|
<Link to={back.to} className="ml-auto hover:underline" style={{ color: accentText(accent) }}>
|
||||||
{back.label}
|
{back.label}
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -347,8 +349,8 @@ function Contact({ org, accent }: { org: OrganizationRecord; accent: string }) {
|
||||||
href={link.url}
|
href={link.url}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
className="inline-flex items-center gap-2 rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-[#eef9fb]"
|
className="inline-flex items-center gap-2 rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-tint"
|
||||||
style={{ borderColor: accent, color: accent }}
|
style={{ borderColor: accent, color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
<PlatformIcon platform={link.platform} />
|
<PlatformIcon platform={link.platform} />
|
||||||
{link.label}
|
{link.label}
|
||||||
|
|
@ -358,28 +360,22 @@ function Contact({ org, accent }: { org: OrganizationRecord; accent: string }) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function Logo({
|
function ChapterMark({ file, name, accent }: { file?: string | null; name: string; accent: string }) {
|
||||||
file,
|
return (
|
||||||
name,
|
<Logo
|
||||||
accent,
|
src={mediaUrl(file)}
|
||||||
}: {
|
className="h-10 w-10 shrink-0 object-contain"
|
||||||
file?: string | null
|
fallback={
|
||||||
name: string
|
<span
|
||||||
accent: string
|
aria-hidden="true"
|
||||||
}) {
|
className="flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-xs font-bold"
|
||||||
const src = orgLogo(file)
|
style={{ background: accent, color: readableOn(accent) }}
|
||||||
if (!src) {
|
>
|
||||||
return (
|
{initials(name)}
|
||||||
<span
|
</span>
|
||||||
aria-hidden="true"
|
}
|
||||||
className="flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-xs font-bold text-white"
|
/>
|
||||||
style={{ background: accent }}
|
)
|
||||||
>
|
|
||||||
{name.slice(0, 2).toUpperCase()}
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return <img src={src} alt="" loading="lazy" className="h-10 w-10 shrink-0 object-contain" />
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Leadership → team blocks ────────────────────────────────── */
|
/* ── Leadership → team blocks ────────────────────────────────── */
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,14 @@ import {
|
||||||
type PersonRole,
|
type PersonRole,
|
||||||
} from '../lib/useContent.ts'
|
} from '../lib/useContent.ts'
|
||||||
import { awardHref, eventHref, orgHref, teamHref } from '../lib/hrefs.ts'
|
import { awardHref, eventHref, orgHref, teamHref } from '../lib/hrefs.ts'
|
||||||
import { initials, personPhoto } from '../lib/media.ts'
|
import { mediaUrl, initials } from '../lib/media.ts'
|
||||||
import { eventTypeLabel } from '../lib/eventTypes.ts'
|
import { eventTypeLabel } from '../lib/eventTypes.ts'
|
||||||
import { capitalize } from '../lib/text.ts'
|
import { capitalize } from '../lib/text.ts'
|
||||||
|
import { accentText } from '../lib/color.ts'
|
||||||
|
|
||||||
const TEAL = '#0f7183'
|
const TEAL = '#0f7183'
|
||||||
const BODY = '#4a6b72'
|
const BODY = 'var(--color-muted)'
|
||||||
const BACKGROUNDS = ['#ffffff', '#eef9fb']
|
const BACKGROUNDS = ['var(--color-surface)', 'var(--color-tint)']
|
||||||
|
|
||||||
/* affiliations.role, for a row with no title of its own. */
|
/* affiliations.role, for a row with no title of its own. */
|
||||||
const ROLE_LABEL: Record<string, string> = {
|
const ROLE_LABEL: Record<string, string> = {
|
||||||
|
|
@ -110,7 +111,7 @@ export default function PersonDetail() {
|
||||||
{previous.length > 0 && (
|
{previous.length > 0 && (
|
||||||
<div>
|
<div>
|
||||||
{current.length > 0 && (
|
{current.length > 0 && (
|
||||||
<h3 className="mb-4 text-lg font-semibold" style={{ color: accent }}>
|
<h3 className="mb-4 text-lg font-semibold" style={{ color: accentText(accent) }}>
|
||||||
Previously
|
Previously
|
||||||
</h3>
|
</h3>
|
||||||
)}
|
)}
|
||||||
|
|
@ -156,7 +157,7 @@ export default function PersonDetail() {
|
||||||
className="border-l-2 pl-5"
|
className="border-l-2 pl-5"
|
||||||
style={{ borderColor: accent }}
|
style={{ borderColor: accent }}
|
||||||
>
|
>
|
||||||
<p className="font-semibold" style={{ color: accent }}>
|
<p className="font-semibold" style={{ color: accentText(accent) }}>
|
||||||
<Link to={awardHref(entry.award.id)} className="hover:underline">
|
<Link to={awardHref(entry.award.id)} className="hover:underline">
|
||||||
{entry.award.name}
|
{entry.award.name}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -170,7 +171,7 @@ export default function PersonDetail() {
|
||||||
<Link
|
<Link
|
||||||
to={eventHref(entry.event.id)}
|
to={eventHref(entry.event.id)}
|
||||||
className="hover:underline"
|
className="hover:underline"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
{entry.event.title}
|
{entry.event.title}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -198,7 +199,7 @@ export default function PersonDetail() {
|
||||||
/* ── The strip of facts under the heading ────────────────────── */
|
/* ── The strip of facts under the heading ────────────────────── */
|
||||||
|
|
||||||
function Facts({ person, accent }: { person: PersonRecord; accent: string }) {
|
function Facts({ person, accent }: { person: PersonRecord; accent: string }) {
|
||||||
const photo = personPhoto(person.photo)
|
const photo = mediaUrl(person.photo)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-wrap items-center gap-x-6 gap-y-3 text-sm">
|
<div className="flex flex-wrap items-center gap-x-6 gap-y-3 text-sm">
|
||||||
|
|
@ -226,7 +227,7 @@ function Facts({ person, accent }: { person: PersonRecord; accent: string }) {
|
||||||
<Link
|
<Link
|
||||||
to={orgHref(person.org.id, person.org.kind)}
|
to={orgHref(person.org.id, person.org.kind)}
|
||||||
className="font-medium hover:underline"
|
className="font-medium hover:underline"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
{person.org.name}
|
{person.org.name}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -234,7 +235,7 @@ function Facts({ person, accent }: { person: PersonRecord; accent: string }) {
|
||||||
|
|
||||||
{person.location_label && <span style={{ color: BODY }}>{person.location_label}</span>}
|
{person.location_label && <span style={{ color: BODY }}>{person.location_label}</span>}
|
||||||
|
|
||||||
<Link to="/leadership" className="ml-auto hover:underline" style={{ color: accent }}>
|
<Link to="/leadership" className="ml-auto hover:underline" style={{ color: accentText(accent) }}>
|
||||||
Leadership
|
Leadership
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -274,8 +275,8 @@ function Contact({ person, accent }: { person: PersonRecord; accent: string }) {
|
||||||
href={link.url}
|
href={link.url}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
className="inline-flex items-center gap-2 rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-[#eef9fb]"
|
className="inline-flex items-center gap-2 rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-tint"
|
||||||
style={{ borderColor: accent, color: accent }}
|
style={{ borderColor: accent, color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
<PlatformIcon platform={link.platform} />
|
<PlatformIcon platform={link.platform} />
|
||||||
{link.label}
|
{link.label}
|
||||||
|
|
@ -293,10 +294,10 @@ function RoleList({ roles, accent }: { roles: PersonRole[]; accent: string }) {
|
||||||
{roles.map((role, index) => (
|
{roles.map((role, index) => (
|
||||||
<li
|
<li
|
||||||
key={`${role.org.id}:${role.team?.id ?? ''}:${role.title ?? role.role}:${index}`}
|
key={`${role.org.id}:${role.team?.id ?? ''}:${role.title ?? role.role}:${index}`}
|
||||||
className="rounded-xl border-l-4 bg-white px-5 py-3"
|
className="rounded-xl border-l-4 bg-surface px-5 py-3"
|
||||||
style={{ borderColor: accent }}
|
style={{ borderColor: accent }}
|
||||||
>
|
>
|
||||||
<p className="font-semibold" style={{ color: accent }}>
|
<p className="font-semibold" style={{ color: accentText(accent) }}>
|
||||||
{role.title || ROLE_LABEL[role.role] || capitalize(role.role)}
|
{role.title || ROLE_LABEL[role.role] || capitalize(role.role)}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-sm" style={{ color: BODY }}>
|
<p className="text-sm" style={{ color: BODY }}>
|
||||||
|
|
@ -344,7 +345,7 @@ function EventRow({ event, accent }: { event: PersonEvent; accent: string }) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="border-l-2 pl-5" style={{ borderColor: accent }}>
|
<div className="border-l-2 pl-5" style={{ borderColor: accent }}>
|
||||||
<p className="font-semibold" style={{ color: accent }}>
|
<p className="font-semibold" style={{ color: accentText(accent) }}>
|
||||||
<Link to={eventHref(event.id)} className="hover:underline">
|
<Link to={eventHref(event.id)} className="hover:underline">
|
||||||
{event.title}
|
{event.title}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,191 @@
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
|
import LegalText, { type LegalPart } from "../components/LegalText.tsx";
|
||||||
import PageShell from "../components/PageShell.tsx";
|
import PageShell from "../components/PageShell.tsx";
|
||||||
import { sitePage } from "../lib/site.ts";
|
import { DATA_REQUEST } from "../data/feedbackTypes.ts";
|
||||||
|
import { PRIVACY_EMAIL, sitePage } from "../lib/site.ts";
|
||||||
|
import FeedbackForm from "./sections/FeedbackForm.tsx";
|
||||||
|
|
||||||
/* Title and intro: site.json, which also gives the search metadata. */
|
/* Title and intro: site.json, which also gives the search metadata. */
|
||||||
const PAGE = sitePage("/privacy");
|
const PAGE = sitePage("/privacy");
|
||||||
|
|
||||||
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
|
Privacy policy, cookie notice included.
|
||||||
|
|
||||||
|
What it says must stay true of the code: what the feedback form
|
||||||
|
stores (routes/feedback.js), what the browser keeps (Banner,
|
||||||
|
PrivacyNotice, the theme toggle), which embeds wait for a click
|
||||||
|
(VideoPlayer, HeroStage, ScheduleBlock), and that nothing about
|
||||||
|
a minor is shown. Change the date when the wording changes.
|
||||||
|
|
||||||
|
The contact address is Panel → Site settings → Privacy contact
|
||||||
|
email. Requests from the form below are feedback rows of type
|
||||||
|
'privacy', in Admin → Feedback.
|
||||||
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
const LAST_UPDATED = "September 28, 2026";
|
||||||
|
const ACCENT = "#0f7183";
|
||||||
|
|
||||||
|
const link = "underline underline-offset-2 text-link";
|
||||||
|
|
||||||
|
const contact = PRIVACY_EMAIL ? (
|
||||||
|
<>
|
||||||
|
email <a className={link} href={`mailto:${PRIVACY_EMAIL}`}>{PRIVACY_EMAIL}</a> or use the{" "}
|
||||||
|
<a className={link} href="#requests">request form</a> below
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
use the <a className={link} href="#requests">request form</a> below
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
const PARTS: LegalPart[] = [
|
||||||
|
{
|
||||||
|
id: "summary",
|
||||||
|
heading: "In short",
|
||||||
|
body: [
|
||||||
|
"We collect some information about the people who use this site and take part in Next Generation of Unity (NGU). We use it to run our programs and this website, we don't sell it, and we don't use advertising or tracking cookies.",
|
||||||
|
<>If you want to see, correct or delete what we hold about you, {contact}.</>,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "what-we-collect",
|
||||||
|
heading: "What we collect",
|
||||||
|
body: ["Depending on how you use the site and our programs:"],
|
||||||
|
list: [
|
||||||
|
<>
|
||||||
|
<strong>Feedback and requests you send.</strong> Your message, the page it's about, and, if you
|
||||||
|
give them, your name and email. With it we keep your browser's description (its user agent) and
|
||||||
|
a scrambled form of your IP address that can't be turned back into the address; we use it only to
|
||||||
|
spot abuse.
|
||||||
|
</>,
|
||||||
|
<>
|
||||||
|
<strong>People on the site.</strong> Leaders, speakers and volunteers can appear with a name,
|
||||||
|
photo, role, short bio and public contact details. Staff may also keep private details, such as a
|
||||||
|
birth date, private email, phone number or address, which are never shown on the site and can
|
||||||
|
only be seen by our editors.
|
||||||
|
</>,
|
||||||
|
<>
|
||||||
|
<strong>Server records.</strong> Like most websites, our server keeps short-lived logs of
|
||||||
|
requests (the page asked for, the time, and the IP address that asked) to keep the site running
|
||||||
|
and secure.
|
||||||
|
</>,
|
||||||
|
<>
|
||||||
|
<strong>Staff accounts.</strong> For NGU staff and volunteers who sign in to edit the site: name,
|
||||||
|
email, role, and a record of sign-ins. Passwords are stored only in a form that can't be read back.
|
||||||
|
</>,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "minors",
|
||||||
|
heading: "Young people",
|
||||||
|
body: [
|
||||||
|
"We don't show information about anyone under 18 on this site: no names, photos or details. If you believe something about a minor appears here, tell us and we'll take it down.",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "how-we-use",
|
||||||
|
heading: "How we use it",
|
||||||
|
body: [
|
||||||
|
"To answer you, to run our retreats, chapters and other programs, to keep this site accurate and working, and to keep it secure. We don't sell or rent your information, and we don't use it for advertising.",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "ai",
|
||||||
|
heading: "Artificial intelligence",
|
||||||
|
body: [
|
||||||
|
"We used AI tools to help write this website's code and build its structure. Those tools have no access to our database. Information you give us, and information we hold about the people in our community, is not given to AI systems, and isn't used to train them.",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "third-parties",
|
||||||
|
heading: "Other services",
|
||||||
|
body: [
|
||||||
|
"We try not to rely on other companies, but a few parts of the site are provided by them. When you use those parts, what you enter or do there goes to that company and is covered by its own privacy policy:",
|
||||||
|
],
|
||||||
|
list: [
|
||||||
|
<>
|
||||||
|
<strong>Giving</strong> is handled by Church Center (Planning Center). Payment details go to them,
|
||||||
|
not to us.
|
||||||
|
</>,
|
||||||
|
<>
|
||||||
|
<strong>Videos</strong> come from YouTube, Facebook or Vimeo, and <strong>maps</strong> from Google
|
||||||
|
Maps. Nothing from them loads until you press play or choose to show the map.
|
||||||
|
</>,
|
||||||
|
<>
|
||||||
|
<strong>Links</strong> to social media, Substack and other sites take you to those sites, which
|
||||||
|
follow their own rules.
|
||||||
|
</>,
|
||||||
|
<>
|
||||||
|
<strong>Staff sign-in</strong> can use a Google account on our own domain.
|
||||||
|
</>,
|
||||||
|
],
|
||||||
|
after: [
|
||||||
|
"This site runs on a server we rent and manage ourselves; your information is stored there, not with an outside website service.",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "cookies",
|
||||||
|
heading: "Cookies and browser storage",
|
||||||
|
body: [
|
||||||
|
"This site doesn't use advertising, analytics or tracking cookies. It keeps a few small things in your own browser so it works the way you left it:",
|
||||||
|
],
|
||||||
|
list: [
|
||||||
|
"That you closed the announcement banner or the privacy notice.",
|
||||||
|
"Whether you chose the light or dark look.",
|
||||||
|
"For staff who sign in: a sign-in cookie that keeps you signed in, and a short-lived one used while signing in with Google.",
|
||||||
|
],
|
||||||
|
after: [
|
||||||
|
"None of these are shared with anyone. If you press play on a video or show a map, that service (YouTube, Facebook, Vimeo or Google) may set its own cookies from then on. You can clear all of this in your browser's settings at any time.",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "your-rights",
|
||||||
|
heading: "Your choices",
|
||||||
|
body: [
|
||||||
|
<>
|
||||||
|
You can ask to see the information we hold about you, to correct it, or to have it deleted. To do
|
||||||
|
that, {contact}. We may ask you to confirm it's you before we change or delete anything, and we'll
|
||||||
|
tell you when it's done. Some records we may need to keep, such as records of gifts that the law
|
||||||
|
requires; if so, we'll say which and why.
|
||||||
|
</>,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "changes",
|
||||||
|
heading: "Changes to this policy",
|
||||||
|
body: [
|
||||||
|
<>
|
||||||
|
If we change how we handle information, we'll update this page and the date at the top. See also
|
||||||
|
our <Link className={link} to="/terms">Terms of Service</Link>.
|
||||||
|
</>,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const SECTIONS = [
|
const SECTIONS = [
|
||||||
{
|
{
|
||||||
id: "privacy",
|
id: "privacy",
|
||||||
title: "Privacy Policy",
|
title: "Privacy Policy",
|
||||||
blurb: "Last updated: [date]",
|
blurb: `Last updated: ${LAST_UPDATED}`,
|
||||||
accent: "#0f7183",
|
accent: ACCENT,
|
||||||
background: "#eef9fb",
|
background: "var(--color-surface)",
|
||||||
|
content: <LegalText parts={PARTS} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "requests",
|
||||||
|
title: "Data requests",
|
||||||
|
blurb: "Ask to see, correct or delete the information we hold about you.",
|
||||||
|
accent: ACCENT,
|
||||||
|
background: "var(--color-tint)",
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-3xl mx-auto px-6 leading-relaxed text-[#2c4a50]">
|
<div className="mx-auto max-w-3xl px-6">
|
||||||
{/* Policy text goes here */}
|
<FeedbackForm fixedType={DATA_REQUEST.id} />
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function PrivacyPage() {
|
export default function PrivacyPage() {
|
||||||
return (
|
return <PageShell title={PAGE.title} intro={PAGE.description} sections={SECTIONS} />;
|
||||||
<PageShell
|
|
||||||
title={PAGE.title}
|
|
||||||
intro={PAGE.description}
|
|
||||||
sections={SECTIONS}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const SECTIONS = [
|
||||||
blurb:
|
blurb:
|
||||||
'Pick a page from the main navigation, any event, organization, team, award, person or blog post, or type any link. Site pages always point at the live site. Choose what sits in the centre and the colours; a warning shows if the code might not scan.',
|
'Pick a page from the main navigation, any event, organization, team, award, person or blog post, or type any link. Site pages always point at the live site. Choose what sits in the centre and the colours; a warning shows if the code might not scan.',
|
||||||
accent: '#0f7183',
|
accent: '#0f7183',
|
||||||
background: '#eef9fb',
|
background: 'var(--color-tint)',
|
||||||
content: (
|
content: (
|
||||||
<div className="mx-auto max-w-6xl px-6">
|
<div className="mx-auto max-w-6xl px-6">
|
||||||
<QrCodeMaker />
|
<QrCodeMaker />
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ const SECTIONS = [
|
||||||
title: "Unity Teachings",
|
title: "Unity Teachings",
|
||||||
blurb: "Core principles, readings, and study material from the Unity movement.",
|
blurb: "Core principles, readings, and study material from the Unity movement.",
|
||||||
accent: "#0f7183",
|
accent: "#0f7183",
|
||||||
background: "#eef9fb",
|
background: "var(--color-tint)",
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6">
|
<div className="max-w-6xl mx-auto px-6">
|
||||||
{/* Unity teachings content */}
|
{/* Unity teachings content */}
|
||||||
|
|
@ -22,7 +22,7 @@ const SECTIONS = [
|
||||||
title: "Branding & Marketing",
|
title: "Branding & Marketing",
|
||||||
blurb: "Logos, colors, templates, and guidelines for representing NGU.",
|
blurb: "Logos, colors, templates, and guidelines for representing NGU.",
|
||||||
accent: "#4a7a2f",
|
accent: "#4a7a2f",
|
||||||
background: "#ffffff",
|
background: "var(--color-surface)",
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6">
|
<div className="max-w-6xl mx-auto px-6">
|
||||||
{/* Branding & marketing content */}
|
{/* Branding & marketing content */}
|
||||||
|
|
@ -34,7 +34,7 @@ const SECTIONS = [
|
||||||
title: "Partner Resources",
|
title: "Partner Resources",
|
||||||
blurb: "Material for the organizations we collaborate with.",
|
blurb: "Material for the organizations we collaborate with.",
|
||||||
accent: "#7a5ea8",
|
accent: "#7a5ea8",
|
||||||
background: "#eef9fb",
|
background: "var(--color-tint)",
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6">
|
<div className="max-w-6xl mx-auto px-6">
|
||||||
{/* Partner resources content */}
|
{/* Partner resources content */}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ const SECTIONS = [
|
||||||
title: "National Retreats",
|
title: "National Retreats",
|
||||||
blurb: "Our flagship gatherings, open to young adults across the country.",
|
blurb: "Our flagship gatherings, open to young adults across the country.",
|
||||||
accent: "#0f7183",
|
accent: "#0f7183",
|
||||||
background: "#eef9fb",
|
background: "var(--color-tint)",
|
||||||
Component: EventListCards,
|
Component: EventListCards,
|
||||||
props: { scope: "national", ...RETREATS },
|
props: { scope: "national", ...RETREATS },
|
||||||
views: { ...CARD_VIEWS, default: "carousel" },
|
views: { ...CARD_VIEWS, default: "carousel" },
|
||||||
|
|
@ -57,7 +57,7 @@ const SECTIONS = [
|
||||||
title: "Regional Retreats",
|
title: "Regional Retreats",
|
||||||
blurb: "Smaller gatherings hosted by regions throughout the year.",
|
blurb: "Smaller gatherings hosted by regions throughout the year.",
|
||||||
accent: "#4a7a2f",
|
accent: "#4a7a2f",
|
||||||
background: "#ffffff",
|
background: "var(--color-surface)",
|
||||||
Component: EventListCards,
|
Component: EventListCards,
|
||||||
props: { scope: "regional", ...RETREATS },
|
props: { scope: "regional", ...RETREATS },
|
||||||
views: { ...CARD_VIEWS, default: "grid" },
|
views: { ...CARD_VIEWS, default: "grid" },
|
||||||
|
|
@ -67,7 +67,7 @@ const SECTIONS = [
|
||||||
title: "Partner Events",
|
title: "Partner Events",
|
||||||
blurb: "Retreats hosted by organizations we collaborate with.",
|
blurb: "Retreats hosted by organizations we collaborate with.",
|
||||||
accent: "#7a5ea8",
|
accent: "#7a5ea8",
|
||||||
background: "#eef9fb",
|
background: "var(--color-tint)",
|
||||||
Component: EventListCards,
|
Component: EventListCards,
|
||||||
props: { scope: "partner", ...RETREATS },
|
props: { scope: "partner", ...RETREATS },
|
||||||
views: { ...CARD_VIEWS, default: "grid" },
|
views: { ...CARD_VIEWS, default: "grid" },
|
||||||
|
|
@ -82,7 +82,7 @@ const SECTIONS = [
|
||||||
title: "Local Events",
|
title: "Local Events",
|
||||||
blurb: "Hosted by individual chapters.",
|
blurb: "Hosted by individual chapters.",
|
||||||
accent: "#9a5b17",
|
accent: "#9a5b17",
|
||||||
background: "#ffffff",
|
background: "var(--color-surface)",
|
||||||
Component: EventListCards,
|
Component: EventListCards,
|
||||||
props: { scope: "local", ...RETREATS_ONLY },
|
props: { scope: "local", ...RETREATS_ONLY },
|
||||||
views: { ...CARD_VIEWS, default: "grid" },
|
views: { ...CARD_VIEWS, default: "grid" },
|
||||||
|
|
@ -92,7 +92,7 @@ const SECTIONS = [
|
||||||
title: "International Events",
|
title: "International Events",
|
||||||
blurb: "Gatherings beyond the US.",
|
blurb: "Gatherings beyond the US.",
|
||||||
accent: "#2f6bb5",
|
accent: "#2f6bb5",
|
||||||
background: "#eef9fb",
|
background: "var(--color-tint)",
|
||||||
Component: EventListCards,
|
Component: EventListCards,
|
||||||
props: { scope: "international", ...RETREATS_ONLY },
|
props: { scope: "international", ...RETREATS_ONLY },
|
||||||
views: { ...CARD_VIEWS, default: "grid" },
|
views: { ...CARD_VIEWS, default: "grid" },
|
||||||
|
|
@ -102,7 +102,7 @@ const SECTIONS = [
|
||||||
title: "Other Events",
|
title: "Other Events",
|
||||||
blurb: "Everything that doesn't fit the categories above.",
|
blurb: "Everything that doesn't fit the categories above.",
|
||||||
accent: "#5d6c70",
|
accent: "#5d6c70",
|
||||||
background: "#ffffff",
|
background: "var(--color-surface)",
|
||||||
Component: EventListCards,
|
Component: EventListCards,
|
||||||
props: { scope: "other", ...RETREATS_ONLY },
|
props: { scope: "other", ...RETREATS_ONLY },
|
||||||
views: { ...CARD_VIEWS, default: "grid" },
|
views: { ...CARD_VIEWS, default: "grid" },
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,10 @@ import ContentBlocks from '../components/ContentBlocks.tsx'
|
||||||
import PeopleTiles from '../components/PeopleTiles.tsx'
|
import PeopleTiles from '../components/PeopleTiles.tsx'
|
||||||
import { useTeam } from '../lib/useContent.ts'
|
import { useTeam } from '../lib/useContent.ts'
|
||||||
import { orgHref } from '../lib/hrefs.ts'
|
import { orgHref } from '../lib/hrefs.ts'
|
||||||
|
import { accentText } from '../lib/color.ts'
|
||||||
|
|
||||||
const TEAL = '#0f7183'
|
const TEAL = '#0f7183'
|
||||||
const BODY = '#4a6b72'
|
const BODY = 'var(--color-muted)'
|
||||||
|
|
||||||
export default function TeamDetail() {
|
export default function TeamDetail() {
|
||||||
const { id } = useParams()
|
const { id } = useParams()
|
||||||
|
|
@ -53,7 +54,7 @@ export default function TeamDetail() {
|
||||||
id: 'about',
|
id: 'about',
|
||||||
title: 'About',
|
title: 'About',
|
||||||
accent,
|
accent,
|
||||||
background: '#ffffff',
|
background: 'var(--color-surface)',
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6 space-y-8">
|
<div className="max-w-6xl mx-auto px-6 space-y-8">
|
||||||
<Facts orgId={team.org.id} orgKind={team.org.kind} orgName={team.org.name} accent={accent} />
|
<Facts orgId={team.org.id} orgKind={team.org.kind} orgName={team.org.name} accent={accent} />
|
||||||
|
|
@ -94,7 +95,7 @@ export default function TeamDetail() {
|
||||||
id: 'members',
|
id: 'members',
|
||||||
title: hasAbout ? 'Members' : team.name,
|
title: hasAbout ? 'Members' : team.name,
|
||||||
accent,
|
accent,
|
||||||
background: hasAbout ? '#eef9fb' : '#ffffff',
|
background: hasAbout ? 'var(--color-tint)' : 'var(--color-surface)',
|
||||||
content: (
|
content: (
|
||||||
<div className="max-w-6xl mx-auto px-6 space-y-6">
|
<div className="max-w-6xl mx-auto px-6 space-y-6">
|
||||||
{!hasAbout && (
|
{!hasAbout && (
|
||||||
|
|
@ -139,7 +140,7 @@ function Facts({
|
||||||
<Link
|
<Link
|
||||||
to={orgHref(orgId, orgKind)}
|
to={orgHref(orgId, orgKind)}
|
||||||
className="font-medium hover:underline"
|
className="font-medium hover:underline"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
{orgName}
|
{orgName}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -148,7 +149,7 @@ function Facts({
|
||||||
<Link
|
<Link
|
||||||
to={orgHref(orgId, orgKind)}
|
to={orgHref(orgId, orgKind)}
|
||||||
className="ml-auto hover:underline"
|
className="ml-auto hover:underline"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
Back to {orgName}
|
Back to {orgName}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,93 @@
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
|
import LegalText, { type LegalPart } from "../components/LegalText.tsx";
|
||||||
import PageShell from "../components/PageShell.tsx";
|
import PageShell from "../components/PageShell.tsx";
|
||||||
import { sitePage } from "../lib/site.ts";
|
import { sitePage } from "../lib/site.ts";
|
||||||
|
|
||||||
/* Title and intro: site.json, which also gives the search metadata. */
|
/* Title and intro: site.json, which also gives the search metadata. */
|
||||||
const PAGE = sitePage("/terms");
|
const PAGE = sitePage("/terms");
|
||||||
|
|
||||||
|
/* Change the date when the wording changes. */
|
||||||
|
const LAST_UPDATED = "September 28, 2026";
|
||||||
|
|
||||||
|
const link = "underline underline-offset-2 text-link";
|
||||||
|
|
||||||
|
const PARTS: LegalPart[] = [
|
||||||
|
{
|
||||||
|
id: "using-the-site",
|
||||||
|
heading: "Using this site",
|
||||||
|
body: [
|
||||||
|
"This website belongs to Next Generation of Unity (NGU). By using it you agree to these terms. If you don't agree, please don't use the site.",
|
||||||
|
"You're welcome to read, share and link to anything here. Please don't try to break or overload the site, get into parts of it you haven't been given access to, or use it to break the law.",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "our-content",
|
||||||
|
heading: "Our content",
|
||||||
|
body: [
|
||||||
|
"The words, logos, photos and videos on this site belong to NGU or to the people who made them, and are used with permission. You can share them for personal and non-commercial use with credit to NGU. For anything else, including using our name or logo, ask us first.",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "what-you-send",
|
||||||
|
heading: "What you send us",
|
||||||
|
body: [
|
||||||
|
"When you send feedback or a request, you let us use it to answer you and to improve the site and our programs. Please don't send anything unlawful, abusive, or someone else's private information.",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "programs-and-giving",
|
||||||
|
heading: "Programs, events and giving",
|
||||||
|
body: [
|
||||||
|
"Dates, places and details of retreats and other events can change. The event's organizers have the final word, and registering for an event may come with its own terms.",
|
||||||
|
"Gifts are made through Church Center (Planning Center), under its terms. Questions about a gift can come to us.",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "other-sites",
|
||||||
|
heading: "Other sites",
|
||||||
|
body: [
|
||||||
|
"We link to and show videos, maps and posts from other sites. We don't control them and aren't responsible for what they say or do; their own terms and privacy policies apply.",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "staff-accounts",
|
||||||
|
heading: "Staff accounts",
|
||||||
|
body: [
|
||||||
|
"Accounts for editing the site are for NGU staff and volunteers we've set up. Keep your password and sign-in to yourself. We can change or close an account at any time.",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "no-guarantees",
|
||||||
|
heading: "No guarantees",
|
||||||
|
body: [
|
||||||
|
"We work to keep this site accurate and running, but it's provided as it is, without guarantees that it will always be available, complete or free of mistakes. To the extent the law allows, NGU isn't liable for losses that come from using it.",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "changes",
|
||||||
|
heading: "Changes",
|
||||||
|
body: [
|
||||||
|
<>
|
||||||
|
We may update these terms; the date at the top says when they last changed. How we handle personal
|
||||||
|
information is in our <Link className={link} to="/privacy">Privacy Policy</Link>, and you can reach
|
||||||
|
us through the <Link className={link} to="/feedback">feedback form</Link>.
|
||||||
|
</>,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const SECTIONS = [
|
const SECTIONS = [
|
||||||
{
|
{
|
||||||
id: "terms",
|
id: "terms",
|
||||||
title: "Terms of Service",
|
title: "Terms of Service",
|
||||||
blurb: "Last updated: [date]",
|
blurb: `Last updated: ${LAST_UPDATED}`,
|
||||||
accent: "#0f7183",
|
accent: "#0f7183",
|
||||||
background: "#eef9fb",
|
background: "var(--color-surface)",
|
||||||
content: (
|
content: <LegalText parts={PARTS} />,
|
||||||
<div className="max-w-3xl mx-auto px-6 leading-relaxed text-[#2c4a50]">
|
|
||||||
{/* Terms text goes here */}
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function TermsPage() {
|
export default function TermsPage() {
|
||||||
return (
|
return <PageShell title={PAGE.title} intro={PAGE.description} sections={SECTIONS} />;
|
||||||
<PageShell
|
|
||||||
title={PAGE.title}
|
|
||||||
intro={PAGE.description}
|
|
||||||
sections={SECTIONS}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,10 @@ import { useCallback, useEffect, useRef, useState, type ReactNode } from "react"
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
import { ApiError, del, get, post } from "../../lib/api.ts";
|
import { ApiError, del, get, post } from "../../lib/api.ts";
|
||||||
|
import { accentText } from '../../lib/color.ts'
|
||||||
|
|
||||||
const TEAL = "#0f7183";
|
const TEAL = "#0f7183";
|
||||||
const MUTED = "#4a6b72";
|
const MUTED = "var(--color-muted)";
|
||||||
const POLL_MS = 2000;
|
const POLL_MS = 2000;
|
||||||
|
|
||||||
type Job = {
|
type Job = {
|
||||||
|
|
@ -81,29 +82,29 @@ function sizeOf(bytes: number | null): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
const button =
|
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 =
|
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 =
|
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 }) {
|
function Card({ title, children }: { title: string; children: ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<section className="mt-6 rounded-2xl border border-[#138ba0]/20 bg-white p-5">
|
<section className="mt-6 rounded-2xl border border-brand/20 bg-surface p-5">
|
||||||
<h2 className="text-lg font-semibold text-[#26454c]">{title}</h2>
|
<h2 className="text-lg font-semibold text-body">{title}</h2>
|
||||||
<div className="mt-4">{children}</div>
|
<div className="mt-4">{children}</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Status({ job }: { job: Job }) {
|
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;
|
if (job.status === "done") return null;
|
||||||
const percent = Math.round(job.progress * 100);
|
const percent = Math.round(job.progress * 100);
|
||||||
return (
|
return (
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
<div className="h-2 overflow-hidden rounded-full bg-[#eef9fb]">
|
<div className="h-2 overflow-hidden rounded-full bg-tint">
|
||||||
<div className="h-full bg-[#0f7183] transition-all" style={{ width: `${job.status === "queued" ? 0 : percent}%` }} />
|
<div className="h-full bg-action transition-all" style={{ width: `${job.status === "queued" ? 0 : percent}%` }} />
|
||||||
</div>
|
</div>
|
||||||
<p className="mt-1 text-xs" style={{ color: MUTED }}>
|
<p className="mt-1 text-xs" style={{ color: MUTED }}>
|
||||||
{job.status === "queued" ? "Waiting its turn…" : `${percent}%`}
|
{job.status === "queued" ? "Waiting its turn…" : `${percent}%`}
|
||||||
|
|
@ -212,7 +213,7 @@ function Editor({ source, onMade }: { source: Job; onMade: () => void }) {
|
||||||
] as const
|
] as const
|
||||||
).map(([label, text, setText, setAt, value]) => (
|
).map(([label, text, setText, setAt, value]) => (
|
||||||
<div key={label}>
|
<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}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
|
|
@ -233,7 +234,7 @@ function Editor({ source, onMade }: { source: Job; onMade: () => void }) {
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="text-sm underline"
|
className="text-sm underline"
|
||||||
style={{ color: TEAL }}
|
style={{ color: accentText(TEAL) }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (videoRef.current) videoRef.current.currentTime = value;
|
if (videoRef.current) videoRef.current.currentTime = value;
|
||||||
}}
|
}}
|
||||||
|
|
@ -249,7 +250,7 @@ function Editor({ source, onMade }: { source: Job; onMade: () => void }) {
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div>
|
<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">
|
<div className="mt-2 flex gap-4 text-sm">
|
||||||
{[
|
{[
|
||||||
["video", "Video (MP4)"],
|
["video", "Video (MP4)"],
|
||||||
|
|
@ -265,7 +266,7 @@ function Editor({ source, onMade }: { source: Job; onMade: () => void }) {
|
||||||
|
|
||||||
{format === "video" && (
|
{format === "video" && (
|
||||||
<div>
|
<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">
|
<div className="mt-2 grid gap-1.5 text-sm">
|
||||||
{SHAPES.map(([id, label]) => (
|
{SHAPES.map(([id, label]) => (
|
||||||
<label key={id} className="flex items-center gap-2">
|
<label key={id} className="flex items-center gap-2">
|
||||||
|
|
@ -275,7 +276,7 @@ function Editor({ source, onMade }: { source: Job; onMade: () => void }) {
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
{target && (
|
{target && (
|
||||||
<label className="mt-3 block text-sm text-[#26454c]">
|
<label className="mt-3 block text-sm text-body">
|
||||||
Where to crop
|
Where to crop
|
||||||
<input
|
<input
|
||||||
type="range"
|
type="range"
|
||||||
|
|
@ -284,7 +285,7 @@ function Editor({ source, onMade }: { source: Job; onMade: () => void }) {
|
||||||
step={0.01}
|
step={0.01}
|
||||||
value={focus}
|
value={focus}
|
||||||
onChange={(e) => setFocus(Number(e.target.value))}
|
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 }}>
|
<span className="text-xs" style={{ color: MUTED }}>
|
||||||
The white box on the video is what's kept.
|
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}>
|
<button type="button" className={primary} disabled={busy || end <= start} onClick={make}>
|
||||||
{busy ? "Queuing…" : "Make clip"}
|
{busy ? "Queuing…" : "Make clip"}
|
||||||
</button>
|
</button>
|
||||||
{error && <p className="text-sm text-[#b3261e]">{error}</p>}
|
{error && <p className="text-sm text-danger">{error}</p>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
@ -368,14 +369,14 @@ export default function AdminClips() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="flex flex-wrap items-baseline gap-3">
|
<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 }}>
|
<p className="text-sm" style={{ color: MUTED }}>
|
||||||
Cut clips from our YouTube and Facebook videos, for Reels, Shorts, the site or a podcast.
|
Cut clips from our YouTube and Facebook videos, for Reels, Shorts, the site or a podcast.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{missing.length > 0 && (
|
{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
|
{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.
|
won't work until {missing.length > 1 ? "they are" : "it is"}. See docs/video-clips.md.
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -397,15 +398,15 @@ export default function AdminClips() {
|
||||||
<p className="mt-2 text-xs" style={{ color: MUTED }}>
|
<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.
|
YouTube and Facebook links only, and only videos NGU owns or has permission to use. Up to 4 hours long.
|
||||||
</p>
|
</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 && (
|
{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) => (
|
{data.sources.map((s) => (
|
||||||
<li key={s.id} className="py-3">
|
<li key={s.id} className="py-3">
|
||||||
<div className="flex flex-wrap items-center gap-3">
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
<div className="min-w-0 flex-1">
|
<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 }}>
|
<p className="text-xs" style={{ color: MUTED }}>
|
||||||
{[s.duration && clock(s.duration), sizeOf(s.bytes)].filter(Boolean).join(" · ")}
|
{[s.duration && clock(s.duration), sizeOf(s.bytes)].filter(Boolean).join(" · ")}
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -418,7 +419,7 @@ export default function AdminClips() {
|
||||||
{s.status !== "running" && (
|
{s.status !== "running" && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="text-sm hover:text-[#b3261e]"
|
className="text-sm hover:text-danger"
|
||||||
style={{ color: MUTED }}
|
style={{ color: MUTED }}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
window.confirm("Delete this video and its clips from the server?") &&
|
window.confirm("Delete this video and its clips from the server?") &&
|
||||||
|
|
@ -444,13 +445,13 @@ export default function AdminClips() {
|
||||||
|
|
||||||
{data.clips.length > 0 && (
|
{data.clips.length > 0 && (
|
||||||
<Card title="Clips">
|
<Card title="Clips">
|
||||||
{rowError && <p className="mb-3 text-sm text-[#b3261e]">{rowError}</p>}
|
{rowError && <p className="mb-3 text-sm text-danger">{rowError}</p>}
|
||||||
<ul className="divide-y divide-[#138ba0]/10">
|
<ul className="divide-y divide-brand/10">
|
||||||
{data.clips.map((clip) => (
|
{data.clips.map((clip) => (
|
||||||
<li key={clip.id} className="py-3">
|
<li key={clip.id} className="py-3">
|
||||||
<div className="flex flex-wrap items-center gap-3">
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
<div className="min-w-0 flex-1">
|
<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 }}>
|
<p className="text-xs" style={{ color: MUTED }}>
|
||||||
{clip.params &&
|
{clip.params &&
|
||||||
[
|
[
|
||||||
|
|
@ -480,7 +481,7 @@ export default function AdminClips() {
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{clip.saved_url && (
|
{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
|
In the media library
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
|
|
@ -492,7 +493,7 @@ export default function AdminClips() {
|
||||||
{clip.status !== "running" && (
|
{clip.status !== "running" && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="text-sm hover:text-[#b3261e]"
|
className="text-sm hover:text-danger"
|
||||||
style={{ color: MUTED }}
|
style={{ color: MUTED }}
|
||||||
onClick={() => act(() => del(`/admin/clips/${clip.id}`))}
|
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 STATUSES = ["new", "read", "actioned", "archived", "spam"];
|
||||||
|
|
||||||
const STATUS_STYLE = {
|
const STATUS_STYLE = {
|
||||||
new: "bg-[#0f7183] text-white",
|
new: "bg-action text-white",
|
||||||
read: "bg-[#eef9fb] text-[#0f7183]",
|
read: "bg-tint text-link",
|
||||||
actioned: "bg-[#eaf3e2] text-[#4a6b2f]",
|
actioned: "bg-[#eaf3e2] text-[#4a6b2f]",
|
||||||
archived: "bg-[#4a6b72]/10 text-[#4a6b72]",
|
archived: "bg-muted/10 text-muted",
|
||||||
spam: "bg-[#fdf3f2] text-[#b3261e]",
|
spam: "bg-danger-tint text-danger",
|
||||||
};
|
};
|
||||||
|
|
||||||
// created_at is UTC in 'YYYY-MM-DD HH:MM:SS' form, which Safari
|
// 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 (
|
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">
|
<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)}
|
{feedbackTypeLabel(row.feedback_type)}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
|
|
@ -101,15 +101,15 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
||||||
>
|
>
|
||||||
{row.status}
|
{row.status}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-[#4a6b72]">{locationOf(row)}</span>
|
<span className="text-muted">{locationOf(row)}</span>
|
||||||
<span className="ml-auto text-xs text-[#4a6b72]">
|
<span className="ml-auto text-xs text-muted">
|
||||||
#{row.id} · {formatDate(row.created_at)}
|
#{row.id} · {formatDate(row.created_at)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</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 || row.email ? (
|
||||||
<>
|
<>
|
||||||
{row.name && <span>{row.name}</span>}
|
{row.name && <span>{row.name}</span>}
|
||||||
|
|
@ -117,7 +117,7 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
||||||
{row.email && (
|
{row.email && (
|
||||||
<a
|
<a
|
||||||
href={`mailto:${row.email}?subject=Your%20NGU%20site%20feedback`}
|
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}
|
{row.email}
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -129,11 +129,11 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{canWrite && (
|
{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">
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
<label
|
<label
|
||||||
htmlFor={`status-${row.id}`}
|
htmlFor={`status-${row.id}`}
|
||||||
className="text-sm font-medium text-[#26454c]"
|
className="text-sm font-medium text-body"
|
||||||
>
|
>
|
||||||
Status
|
Status
|
||||||
</label>
|
</label>
|
||||||
|
|
@ -142,7 +142,7 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
||||||
value={row.status}
|
value={row.status}
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
onChange={(e) => save({ status: e.target.value })}
|
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) => (
|
{STATUSES.map((s) => (
|
||||||
<option key={s} value={s}>
|
<option key={s} value={s}>
|
||||||
|
|
@ -158,14 +158,14 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
placeholder="Internal note: who's handling it, what was done"
|
placeholder="Internal note: who's handling it, what was done"
|
||||||
onChange={(e) => setNote(e.target.value)}
|
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 && (
|
{noteDirty && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
onClick={() => save({ admin_note: note })}
|
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"}
|
{busy ? "Saving…" : "Save note"}
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -177,17 +177,17 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
||||||
spam or archived is the habit this defers to. Hence the
|
spam or archived is the habit this defers to. Hence the
|
||||||
second click rather than a window.confirm. */}
|
second click rather than a window.confirm. */}
|
||||||
{canRemove && (
|
{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 ? (
|
{confirming ? (
|
||||||
<>
|
<>
|
||||||
<span className="text-sm text-[#26454c]">
|
<span className="text-sm text-body">
|
||||||
Delete #{row.id} for good? Marking it spam keeps it recoverable.
|
Delete #{row.id} for good? Marking it spam keeps it recoverable.
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
onClick={remove}
|
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"}
|
{busy ? "Deleting…" : "Delete"}
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -195,7 +195,7 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
||||||
type="button"
|
type="button"
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
onClick={() => setConfirming(false)}
|
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
|
Keep it
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -205,7 +205,7 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
||||||
type="button"
|
type="button"
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
onClick={() => setConfirming(true)}
|
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
|
Delete
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -214,7 +214,7 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<p role="alert" className="mt-3 text-sm text-[#b3261e]">
|
<p role="alert" className="mt-3 text-sm text-danger">
|
||||||
{error}
|
{error}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
@ -305,8 +305,8 @@ export default function AdminFeedback() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-3xl font-bold text-[#0f7183]">Feedback</h1>
|
<h1 className="text-3xl font-bold text-link">Feedback</h1>
|
||||||
<p className="mt-2 text-sm text-[#4a6b72]">
|
<p className="mt-2 text-sm text-muted">
|
||||||
{canWrite
|
{canWrite
|
||||||
? "Everything submitted through the site form."
|
? "Everything submitted through the site form."
|
||||||
: "Read-only: your account can't change statuses or notes."}
|
: "Read-only: your account can't change statuses or notes."}
|
||||||
|
|
@ -322,8 +322,8 @@ export default function AdminFeedback() {
|
||||||
className={
|
className={
|
||||||
"rounded-full px-4 py-1.5 text-sm transition-colors " +
|
"rounded-full px-4 py-1.5 text-sm transition-colors " +
|
||||||
(status === tab.id
|
(status === tab.id
|
||||||
? "bg-[#0f7183] font-semibold text-white"
|
? "bg-action font-semibold text-white"
|
||||||
: "border border-[#4a6b72]/25 text-[#4a6b72] hover:border-[#138ba0]/50")
|
: "border border-muted/25 text-muted hover:border-brand/50")
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{tab.label}
|
{tab.label}
|
||||||
|
|
@ -340,12 +340,12 @@ export default function AdminFeedback() {
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key === "Enter") setSearch(query.trim());
|
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
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setSearch(query.trim())}
|
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
|
Search
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -356,14 +356,14 @@ export default function AdminFeedback() {
|
||||||
{error && (
|
{error && (
|
||||||
<p
|
<p
|
||||||
role="alert"
|
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}
|
{error}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!loading && rows.length === 0 && !error && (
|
{!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."}
|
Nothing here. {status === "new" ? "The queue is clear." : "Try another filter."}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
@ -381,13 +381,13 @@ export default function AdminFeedback() {
|
||||||
))}
|
))}
|
||||||
</div>
|
</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 && (
|
{cursor && !loading && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => load(cursor)}
|
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
|
Load older
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,9 @@ function NavCard({ item }) {
|
||||||
const extras = (item.children ?? []).filter((child) => child.to !== to);
|
const extras = (item.children ?? []).filter((child) => child.to !== to);
|
||||||
|
|
||||||
return (
|
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">
|
<div className="flex items-baseline gap-3">
|
||||||
<h3 className="text-base font-semibold text-[#0f7183]">
|
<h3 className="text-base font-semibold text-link">
|
||||||
<Link
|
<Link
|
||||||
to={to}
|
to={to}
|
||||||
className="after:absolute after:inset-0 after:rounded-2xl after:content-['']"
|
className="after:absolute after:inset-0 after:rounded-2xl after:content-['']"
|
||||||
|
|
@ -46,23 +46,23 @@ function NavCard({ item }) {
|
||||||
</h3>
|
</h3>
|
||||||
<span
|
<span
|
||||||
aria-hidden="true"
|
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>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{item.blurb && (
|
{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 && (
|
{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) => (
|
{extras.map((child) => (
|
||||||
<Link
|
<Link
|
||||||
key={child.to}
|
key={child.to}
|
||||||
to={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}
|
{child.label}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -77,8 +77,8 @@ function CardBlock({ title, blurb, children }) {
|
||||||
return (
|
return (
|
||||||
<div className="mt-10">
|
<div className="mt-10">
|
||||||
<div className="flex items-baseline gap-3">
|
<div className="flex items-baseline gap-3">
|
||||||
<h2 className="text-lg font-semibold text-[#0f7183]">{title}</h2>
|
<h2 className="text-lg font-semibold text-link">{title}</h2>
|
||||||
{blurb && <p className="text-sm text-[#4a6b72]">{blurb}</p>}
|
{blurb && <p className="text-sm text-muted">{blurb}</p>}
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-4 grid gap-4 sm:grid-cols-2">{children}</div>
|
<div className="mt-4 grid gap-4 sm:grid-cols-2">{children}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -87,11 +87,11 @@ function CardBlock({ title, blurb, children }) {
|
||||||
|
|
||||||
function PanelSection({ title, children }) {
|
function PanelSection({ title, children }) {
|
||||||
return (
|
return (
|
||||||
<section className="border-b border-[#138ba0]/10 px-5 py-4 last:border-b-0">
|
<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-[#4a6b72]/70">
|
<h2 className="text-xs font-semibold uppercase tracking-wider text-muted/70">
|
||||||
{title}
|
{title}
|
||||||
</h2>
|
</h2>
|
||||||
<div className="mt-2.5 text-sm text-[#4a6b72]">{children}</div>
|
<div className="mt-2.5 text-sm text-muted">{children}</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -114,10 +114,10 @@ export default function AdminHome() {
|
||||||
return (
|
return (
|
||||||
<div className="grid gap-8 lg:grid-cols-[1fr_17rem] lg:items-start">
|
<div className="grid gap-8 lg:grid-cols-[1fr_17rem] lg:items-start">
|
||||||
<div>
|
<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."}
|
{user?.name ? `Welcome back, ${user.name.split(" ")[0]}.` : "Welcome back."}
|
||||||
</h1>
|
</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) => (
|
{GROUPS.map((group) => (
|
||||||
<CardBlock key={group.label} title={group.label} blurb={group.blurb}>
|
<CardBlock key={group.label} title={group.label} blurb={group.blurb}>
|
||||||
|
|
@ -137,14 +137,14 @@ export default function AdminHome() {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Sticky so it stays put once the card column outgrows it. */}
|
{/* 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">
|
<PanelSection title="Signed in">
|
||||||
<p className="font-medium text-[#0f2f36]">{user?.name || user?.email}</p>
|
<p className="font-medium text-[#0f2f36]">{user?.name || user?.email}</p>
|
||||||
{user?.name && user?.email && (
|
{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 && (
|
{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}
|
{role}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
@ -156,7 +156,7 @@ export default function AdminHome() {
|
||||||
<li key={link.to}>
|
<li key={link.to}>
|
||||||
<Link
|
<Link
|
||||||
to={link.to}
|
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.label}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -166,12 +166,12 @@ export default function AdminHome() {
|
||||||
</PanelSection>
|
</PanelSection>
|
||||||
|
|
||||||
<PanelSection title="Site">
|
<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
|
<a
|
||||||
href="/"
|
href="/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
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 ↗
|
View the public site ↗
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import { AdminWidthContext } from "../../lib/adminWidth.tsx";
|
||||||
import { SITE_VERSION } from "../../lib/version.ts";
|
import { SITE_VERSION } from "../../lib/version.ts";
|
||||||
import { ROLE_LABELS, isSuper } from "../../lib/roles.ts";
|
import { ROLE_LABELS, isSuper } from "../../lib/roles.ts";
|
||||||
import nguLogo from "../../assets/logos/NGU_Logo.svg";
|
import nguLogo from "../../assets/logos/NGU_Logo.svg";
|
||||||
|
import ThemeToggle from "../../components/ThemeToggle.tsx";
|
||||||
import {
|
import {
|
||||||
ADMIN_HOME,
|
ADMIN_HOME,
|
||||||
AREA_TITLES,
|
AREA_TITLES,
|
||||||
|
|
@ -45,8 +46,8 @@ import {
|
||||||
function GroupMenu({ item, lit, pathname }) {
|
function GroupMenu({ item, lit, pathname }) {
|
||||||
const children = item.children ?? [];
|
const children = item.children ?? [];
|
||||||
const link = lit
|
const link = lit
|
||||||
? "font-semibold text-[#0f7183]"
|
? "font-semibold text-link"
|
||||||
: "text-[#4a6b72] transition-colors hover:text-[#0f7183]";
|
: "text-muted transition-colors hover:text-link";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="group relative">
|
<div className="group relative">
|
||||||
|
|
@ -61,15 +62,15 @@ function GroupMenu({ item, lit, pathname }) {
|
||||||
|
|
||||||
{children.length > 1 && (
|
{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">
|
<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) => (
|
{children.map((child) => (
|
||||||
<li key={child.to}>
|
<li key={child.to}>
|
||||||
<NavLink
|
<NavLink
|
||||||
to={child.to}
|
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)
|
matches(pathname, child.to)
|
||||||
? "font-semibold text-[#0f7183]"
|
? "font-semibold text-link"
|
||||||
: "text-[#26454c]"
|
: "text-body"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{child.label}
|
{child.label}
|
||||||
|
|
@ -130,11 +131,11 @@ export default function AdminLayout() {
|
||||||
|
|
||||||
const subnav = active?.children ?? [];
|
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 (
|
return (
|
||||||
<div className="flex min-h-screen flex-col bg-[#f6fbfc]">
|
<div className="flex min-h-screen flex-col bg-tint-soft">
|
||||||
<header className="border-b border-[#138ba0]/20 bg-white">
|
<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">
|
<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. */}
|
{/* Already home, so nothing to link to. */}
|
||||||
{isHome ? (
|
{isHome ? (
|
||||||
|
|
@ -156,7 +157,7 @@ export default function AdminLayout() {
|
||||||
{item.separated && (
|
{item.separated && (
|
||||||
<span
|
<span
|
||||||
aria-hidden="true"
|
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} />
|
<GroupMenu item={item} lit={item === active} pathname={pathname} />
|
||||||
|
|
@ -165,14 +166,15 @@ export default function AdminLayout() {
|
||||||
</nav>
|
</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>
|
<span>
|
||||||
{user?.name || user?.email}
|
{user?.name || user?.email}
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={handleLogout}
|
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
|
Sign out
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -182,7 +184,7 @@ export default function AdminLayout() {
|
||||||
{/* Subnav. Only drawn where there is something to draw, so
|
{/* Subnav. Only drawn where there is something to draw, so
|
||||||
Events and People don't get an empty grey strip. */}
|
Events and People don't get an empty grey strip. */}
|
||||||
{subnav.length > 0 && (
|
{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">
|
<div className="mx-auto flex max-w-5xl flex-wrap gap-6 px-6 py-2.5 text-sm">
|
||||||
{subnav.map((child) => (
|
{subnav.map((child) => (
|
||||||
<NavLink
|
<NavLink
|
||||||
|
|
@ -190,8 +192,8 @@ export default function AdminLayout() {
|
||||||
to={child.to}
|
to={child.to}
|
||||||
className={
|
className={
|
||||||
child === activeChild
|
child === activeChild
|
||||||
? "font-semibold text-[#0f7183]"
|
? "font-semibold text-link"
|
||||||
: "text-[#4a6b72] transition-colors hover:text-[#0f7183]"
|
: "text-muted transition-colors hover:text-link"
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{child.label}
|
{child.label}
|
||||||
|
|
@ -213,12 +215,12 @@ export default function AdminLayout() {
|
||||||
</AdminTitleContext.Provider>
|
</AdminTitleContext.Provider>
|
||||||
</main>
|
</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">
|
<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">
|
<Link to={ADMIN_HOME} className="transition-opacity hover:opacity-70">
|
||||||
<img src={nguLogo} alt="NGU" className="h-6 w-auto" />
|
<img src={nguLogo} alt="NGU" className="h-6 w-auto" />
|
||||||
</Link>
|
</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}
|
{SITE_VERSION}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ const GOOGLE_ERRORS: Record<string, string> = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fieldClass =
|
const fieldClass =
|
||||||
"w-full rounded-xl border border-[#4a6b72]/25 bg-white px-4 py-3 text-[#26454c] " +
|
"w-full rounded-xl border border-muted/25 bg-surface px-4 py-3 text-body " +
|
||||||
"outline-none transition-colors focus:border-[#138ba0] focus:ring-2 focus:ring-[#138ba0]/25";
|
"outline-none transition-colors focus:border-brand focus:ring-2 focus:ring-brand/25";
|
||||||
|
|
||||||
export default function AdminLogin() {
|
export default function AdminLogin() {
|
||||||
const { login } = useAuth();
|
const { login } = useAuth();
|
||||||
|
|
@ -85,23 +85,23 @@ export default function AdminLogin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
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">
|
<div className="w-full max-w-sm">
|
||||||
<h1 className="text-3xl font-bold text-[#0f7183]">NGU admin</h1>
|
<h1 className="text-3xl font-bold text-link">NGU admin</h1>
|
||||||
<p className="mt-2 text-sm text-[#4a6b72]">
|
<p className="mt-2 text-sm text-muted">
|
||||||
Sign in to edit the site.
|
Sign in to edit the site.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form
|
<form
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
noValidate
|
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 && (
|
{google && (
|
||||||
<>
|
<>
|
||||||
<a
|
<a
|
||||||
href={`/api/auth/google?next=${encodeURIComponent(destination)}`}
|
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">
|
<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" />
|
<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>
|
</svg>
|
||||||
Sign in with Google
|
Sign in with Google
|
||||||
</a>
|
</a>
|
||||||
<div className="my-6 flex items-center gap-3 text-xs text-[#4a6b72]">
|
<div className="my-6 flex items-center gap-3 text-xs text-muted">
|
||||||
<span className="h-px flex-1 bg-[#4a6b72]/20" />
|
<span className="h-px flex-1 bg-muted/20" />
|
||||||
or with a password
|
or with a password
|
||||||
<span className="h-px flex-1 bg-[#4a6b72]/20" />
|
<span className="h-px flex-1 bg-muted/20" />
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<label
|
<label
|
||||||
htmlFor="admin-email"
|
htmlFor="admin-email"
|
||||||
className="block text-sm font-medium text-[#26454c]"
|
className="block text-sm font-medium text-body"
|
||||||
>
|
>
|
||||||
Email
|
Email
|
||||||
</label>
|
</label>
|
||||||
|
|
@ -137,7 +137,7 @@ export default function AdminLogin() {
|
||||||
|
|
||||||
<label
|
<label
|
||||||
htmlFor="admin-password"
|
htmlFor="admin-password"
|
||||||
className="mt-5 block text-sm font-medium text-[#26454c]"
|
className="mt-5 block text-sm font-medium text-body"
|
||||||
>
|
>
|
||||||
Password
|
Password
|
||||||
</label>
|
</label>
|
||||||
|
|
@ -153,7 +153,7 @@ export default function AdminLogin() {
|
||||||
{error && (
|
{error && (
|
||||||
<p
|
<p
|
||||||
role="alert"
|
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}
|
{error}
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -162,14 +162,14 @@ export default function AdminLogin() {
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={busy || !email || !password}
|
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"}
|
{busy ? "Signing in…" : "Sign in"}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</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.
|
Accounts are created on the server. Ask whoever runs the box.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -64,17 +64,17 @@ function DeleteControl({ item, onDeleted }: { item: MediaItem; onDeleted: () =>
|
||||||
type="button"
|
type="button"
|
||||||
onClick={ask}
|
onClick={ask}
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
className="text-xs text-[#4a6b72] hover:text-[#b3261e]"
|
className="text-xs text-muted hover:text-danger"
|
||||||
>
|
>
|
||||||
Delete
|
Delete
|
||||||
</button>
|
</button>
|
||||||
{error && <p className="mt-1 text-xs text-[#b3261e]">{error}</p>}
|
{error && <p className="mt-1 text-xs text-danger">{error}</p>}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
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 ? (
|
{uses.length > 0 ? (
|
||||||
<p>
|
<p>
|
||||||
Still used by{" "}
|
Still used by{" "}
|
||||||
|
|
@ -89,15 +89,15 @@ function DeleteControl({ item, onDeleted }: { item: MediaItem; onDeleted: () =>
|
||||||
type="button"
|
type="button"
|
||||||
onClick={remove}
|
onClick={remove}
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
className="font-medium text-[#b3261e] hover:underline"
|
className="font-medium text-danger hover:underline"
|
||||||
>
|
>
|
||||||
{busy ? "Deleting…" : "Delete for good"}
|
{busy ? "Deleting…" : "Delete for good"}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" onClick={() => setUses(null)} className="text-[#4a6b72] hover:underline">
|
<button type="button" onClick={() => setUses(null)} className="text-muted hover:underline">
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{error && <p className="mt-1 text-[#b3261e]">{error}</p>}
|
{error && <p className="mt-1 text-danger">{error}</p>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -113,7 +113,7 @@ function CopyPath({ url }: { url: string }) {
|
||||||
setTimeout(() => setCopied(false), 1500);
|
setTimeout(() => setCopied(false), 1500);
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
className="text-xs text-[#0f7183] hover:underline"
|
className="text-xs text-link hover:underline"
|
||||||
>
|
>
|
||||||
{copied ? "Copied" : "Copy path"}
|
{copied ? "Copied" : "Copy path"}
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -128,8 +128,8 @@ export default function AdminMedia() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="flex flex-wrap items-baseline gap-3">
|
<div className="flex flex-wrap items-baseline gap-3">
|
||||||
<h1 className="text-2xl font-bold text-[#0f7183]">Media</h1>
|
<h1 className="text-2xl font-bold text-link">Media</h1>
|
||||||
<p className="text-sm text-[#4a6b72]">
|
<p className="text-sm text-muted">
|
||||||
Uploaded images. Image fields in every editor pick from here.
|
Uploaded images. Image fields in every editor pick from here.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -142,7 +142,7 @@ export default function AdminMedia() {
|
||||||
label="Upload images"
|
label="Upload images"
|
||||||
onUploaded={(item) => setItems((current) => [item, ...(current ?? [])])}
|
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>
|
</div>
|
||||||
)}
|
)}
|
||||||
<input
|
<input
|
||||||
|
|
@ -150,15 +150,15 @@ export default function AdminMedia() {
|
||||||
value={query}
|
value={query}
|
||||||
onChange={(e) => setQuery(e.target.value)}
|
onChange={(e) => setQuery(e.target.value)}
|
||||||
placeholder="Search by file name"
|
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>
|
||||||
|
|
||||||
<div className="mt-6">
|
<div className="mt-6">
|
||||||
{error ? (
|
{error ? (
|
||||||
<p className="text-sm text-[#b3261e]">{error}</p>
|
<p className="text-sm text-danger">{error}</p>
|
||||||
) : items === null ? (
|
) : items === null ? (
|
||||||
<p className="text-sm text-[#4a6b72]">Loading…</p>
|
<p className="text-sm text-muted">Loading…</p>
|
||||||
) : (
|
) : (
|
||||||
<MediaGrid
|
<MediaGrid
|
||||||
items={items}
|
items={items}
|
||||||
|
|
@ -169,7 +169,7 @@ export default function AdminMedia() {
|
||||||
href={item.url}
|
href={item.url}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
className="text-xs text-[#0f7183] hover:underline"
|
className="text-xs text-link hover:underline"
|
||||||
>
|
>
|
||||||
Open
|
Open
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,8 @@ function Block({ title, note, children }: any) {
|
||||||
return (
|
return (
|
||||||
<section className="mt-8 first:mt-0">
|
<section className="mt-8 first:mt-0">
|
||||||
<div className="flex items-baseline gap-3">
|
<div className="flex items-baseline gap-3">
|
||||||
<h2 className="text-lg font-semibold text-[#0f7183]">{title}</h2>
|
<h2 className="text-lg font-semibold text-link">{title}</h2>
|
||||||
{note && <p className="text-sm text-[#4a6b72]">{note}</p>}
|
{note && <p className="text-sm text-muted">{note}</p>}
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-3">{children}</div>
|
<div className="mt-3">{children}</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -64,8 +64,8 @@ function Block({ title, note, children }: any) {
|
||||||
|
|
||||||
function Stat({ label, value }) {
|
function Stat({ label, value }) {
|
||||||
return (
|
return (
|
||||||
<div className="rounded-xl border border-[#138ba0]/20 bg-white px-4 py-3">
|
<div className="rounded-xl border border-brand/20 bg-surface px-4 py-3">
|
||||||
<div className="text-xs font-medium uppercase tracking-wider text-[#4a6b72]/70">
|
<div className="text-xs font-medium uppercase tracking-wider text-muted/70">
|
||||||
{label}
|
{label}
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-1 break-words text-sm font-medium text-[#0f2f36]">{value}</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) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<p className="py-12 text-[#4a6b72]" role="status">
|
<p className="py-12 text-muted" role="status">
|
||||||
Loading the panel…
|
Loading the panel…
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
|
|
@ -152,11 +152,11 @@ export default function AdminPanel() {
|
||||||
if (error) {
|
if (error) {
|
||||||
return (
|
return (
|
||||||
<div className="py-12">
|
<div className="py-12">
|
||||||
<p className="text-[#b3261e]">{error}</p>
|
<p className="text-danger">{error}</p>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={load}
|
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
|
Try again
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -171,8 +171,8 @@ export default function AdminPanel() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-2xl font-bold text-[#0f7183]">Panel</h1>
|
<h1 className="text-2xl font-bold text-link">Panel</h1>
|
||||||
<p className="mt-1 text-[#4a6b72]">
|
<p className="mt-1 text-muted">
|
||||||
Accounts and server state. Everything here is superadmin-only.
|
Accounts and server state. Everything here is superadmin-only.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
@ -186,7 +186,7 @@ export default function AdminPanel() {
|
||||||
<Stat label="Live sessions" value={system.sessions} />
|
<Stat label="Live sessions" value={system.sessions} />
|
||||||
</div>
|
</div>
|
||||||
{system.dbPath && (
|
{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>
|
</Block>
|
||||||
|
|
||||||
|
|
@ -195,7 +195,7 @@ export default function AdminPanel() {
|
||||||
{content.map((row) => (
|
{content.map((row) => (
|
||||||
<span
|
<span
|
||||||
key={row.label}
|
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}{" "}
|
{row.label}{" "}
|
||||||
<strong className="font-semibold text-[#0f2f36]">
|
<strong className="font-semibold text-[#0f2f36]">
|
||||||
|
|
@ -210,9 +210,9 @@ export default function AdminPanel() {
|
||||||
title="Accounts"
|
title="Accounts"
|
||||||
note="Changing a role or disabling an account signs that person out."
|
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">
|
<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>
|
<tr>
|
||||||
<th className="px-4 py-3 font-medium">Account</th>
|
<th className="px-4 py-3 font-medium">Account</th>
|
||||||
<th className="px-4 py-3 font-medium">Role</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>
|
<th className="px-4 py-3 font-medium">Access</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody className="divide-y divide-[#138ba0]/10">
|
<tbody className="divide-y divide-brand/10">
|
||||||
{users.map((row) => {
|
{users.map((row) => {
|
||||||
const isMe = row.id === me?.id;
|
const isMe = row.id === me?.id;
|
||||||
const lastSuper =
|
const lastSuper =
|
||||||
|
|
@ -230,21 +230,21 @@ export default function AdminPanel() {
|
||||||
const busy = busyId === row.id;
|
const busy = busyId === row.id;
|
||||||
|
|
||||||
return (
|
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">
|
<td className="px-4 py-3">
|
||||||
<div className="font-medium text-[#0f2f36]">
|
<div className="font-medium text-[#0f2f36]">
|
||||||
{row.name || row.email}
|
{row.name || row.email}
|
||||||
{isMe && (
|
{isMe && (
|
||||||
<span className="ml-2 text-xs font-normal text-[#4a6b72]/70">
|
<span className="ml-2 text-xs font-normal text-muted/70">
|
||||||
you
|
you
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{row.name && (
|
{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 && (
|
{rowError?.id === row.id && (
|
||||||
<div className="mt-1 text-xs text-[#b3261e]">
|
<div className="mt-1 text-xs text-danger">
|
||||||
{rowError.message}
|
{rowError.message}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
@ -255,7 +255,7 @@ export default function AdminPanel() {
|
||||||
value={row.role}
|
value={row.role}
|
||||||
disabled={locked || busy}
|
disabled={locked || busy}
|
||||||
onChange={(e) => changeRole(row, e.target.value)}
|
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={
|
title={
|
||||||
isMe
|
isMe
|
||||||
? "You can't change your own role."
|
? "You can't change your own role."
|
||||||
|
|
@ -272,16 +272,16 @@ export default function AdminPanel() {
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</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">
|
<td className="px-4 py-3">
|
||||||
<span className="text-[#4a6b72]">{row.sessions}</span>
|
<span className="text-muted">{row.sessions}</span>
|
||||||
{row.sessions > 0 && (
|
{row.sessions > 0 && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
onClick={() => revoke(row)}
|
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
|
Sign out
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -295,8 +295,8 @@ export default function AdminPanel() {
|
||||||
onClick={() => setActive(row, row.is_active ? 0 : 1)}
|
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 ${
|
className={`rounded-full border px-3 py-1 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${
|
||||||
row.is_active
|
row.is_active
|
||||||
? "border-[#4a6b72]/30 text-[#4a6b72] hover:border-[#b3261e]/50 hover:text-[#b3261e]"
|
? "border-muted/30 text-muted hover:border-danger/50 hover:text-danger"
|
||||||
: "border-[#138ba0]/40 text-[#0f7183] hover:bg-[#eef9fb]"
|
: "border-brand/40 text-link hover:bg-tint"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{row.is_active ? "Disable" : "Enable"}
|
{row.is_active ? "Disable" : "Enable"}
|
||||||
|
|
@ -317,12 +317,12 @@ export default function AdminPanel() {
|
||||||
<dt className="shrink-0 font-medium text-[#0f2f36]">
|
<dt className="shrink-0 font-medium text-[#0f2f36]">
|
||||||
{ROLE_LABELS[role]}
|
{ROLE_LABELS[role]}
|
||||||
</dt>
|
</dt>
|
||||||
<dd className="text-[#4a6b72]">{ROLE_NOTES[role]}</dd>
|
<dd className="text-muted">{ROLE_NOTES[role]}</dd>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</dl>
|
</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.
|
New accounts are still created with <code>admin-cli.js</code> on the server.
|
||||||
</p>
|
</p>
|
||||||
</Block>
|
</Block>
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ import {
|
||||||
|
|
||||||
/* One card per section. scroll-mt clears the sticky "Jump to" bar
|
/* One card per section. scroll-mt clears the sticky "Jump to" bar
|
||||||
below lg, and leaves a little air above the card on desktop. */
|
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)}`;
|
const sectionId = (name) => `section-${slugify(name)}`;
|
||||||
|
|
||||||
|
|
@ -225,8 +225,8 @@ export default function EntityEdit() {
|
||||||
return () => window.removeEventListener("beforeunload", warn);
|
return () => window.removeEventListener("beforeunload", warn);
|
||||||
}, [dirty]);
|
}, [dirty]);
|
||||||
|
|
||||||
if (!manifest) return <p className="text-[#4a6b72]">No such thing to edit.</p>;
|
if (!manifest) return <p className="text-muted">No such thing to edit.</p>;
|
||||||
if (loading || !form) return <p className="text-[#4a6b72]">Loading…</p>;
|
if (loading || !form) return <p className="text-muted">Loading…</p>;
|
||||||
|
|
||||||
/* ── Heading ───────────────────────────────────────────────── */
|
/* ── Heading ───────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
|
@ -356,13 +356,13 @@ export default function EntityEdit() {
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => leave(`/admin/${manifest.key}`)}
|
onClick={() => leave(`/admin/${manifest.key}`)}
|
||||||
className="text-sm text-[#4a6b72] hover:text-[#0f7183]"
|
className="text-sm text-muted hover:text-link"
|
||||||
>
|
>
|
||||||
← {manifest.label}
|
← {manifest.label}
|
||||||
</button>
|
</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}
|
{isNew ? `New ${manifest.singular}` : heading}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
|
|
@ -385,13 +385,13 @@ export default function EntityEdit() {
|
||||||
{singleton ? (
|
{singleton ? (
|
||||||
updatedAt && (
|
updatedAt && (
|
||||||
<div className={CARD}>
|
<div className={CARD}>
|
||||||
<p className="text-sm text-[#4a6b72]">Last saved {updatedAt}</p>
|
<p className="text-sm text-muted">Last saved {updatedAt}</p>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
) : autoId ? (
|
) : autoId ? (
|
||||||
!isNew && (
|
!isNew && (
|
||||||
<div id="section-url-id" className={CARD}>
|
<div id="section-url-id" className={CARD}>
|
||||||
<p className="text-sm text-[#4a6b72]">
|
<p className="text-sm text-muted">
|
||||||
{manifest.idLabel} #{form.id}
|
{manifest.idLabel} #{form.id}
|
||||||
{form.updated_at && <> · last saved {form.updated_at}</>}
|
{form.updated_at && <> · last saved {form.updated_at}</>}
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -421,7 +421,7 @@ export default function EntityEdit() {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{!isNew && form.updated_at && (
|
{!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}
|
Last saved {form.updated_at}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
@ -431,8 +431,8 @@ export default function EntityEdit() {
|
||||||
{/* Field groups */}
|
{/* Field groups */}
|
||||||
{groups.map((group) => (
|
{groups.map((group) => (
|
||||||
<section key={group.legend} id={sectionId(group.legend)} className={CARD}>
|
<section key={group.legend} id={sectionId(group.legend)} className={CARD}>
|
||||||
<h2 className="text-lg font-semibold text-[#26454c]">{group.legend}</h2>
|
<h2 className="text-lg font-semibold text-body">{group.legend}</h2>
|
||||||
{group.note && <p className="mt-1 text-sm text-[#4a6b72]">{group.note}</p>}
|
{group.note && <p className="mt-1 text-sm text-muted">{group.note}</p>}
|
||||||
<div className="mt-4">
|
<div className="mt-4">
|
||||||
<FieldGrid>
|
<FieldGrid>
|
||||||
{group.fields.map((field) => (
|
{group.fields.map((field) => (
|
||||||
|
|
@ -470,7 +470,7 @@ export default function EntityEdit() {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Sticky action bar */}
|
{/* 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">
|
<div className="mx-auto flex max-w-5xl flex-wrap items-center gap-4 px-6 py-3">
|
||||||
{canWrite ? (
|
{canWrite ? (
|
||||||
<>
|
<>
|
||||||
|
|
@ -478,7 +478,7 @@ export default function EntityEdit() {
|
||||||
type="button"
|
type="button"
|
||||||
onClick={save}
|
onClick={save}
|
||||||
disabled={saving || !dirty}
|
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"}
|
{saving ? "Saving…" : isNew ? "Create" : "Save changes"}
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -486,27 +486,27 @@ export default function EntityEdit() {
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={remove}
|
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
|
Delete
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<span className="text-sm text-[#4a6b72]">
|
<span className="text-sm text-muted">
|
||||||
Read-only: your account can view this but not change it.
|
Read-only: your account can view this but not change it.
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{dirty && !saving && (
|
{dirty && !saving && (
|
||||||
<span className="text-sm text-[#4a6b72]">Unsaved changes</span>
|
<span className="text-sm text-muted">Unsaved changes</span>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{message && (
|
{message && (
|
||||||
<span
|
<span
|
||||||
role="status"
|
role="status"
|
||||||
className={`flex items-center gap-2 text-sm ${
|
className={`flex items-center gap-2 text-sm ${
|
||||||
message.tone === "ok" ? "text-[#0f7183]" : "text-[#b3261e]"
|
message.tone === "ok" ? "text-link" : "text-danger"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{message.text}
|
{message.text}
|
||||||
|
|
@ -514,7 +514,7 @@ export default function EntityEdit() {
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={load}
|
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
|
Reload
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ export default function EntityList() {
|
||||||
}, [load]);
|
}, [load]);
|
||||||
|
|
||||||
if (!manifest) {
|
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.
|
// One row, so no list: the tab opens the row.
|
||||||
|
|
@ -92,11 +92,11 @@ export default function EntityList() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="flex flex-wrap items-center gap-4">
|
<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 && (
|
{canWrite && (
|
||||||
<Link
|
<Link
|
||||||
to={`/admin/${manifest.key}/new`}
|
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}
|
New {manifest.singular}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -106,12 +106,12 @@ export default function EntityList() {
|
||||||
{/* Filters */}
|
{/* Filters */}
|
||||||
<div className="mt-6 flex flex-wrap items-end gap-3">
|
<div className="mt-6 flex flex-wrap items-end gap-3">
|
||||||
{manifest.list.filters.map((filter) => (
|
{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>
|
<span className="block">{filter.label}</span>
|
||||||
<select
|
<select
|
||||||
value={params.get(filter.key) ?? ""}
|
value={params.get(filter.key) ?? ""}
|
||||||
onChange={(e) => setParam(filter.key, e.target.value)}
|
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>
|
<option value="">All</option>
|
||||||
{labelFor(filter).map(([value, label]) => (
|
{labelFor(filter).map(([value, label]) => (
|
||||||
|
|
@ -130,12 +130,12 @@ export default function EntityList() {
|
||||||
placeholder="Search"
|
placeholder="Search"
|
||||||
onChange={(e) => setQuery(e.target.value)}
|
onChange={(e) => setQuery(e.target.value)}
|
||||||
onKeyDown={(e) => e.key === "Enter" && setParam("q", query.trim())}
|
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
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setParam("q", query.trim())}
|
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
|
Search
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -145,16 +145,16 @@ export default function EntityList() {
|
||||||
{error && (
|
{error && (
|
||||||
<p
|
<p
|
||||||
role="alert"
|
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}
|
{error}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Rows */}
|
{/* 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">
|
<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>
|
<tr>
|
||||||
{manifest.list.columns.map((column) => (
|
{manifest.list.columns.map((column) => (
|
||||||
<th key={column.key} className="px-4 py-3 font-medium">
|
<th key={column.key} className="px-4 py-3 font-medium">
|
||||||
|
|
@ -170,14 +170,14 @@ export default function EntityList() {
|
||||||
{rows.map((row) => (
|
{rows.map((row) => (
|
||||||
<tr
|
<tr
|
||||||
key={row.id}
|
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}`)}
|
onClick={() => navigate(`/admin/${manifest.key}/${row.id}`)}
|
||||||
>
|
>
|
||||||
{manifest.list.columns.map((column) => (
|
{manifest.list.columns.map((column) => (
|
||||||
<td
|
<td
|
||||||
key={column.key}
|
key={column.key}
|
||||||
className={`px-4 py-3 ${
|
className={`px-4 py-3 ${
|
||||||
column.primary ? "font-medium text-[#26454c]" : "text-[#4a6b72]"
|
column.primary ? "font-medium text-body" : "text-muted"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{column.key === linkKey ? (
|
{column.key === linkKey ? (
|
||||||
|
|
@ -199,16 +199,16 @@ export default function EntityList() {
|
||||||
)}
|
)}
|
||||||
</td>
|
</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>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{!loading && rows.length === 0 && (
|
{!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>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,11 @@ import { Link } from 'react-router-dom'
|
||||||
import FeaturedCards from '../../components/FeaturedCards.tsx'
|
import FeaturedCards from '../../components/FeaturedCards.tsx'
|
||||||
import PlatformIcon from '../../components/PlatformIcon.tsx'
|
import PlatformIcon from '../../components/PlatformIcon.tsx'
|
||||||
import { blogHref } from '../../lib/hrefs.ts'
|
import { blogHref } from '../../lib/hrefs.ts'
|
||||||
import { blogImage } from '../../lib/media.ts'
|
import { mediaUrl } from '../../lib/media.ts'
|
||||||
import { preview } from '../../lib/text.ts'
|
import { preview } from '../../lib/text.ts'
|
||||||
import { postDate, useCommunityBlog, type BlogPostSummary } from '../../lib/useBlog.ts'
|
import { postDate, useCommunityBlog, type BlogPostSummary } from '../../lib/useBlog.ts'
|
||||||
import HomeLink from './home/HomeLink.tsx'
|
import HomeLink from './home/HomeLink.tsx'
|
||||||
|
import { accentText } from '../../lib/color.ts'
|
||||||
|
|
||||||
/* Headings for a half the admin didn't title. */
|
/* Headings for a half the admin didn't title. */
|
||||||
const DEFAULTS = {
|
const DEFAULTS = {
|
||||||
|
|
@ -35,24 +36,24 @@ const DEFAULTS = {
|
||||||
const EXCERPT_CHARS = 180
|
const EXCERPT_CHARS = 180
|
||||||
|
|
||||||
function PostCard({ post, accent }: { post: BlogPostSummary; accent: string }) {
|
function PostCard({ post, accent }: { post: BlogPostSummary; accent: string }) {
|
||||||
const cover = blogImage(post.cover_image)
|
const cover = mediaUrl(post.cover_image)
|
||||||
const date = postDate(post.published_on)
|
const date = postDate(post.published_on)
|
||||||
const authors = post.authors.map((author) => author.name).join(', ')
|
const authors = post.authors.map((author) => author.name).join(', ')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li className="relative flex flex-col overflow-hidden rounded-2xl border border-[#138ba0]/15 bg-white shadow-sm transition-shadow hover:shadow-lg">
|
<li className="relative flex flex-col overflow-hidden rounded-2xl border border-brand/15 bg-surface shadow-sm transition-shadow hover:shadow-lg">
|
||||||
{cover ? (
|
{cover ? (
|
||||||
<img src={cover} alt="" loading="lazy" className="aspect-video w-full object-cover" />
|
<img src={cover} alt="" loading="lazy" className="aspect-video w-full object-cover" />
|
||||||
) : (
|
) : (
|
||||||
<div className="aspect-video w-full bg-gradient-to-br from-[#eef9fb] to-[#d9f0f3]" />
|
<div className="aspect-video w-full bg-tint" />
|
||||||
)}
|
)}
|
||||||
<div className="flex flex-1 flex-col p-6">
|
<div className="flex flex-1 flex-col p-6">
|
||||||
{(date || post.tags.length > 0) && (
|
{(date || post.tags.length > 0) && (
|
||||||
<p className="text-xs font-bold uppercase tracking-[0.2em]" style={{ color: accent }}>
|
<p className="text-xs font-bold uppercase tracking-[0.2em]" style={{ color: accentText(accent) }}>
|
||||||
{[date, ...post.tags].filter(Boolean).join(' · ')}
|
{[date, ...post.tags].filter(Boolean).join(' · ')}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
<h4 className="mt-2 font-display text-xl font-extrabold leading-snug text-[#073d4a]">
|
<h4 className="mt-2 font-display text-xl font-extrabold leading-snug text-ink">
|
||||||
<Link
|
<Link
|
||||||
to={blogHref(post.id)}
|
to={blogHref(post.id)}
|
||||||
className="after:absolute after:inset-0 after:rounded-2xl after:content-[''] hover:underline"
|
className="after:absolute after:inset-0 after:rounded-2xl after:content-[''] hover:underline"
|
||||||
|
|
@ -61,9 +62,9 @@ function PostCard({ post, accent }: { post: BlogPostSummary; accent: string }) {
|
||||||
</Link>
|
</Link>
|
||||||
</h4>
|
</h4>
|
||||||
{post.excerpt && (
|
{post.excerpt && (
|
||||||
<p className="mt-2 leading-relaxed text-[#4a6b72]">{preview(post.excerpt, EXCERPT_CHARS)}</p>
|
<p className="mt-2 leading-relaxed text-muted">{preview(post.excerpt, EXCERPT_CHARS)}</p>
|
||||||
)}
|
)}
|
||||||
{authors && <p className="mt-auto pt-4 text-sm font-medium text-[#26454c]">By {authors}</p>}
|
{authors && <p className="mt-auto pt-4 text-sm font-medium text-body">By {authors}</p>}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
|
|
@ -71,7 +72,7 @@ function PostCard({ post, accent }: { post: BlogPostSummary; accent: string }) {
|
||||||
|
|
||||||
function Subheading({ children, accent }: { children: string; accent: string }) {
|
function Subheading({ children, accent }: { children: string; accent: string }) {
|
||||||
return (
|
return (
|
||||||
<h3 className="text-2xl font-extrabold" style={{ color: accent }}>
|
<h3 className="text-2xl font-extrabold" style={{ color: accentText(accent) }}>
|
||||||
{children}
|
{children}
|
||||||
</h3>
|
</h3>
|
||||||
)
|
)
|
||||||
|
|
@ -82,13 +83,13 @@ export default function CommunityBlog({ accent = '#0f7183' }: { accent?: string
|
||||||
|
|
||||||
if (!blog) {
|
if (!blog) {
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto max-w-6xl px-6 text-[#4a6b72]">
|
<div className="mx-auto max-w-6xl px-6 text-muted">
|
||||||
{loading ? (
|
{loading ? (
|
||||||
'Loading…'
|
'Loading…'
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
Couldn’t load the blog. {error}{' '}
|
Couldn’t load the blog. {error}{' '}
|
||||||
<button type="button" onClick={reload} className="underline" style={{ color: accent }}>
|
<button type="button" onClick={reload} className="underline" style={{ color: accentText(accent) }}>
|
||||||
Try again
|
Try again
|
||||||
</button>
|
</button>
|
||||||
</>
|
</>
|
||||||
|
|
@ -102,7 +103,7 @@ export default function CommunityBlog({ accent = '#0f7183' }: { accent?: string
|
||||||
const hasExternal = external.cards.length > 0 || Boolean(external.url)
|
const hasExternal = external.cards.length > 0 || Boolean(external.url)
|
||||||
|
|
||||||
if (!hasInternal && !hasExternal) {
|
if (!hasInternal && !hasExternal) {
|
||||||
return <p className="mx-auto max-w-6xl px-6 text-center text-[#4a6b72]">· Posts coming soon ·</p>
|
return <p className="mx-auto max-w-6xl px-6 text-center text-muted">· Posts coming soon ·</p>
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ import { EVENT_TYPES, eventTypeLabel, type EventType } from '../../lib/eventType
|
||||||
import { firstOccurrenceFrom, occurrencesBetween, seriesTimes } from '../../lib/eventSeries.ts'
|
import { firstOccurrenceFrom, occurrencesBetween, seriesTimes } from '../../lib/eventSeries.ts'
|
||||||
import { eventHref } from '../../lib/hrefs.ts'
|
import { eventHref } from '../../lib/hrefs.ts'
|
||||||
import type { EventListItem } from '../../lib/useContent.ts'
|
import type { EventListItem } from '../../lib/useContent.ts'
|
||||||
|
import { withAlpha, accentText, readableOn } from '../../lib/color.ts'
|
||||||
|
|
||||||
export type CalendarControl = 'scope' | 'type' | 'online' | 'search'
|
export type CalendarControl = 'scope' | 'type' | 'online' | 'search'
|
||||||
export type CalendarView = 'month' | 'list'
|
export type CalendarView = 'month' | 'list'
|
||||||
|
|
@ -57,8 +58,8 @@ const ALL_CONTROLS: CalendarControl[] = ['scope', 'type', 'online', 'search']
|
||||||
const MAX_LANES = 3
|
const MAX_LANES = 3
|
||||||
|
|
||||||
const TEAL = '#0f7183'
|
const TEAL = '#0f7183'
|
||||||
const INK = '#073d4a'
|
const INK = 'var(--color-ink)'
|
||||||
const BODY = '#4a6b72'
|
const BODY = 'var(--color-muted)'
|
||||||
|
|
||||||
const WEEKDAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
|
const WEEKDAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
|
||||||
|
|
||||||
|
|
@ -326,8 +327,8 @@ export default function EventCalendar({
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => go(monthKey(today))}
|
onClick={() => go(monthKey(today))}
|
||||||
className="rounded-full border px-3 py-1 text-sm font-semibold hover:bg-white"
|
className="rounded-full border px-3 py-1 text-sm font-semibold hover:bg-surface"
|
||||||
style={{ borderColor: accent, color: accent }}
|
style={{ borderColor: accent, color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
Today
|
Today
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -348,8 +349,8 @@ export default function EventCalendar({
|
||||||
className="px-4 py-1.5 text-sm font-semibold capitalize transition-colors"
|
className="px-4 py-1.5 text-sm font-semibold capitalize transition-colors"
|
||||||
style={
|
style={
|
||||||
view === option
|
view === option
|
||||||
? { background: accent, color: '#ffffff' }
|
? { background: accent, color: readableOn(accent) }
|
||||||
: { color: accent }
|
: { color: accentText(accent) }
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{option}
|
{option}
|
||||||
|
|
@ -380,7 +381,7 @@ export default function EventCalendar({
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{show('online') && (
|
{show('online') && (
|
||||||
<label className="flex cursor-pointer items-center gap-2 rounded-full border border-[#138ba0]/25 bg-white px-4 py-2 text-sm">
|
<label className="flex cursor-pointer items-center gap-2 rounded-full border border-brand/25 bg-surface px-4 py-2 text-sm">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={onlineOnly}
|
checked={onlineOnly}
|
||||||
|
|
@ -398,7 +399,7 @@ export default function EventCalendar({
|
||||||
onChange={(e) => setQuery(e.target.value)}
|
onChange={(e) => setQuery(e.target.value)}
|
||||||
placeholder="Search events"
|
placeholder="Search events"
|
||||||
aria-label="Search events"
|
aria-label="Search events"
|
||||||
className="min-w-[12rem] flex-1 rounded-full border border-[#138ba0]/25 bg-white px-4 py-2 text-sm outline-none focus:border-[#0f7183] focus:ring-2 focus:ring-[#0f7183]/40 md:max-w-xs"
|
className="min-w-[12rem] flex-1 rounded-full border border-brand/25 bg-surface px-4 py-2 text-sm outline-none focus:border-link focus:ring-2 focus:ring-link/40 md:max-w-xs"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{filtering && (
|
{filtering && (
|
||||||
|
|
@ -406,7 +407,7 @@ export default function EventCalendar({
|
||||||
type="button"
|
type="button"
|
||||||
onClick={clearFilters}
|
onClick={clearFilters}
|
||||||
className="text-sm font-semibold hover:underline"
|
className="text-sm font-semibold hover:underline"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
Clear filters
|
Clear filters
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -417,7 +418,7 @@ export default function EventCalendar({
|
||||||
{/* ── Body ── */}
|
{/* ── Body ── */}
|
||||||
<div className="mt-6">
|
<div className="mt-6">
|
||||||
{error ? (
|
{error ? (
|
||||||
<p className="rounded-2xl bg-white p-6 text-[#b3261e]">
|
<p className="rounded-2xl bg-surface p-6 text-danger">
|
||||||
Couldn’t load events. {error.message}
|
Couldn’t load events. {error.message}
|
||||||
</p>
|
</p>
|
||||||
) : loading ? (
|
) : loading ? (
|
||||||
|
|
@ -457,7 +458,7 @@ export default function EventCalendar({
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => go(monthKey(next))}
|
onClick={() => go(monthKey(next))}
|
||||||
className="font-semibold hover:underline"
|
className="font-semibold hover:underline"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
Jump to the next event, {monthTitle(monthKey(next))} →
|
Jump to the next event, {monthTitle(monthKey(next))} →
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -494,8 +495,8 @@ type MonthGridProps = {
|
||||||
|
|
||||||
function MonthGrid({ weeks, month, today, occurrences, selected, onSelect, accent }: MonthGridProps) {
|
function MonthGrid({ weeks, month, today, occurrences, selected, onSelect, accent }: MonthGridProps) {
|
||||||
return (
|
return (
|
||||||
<div className="overflow-hidden rounded-3xl border border-[#138ba0]/15 bg-white shadow-sm">
|
<div className="overflow-hidden rounded-3xl border border-brand/15 bg-surface shadow-sm">
|
||||||
<div className="grid grid-cols-7 border-b border-[#138ba0]/10 bg-[#f6fbfc]">
|
<div className="grid grid-cols-7 border-b border-brand/10 bg-tint-soft">
|
||||||
{WEEKDAYS.map((day) => (
|
{WEEKDAYS.map((day) => (
|
||||||
<div
|
<div
|
||||||
key={day}
|
key={day}
|
||||||
|
|
@ -516,7 +517,7 @@ function MonthGrid({ weeks, month, today, occurrences, selected, onSelect, accen
|
||||||
segments.filter((s) => s.col <= col && s.col + s.span > col).length
|
segments.filter((s) => s.col <= col && s.col + s.span > col).length
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={week[0]} className="relative min-h-[8rem] border-b border-[#138ba0]/10 last:border-b-0">
|
<div key={week[0]} className="relative min-h-[8rem] border-b border-brand/10 last:border-b-0">
|
||||||
{/* Day cells: the click targets, and the numbers. */}
|
{/* Day cells: the click targets, and the numbers. */}
|
||||||
<div className="absolute inset-0 grid grid-cols-7">
|
<div className="absolute inset-0 grid grid-cols-7">
|
||||||
{week.map((date, col) => {
|
{week.map((date, col) => {
|
||||||
|
|
@ -532,23 +533,23 @@ function MonthGrid({ weeks, month, today, occurrences, selected, onSelect, accen
|
||||||
onClick={() => onSelect(date)}
|
onClick={() => onSelect(date)}
|
||||||
aria-pressed={isSelected}
|
aria-pressed={isSelected}
|
||||||
aria-label={`${longDay(date)}${count ? `, ${count} event${count === 1 ? '' : 's'}` : ''}`}
|
aria-label={`${longDay(date)}${count ? `, ${count} event${count === 1 ? '' : 's'}` : ''}`}
|
||||||
className="relative flex flex-col items-start border-r border-[#138ba0]/10 p-2 text-left transition-colors last:border-r-0 hover:bg-[#f6fbfc]"
|
className="relative flex flex-col items-start border-r border-brand/10 p-2 text-left transition-colors last:border-r-0 hover:bg-tint-soft"
|
||||||
style={{
|
style={{
|
||||||
background: isSelected ? `${accent}14` : outside ? '#fbfdfd' : undefined,
|
background: isSelected ? `${withAlpha(accent, 8)}` : outside ? 'var(--color-tint-soft)' : undefined,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="flex h-7 w-7 items-center justify-center rounded-full text-sm font-semibold"
|
className="flex h-7 w-7 items-center justify-center rounded-full text-sm font-semibold"
|
||||||
style={
|
style={
|
||||||
isToday
|
isToday
|
||||||
? { background: accent, color: '#ffffff' }
|
? { background: accent, color: readableOn(accent) }
|
||||||
: { color: outside ? '#b8c6c9' : INK }
|
: { color: outside ? withAlpha('var(--color-muted)', 60) : INK }
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{Number(date.slice(8))}
|
{Number(date.slice(8))}
|
||||||
</span>
|
</span>
|
||||||
{hidden > 0 && (
|
{hidden > 0 && (
|
||||||
<span className="mt-auto text-xs font-semibold" style={{ color: accent }}>
|
<span className="mt-auto text-xs font-semibold" style={{ color: accentText(accent) }}>
|
||||||
+{hidden} more
|
+{hidden} more
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
@ -620,14 +621,14 @@ function DayPanel({
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="mt-4 rounded-3xl border bg-white p-6" style={{ borderColor: `${accent}40` }}>
|
<div className="mt-4 rounded-3xl border bg-surface p-6" style={{ borderColor: `${withAlpha(accent, 25)}` }}>
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<h4 className="font-display text-lg font-bold">{longDay(date)}</h4>
|
<h4 className="font-display text-lg font-bold">{longDay(date)}</h4>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
className="ml-auto text-sm font-semibold hover:underline"
|
className="ml-auto text-sm font-semibold hover:underline"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
Close
|
Close
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -664,7 +665,7 @@ function MonthList({
|
||||||
}) {
|
}) {
|
||||||
if (items.length === 0) {
|
if (items.length === 0) {
|
||||||
return (
|
return (
|
||||||
<p className="rounded-3xl bg-white p-10 text-center" style={{ color: BODY }}>
|
<p className="rounded-3xl bg-surface p-10 text-center" style={{ color: BODY }}>
|
||||||
Nothing on the calendar this month.
|
Nothing on the calendar this month.
|
||||||
</p>
|
</p>
|
||||||
)
|
)
|
||||||
|
|
@ -683,9 +684,9 @@ function MonthList({
|
||||||
{[...byDay.entries()].map(([day, list]) => {
|
{[...byDay.entries()].map(([day, list]) => {
|
||||||
const d = parse(day)
|
const d = parse(day)
|
||||||
return (
|
return (
|
||||||
<li key={day} className="flex gap-5 rounded-3xl bg-white p-5 shadow-sm">
|
<li key={day} className="flex gap-5 rounded-3xl bg-surface p-5 shadow-sm">
|
||||||
<div className="w-14 shrink-0 text-center">
|
<div className="w-14 shrink-0 text-center">
|
||||||
<p className="text-xs font-bold uppercase tracking-widest" style={{ color: accent }}>
|
<p className="text-xs font-bold uppercase tracking-widest" style={{ color: accentText(accent) }}>
|
||||||
{d.toLocaleDateString(undefined, { weekday: 'short' })}
|
{d.toLocaleDateString(undefined, { weekday: 'short' })}
|
||||||
</p>
|
</p>
|
||||||
<p className="font-display text-3xl font-extrabold leading-none">{d.getDate()}</p>
|
<p className="font-display text-3xl font-extrabold leading-none">{d.getDate()}</p>
|
||||||
|
|
@ -715,13 +716,13 @@ function EventLine({ item, accent }: { item: Occurrence; accent: string }) {
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
to={eventHref(event.id)}
|
to={eventHref(event.id)}
|
||||||
className="group flex items-start gap-3 rounded-xl p-2 transition-colors hover:bg-[#f6fbfc]"
|
className="group flex items-start gap-3 rounded-xl p-2 transition-colors hover:bg-tint-soft"
|
||||||
>
|
>
|
||||||
<span className="mt-1.5 h-3 w-3 shrink-0 rounded-full" style={{ background: color }} aria-hidden="true" />
|
<span className="mt-1.5 h-3 w-3 shrink-0 rounded-full" style={{ background: color }} aria-hidden="true" />
|
||||||
<span className="min-w-0">
|
<span className="min-w-0">
|
||||||
<span className={`block font-semibold group-hover:underline ${cancelled ? 'line-through' : ''}`}>
|
<span className={`block font-semibold group-hover:underline ${cancelled ? 'line-through' : ''}`}>
|
||||||
{event.title}
|
{event.title}
|
||||||
{cancelled && <span className="ml-2 text-xs font-bold uppercase text-[#b3261e] no-underline">Cancelled</span>}
|
{cancelled && <span className="ml-2 text-xs font-bold uppercase text-danger no-underline">Cancelled</span>}
|
||||||
</span>
|
</span>
|
||||||
<span className="block text-sm" style={{ color: BODY }}>
|
<span className="block text-sm" style={{ color: BODY }}>
|
||||||
{[
|
{[
|
||||||
|
|
@ -755,8 +756,8 @@ function NavButton({
|
||||||
type="button"
|
type="button"
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
aria-label={label}
|
aria-label={label}
|
||||||
className="flex h-10 w-10 items-center justify-center rounded-full border text-xl transition-colors hover:bg-white"
|
className="flex h-10 w-10 items-center justify-center rounded-full border text-xl transition-colors hover:bg-surface"
|
||||||
style={{ borderColor: accent, color: accent }}
|
style={{ borderColor: accent, color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -781,7 +782,7 @@ function FilterSelect({
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(e) => onChange(e.target.value)}
|
onChange={(e) => onChange(e.target.value)}
|
||||||
aria-label={label}
|
aria-label={label}
|
||||||
className="rounded-full border border-[#138ba0]/25 bg-white px-4 py-2 text-sm outline-none focus:border-[#0f7183] focus:ring-2 focus:ring-[#0f7183]/40"
|
className="rounded-full border border-brand/25 bg-surface px-4 py-2 text-sm outline-none focus:border-link focus:ring-2 focus:ring-link/40"
|
||||||
>
|
>
|
||||||
<option value="">{all}</option>
|
<option value="">{all}</option>
|
||||||
{options.map(([id, name]) => (
|
{options.map(([id, name]) => (
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ import { eventHref } from "../../lib/hrefs.ts";
|
||||||
import { EVENT_TYPES, eventTypeLabel } from "../../lib/eventTypes.ts";
|
import { EVENT_TYPES, eventTypeLabel } from "../../lib/eventTypes.ts";
|
||||||
import { seriesLabel } from "../../lib/eventSeries.ts";
|
import { seriesLabel } from "../../lib/eventSeries.ts";
|
||||||
import PlatformIcon from "../../components/PlatformIcon.tsx";
|
import PlatformIcon from "../../components/PlatformIcon.tsx";
|
||||||
import { eventBackground, eventLogo as eventLogoSrc, orgLogo as orgLogoSrc } from "../../lib/media.ts";
|
import { mediaUrl } from "../../lib/media.ts";
|
||||||
|
import Logo from "../../components/Logo.tsx";
|
||||||
|
import { accentText, withAlpha, readableOn } from '../../lib/color.ts'
|
||||||
|
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
EVENT LIST: CARDS
|
EVENT LIST: CARDS
|
||||||
|
|
@ -33,38 +35,21 @@ import { eventBackground, eventLogo as eventLogoSrc, orgLogo as orgLogoSrc } fro
|
||||||
fires only for an event with no host at all. */
|
fires only for an event with no host at all. */
|
||||||
const DEFAULT_ORG_LOGO = null;
|
const DEFAULT_ORG_LOGO = null;
|
||||||
|
|
||||||
/* An <img> that removes itself if the file 404s. `src` is already
|
|
||||||
resolved by media.ts: a bare filename from the uploads directory,
|
|
||||||
anything with a path or URL as it is. */
|
|
||||||
function Logo({ src, alt = "", className }) {
|
|
||||||
const [failed, setFailed] = useState(false);
|
|
||||||
if (!src || failed) return null;
|
|
||||||
return (
|
|
||||||
<img
|
|
||||||
src={src}
|
|
||||||
alt={alt}
|
|
||||||
className={className}
|
|
||||||
onError={() => setFailed(true)}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const TEAL = "#0f7183"; // last-resort card color
|
const TEAL = "#0f7183"; // last-resort card color
|
||||||
const INK = "#073d4a"; // button text: the card colour is only a border
|
const INK = "var(--color-ink)"; // button text: the card colour is only a border
|
||||||
const CARD_BG = "#ffffff"; // sits under every card, gradient or not
|
const CARD_BG = "var(--color-surface)"; // sits under every card, photo or not
|
||||||
|
|
||||||
/* Laid over a card's background image so black text reads on any
|
/* Laid over a card's background image so black text reads on any
|
||||||
photo. Heavier at the top, where the title and dates are, and
|
photo. Heavier at the top, where the title and dates are, and
|
||||||
lighter lower down so more of the picture shows through. */
|
lighter lower down so more of the picture shows through. */
|
||||||
const CARD_IMAGE_VEIL =
|
const CARD_IMAGE_VEIL =
|
||||||
"linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(255,255,255,0.78))";
|
"linear-gradient(to bottom, color-mix(in srgb, var(--color-surface) 90%, transparent), color-mix(in srgb, var(--color-surface) 78%, transparent))";
|
||||||
|
|
||||||
/* The card's background layers, top first: its gradient if it has
|
/* The card's background layers, top first: the veil and photo if it
|
||||||
one, then the veil and photo if it has one, then white. */
|
has one, then the plain surface. */
|
||||||
function cardBackground(ev) {
|
function cardBackground(ev) {
|
||||||
const layers: string[] = [];
|
const layers: string[] = [];
|
||||||
if (ev.gradient) layers.push(ev.gradient);
|
const image = mediaUrl(ev.card_image);
|
||||||
const image = eventBackground(ev.card_image);
|
|
||||||
if (image) {
|
if (image) {
|
||||||
layers.push(CARD_IMAGE_VEIL, `url(${JSON.stringify(image)}) center / cover no-repeat`);
|
layers.push(CARD_IMAGE_VEIL, `url(${JSON.stringify(image)}) center / cover no-repeat`);
|
||||||
}
|
}
|
||||||
|
|
@ -155,8 +140,8 @@ export function Card({
|
||||||
}) {
|
}) {
|
||||||
const past = ev.status === "past";
|
const past = ev.status === "past";
|
||||||
const color = ev.color || defaultColor;
|
const color = ev.color || defaultColor;
|
||||||
const orgLogo = orgLogoSrc(ev.org_logo) || DEFAULT_ORG_LOGO;
|
const orgLogo = mediaUrl(ev.org_logo) || DEFAULT_ORG_LOGO;
|
||||||
const eventLogo = eventLogoSrc(ev.event_logo);
|
const eventLogo = mediaUrl(ev.event_logo);
|
||||||
const schedule = seriesLabel(ev.series, ev.starts_on);
|
const schedule = seriesLabel(ev.series, ev.starts_on);
|
||||||
const links = ev.links ?? [];
|
const links = ev.links ?? [];
|
||||||
const igHandle = ev.instagram || null;
|
const igHandle = ev.instagram || null;
|
||||||
|
|
@ -192,7 +177,7 @@ export function Card({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`rounded-3xl text-black overflow-hidden shadow-2xl h-full flex flex-col ${
|
className={`rounded-3xl text-ink overflow-hidden shadow-2xl h-full flex flex-col ${
|
||||||
compact ? "ev-card" : ""
|
compact ? "ev-card" : ""
|
||||||
}`}
|
}`}
|
||||||
style={{
|
style={{
|
||||||
|
|
@ -278,7 +263,7 @@ export function Card({
|
||||||
doesn't. */}
|
doesn't. */}
|
||||||
<div className={`mt-auto ${compact ? "pt-6" : "pt-8"}`}>
|
<div className={`mt-auto ${compact ? "pt-6" : "pt-8"}`}>
|
||||||
{links.length === 0 && (
|
{links.length === 0 && (
|
||||||
<p className="text-center font-semibold" style={{ color: accent }}>
|
<p className="text-center font-semibold" style={{ color: accentText(accent) }}>
|
||||||
{past
|
{past
|
||||||
? "This event has concluded. Thank you to everyone who joined us!"
|
? "This event has concluded. Thank you to everyone who joined us!"
|
||||||
: igHandle
|
: igHandle
|
||||||
|
|
@ -320,7 +305,7 @@ export function Card({
|
||||||
className={`ig-link flex items-center justify-center rounded-xl font-bold transition-all duration-200 hover:scale-[1.02] gap-3 ${
|
className={`ig-link flex items-center justify-center rounded-xl font-bold transition-all duration-200 hover:scale-[1.02] gap-3 ${
|
||||||
compact ? "py-2.5 px-5" : "py-3 px-6"
|
compact ? "py-2.5 px-5" : "py-3 px-6"
|
||||||
}`}
|
}`}
|
||||||
style={{ border: `1px solid ${accent}`, color: accent }}
|
style={{ border: `1px solid ${accent}`, color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
<PlatformIcon platform="instagram" className="w-6 h-6" />
|
<PlatformIcon platform="instagram" className="w-6 h-6" />
|
||||||
{igHandle}
|
{igHandle}
|
||||||
|
|
@ -362,7 +347,7 @@ export function TypeFilter({ types, active, setActive, accent }) {
|
||||||
const chip = on => ({
|
const chip = on => ({
|
||||||
border: `1px solid ${accent}`,
|
border: `1px solid ${accent}`,
|
||||||
background: on ? accent : "transparent",
|
background: on ? accent : "transparent",
|
||||||
color: on ? "#ffffff" : accent,
|
color: on ? readableOn(accent) : accentText(accent),
|
||||||
});
|
});
|
||||||
|
|
||||||
const button = (id, label) => (
|
const button = (id, label) => (
|
||||||
|
|
@ -396,7 +381,7 @@ export function TypeFilter({ types, active, setActive, accent }) {
|
||||||
export function EventCardsToggle({ view, setView, accent }) {
|
export function EventCardsToggle({ view, setView, accent }) {
|
||||||
const btn = active => ({
|
const btn = active => ({
|
||||||
background: active ? accent : "transparent",
|
background: active ? accent : "transparent",
|
||||||
color: active ? "#ffffff" : accent,
|
color: active ? readableOn(accent) : accentText(accent),
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -522,14 +507,14 @@ export default function EventListCards({
|
||||||
// Arrows and dots follow the section accent, not the active card.
|
// Arrows and dots follow the section accent, not the active card.
|
||||||
const arrowStyle = enabled => ({
|
const arrowStyle = enabled => ({
|
||||||
border: `1px solid ${accent}`,
|
border: `1px solid ${accent}`,
|
||||||
background: "rgba(255,255,255,0.85)",
|
background: "color-mix(in srgb, var(--color-surface) 85%, transparent)",
|
||||||
color: enabled ? accent : "#b8c6c9",
|
color: enabled ? accentText(accent) : withAlpha("var(--color-muted)", 50),
|
||||||
cursor: enabled ? "pointer" : "default",
|
cursor: enabled ? "pointer" : "default",
|
||||||
opacity: enabled ? 1 : 0.4,
|
opacity: enabled ? 1 : 0.4,
|
||||||
});
|
});
|
||||||
|
|
||||||
const notice = text => (
|
const notice = text => (
|
||||||
<p className="max-w-6xl mx-auto px-6 font-semibold" style={{ color: accent }}>
|
<p className="max-w-6xl mx-auto px-6 font-semibold" style={{ color: accentText(accent) }}>
|
||||||
{text}
|
{text}
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
|
|
@ -600,7 +585,7 @@ export default function EventListCards({
|
||||||
<div className="mt-12">
|
<div className="mt-12">
|
||||||
<h3
|
<h3
|
||||||
className="text-2xl font-extrabold mb-6"
|
className="text-2xl font-extrabold mb-6"
|
||||||
style={{ color: accent, opacity: 0.85 }}
|
style={{ color: accentText(accent), opacity: 0.85 }}
|
||||||
>
|
>
|
||||||
Past Events
|
Past Events
|
||||||
</h3>
|
</h3>
|
||||||
|
|
@ -640,7 +625,7 @@ export default function EventListCards({
|
||||||
onClick={() => setShowPast(v => !v)}
|
onClick={() => setShowPast(v => !v)}
|
||||||
aria-expanded={showPast}
|
aria-expanded={showPast}
|
||||||
className="flex items-center gap-2 py-2.5 px-6 rounded-xl font-bold transition-all duration-200 hover:scale-105"
|
className="flex items-center gap-2 py-2.5 px-6 rounded-xl font-bold transition-all duration-200 hover:scale-105"
|
||||||
style={{ border: `1px solid ${accent}`, color: accent }}
|
style={{ border: `1px solid ${accent}`, color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
{showPast
|
{showPast
|
||||||
? "Hide past events"
|
? "Hide past events"
|
||||||
|
|
@ -737,7 +722,7 @@ export default function EventListCards({
|
||||||
className="h-2.5 rounded-full transition-all duration-200"
|
className="h-2.5 rounded-full transition-all duration-200"
|
||||||
style={{
|
style={{
|
||||||
width: i === index ? "1.5rem" : "0.625rem",
|
width: i === index ? "1.5rem" : "0.625rem",
|
||||||
background: i === index ? accent : "#b8c6c9",
|
background: i === index ? accent : withAlpha("var(--color-muted)", 40),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -9,15 +9,20 @@
|
||||||
|
|
||||||
The page and section options come from navConfig, so adding a
|
The page and section options come from navConfig, so adding a
|
||||||
page to the nav adds it to this form too.
|
page to the nav adds it to this form too.
|
||||||
|
|
||||||
|
With fixedType the type is set and neither picker shows. The
|
||||||
|
Privacy page uses it for data requests (DATA_REQUEST), which also
|
||||||
|
need an email, since the answer has to go somewhere.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { post, ApiError } from "../../lib/api.ts";
|
import { post, ApiError } from "../../lib/api.ts";
|
||||||
import { PAGE_LINKS, PAGE_SECTIONS } from "../../navConfig.ts";
|
import { PAGE_LINKS, PAGE_SECTIONS } from "../../navConfig.ts";
|
||||||
import { FEEDBACK_TYPES } from "../../data/feedbackTypes.ts";
|
import { DATA_REQUEST, FEEDBACK_TYPES } from "../../data/feedbackTypes.ts";
|
||||||
|
import { accentText } from '../../lib/color.ts'
|
||||||
|
|
||||||
const ACCENT = "#0f7183";
|
const ACCENT = "#0f7183";
|
||||||
const MUTED = "#4a6b72";
|
const MUTED = "var(--color-muted)";
|
||||||
const MAX_CHARS = 1500;
|
const MAX_CHARS = 1500;
|
||||||
const MIN_MESSAGE = 10; // matches the server
|
const MIN_MESSAGE = 10; // matches the server
|
||||||
|
|
||||||
|
|
@ -30,17 +35,17 @@ const WHOLE_PAGE = "";
|
||||||
/* ── Shared field chrome ─────────────────────────────────────── */
|
/* ── Shared field chrome ─────────────────────────────────────── */
|
||||||
|
|
||||||
const fieldClass =
|
const fieldClass =
|
||||||
"w-full rounded-xl border border-[#4a6b72]/25 bg-white px-4 py-3 text-[#26454c] " +
|
"w-full rounded-xl border border-muted/25 bg-surface px-4 py-3 text-body " +
|
||||||
"placeholder:text-[#4a6b72]/50 outline-none transition-colors " +
|
"placeholder:text-muted/50 outline-none transition-colors " +
|
||||||
"focus:border-[#138ba0] focus:ring-2 focus:ring-[#138ba0]/25";
|
"focus:border-brand focus:ring-2 focus:ring-brand/25";
|
||||||
|
|
||||||
const errorFieldClass = "border-[#b3261e] focus:border-[#b3261e] focus:ring-[#b3261e]/20";
|
const errorFieldClass = "border-danger focus:border-danger focus:ring-danger/20";
|
||||||
|
|
||||||
const selectClass = `${fieldClass} appearance-none pr-10`;
|
const selectClass = `${fieldClass} appearance-none pr-10`;
|
||||||
|
|
||||||
function OptionalTag() {
|
function OptionalTag() {
|
||||||
return (
|
return (
|
||||||
<span className="ml-2 rounded-full bg-[#eef9fb] px-2 py-0.5 text-xs font-medium text-[#0f7183]">
|
<span className="ml-2 rounded-full bg-tint px-2 py-0.5 text-xs font-medium text-link">
|
||||||
Optional
|
Optional
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
@ -49,7 +54,7 @@ function OptionalTag() {
|
||||||
function FieldError({ id, children }) {
|
function FieldError({ id, children }) {
|
||||||
if (!children) return null;
|
if (!children) return null;
|
||||||
return (
|
return (
|
||||||
<p id={id} className="mt-2 text-sm text-[#b3261e]">
|
<p id={id} className="mt-2 text-sm text-danger">
|
||||||
{children}
|
{children}
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
|
|
@ -59,7 +64,7 @@ function FieldError({ id, children }) {
|
||||||
function Select({ id, label, value, onChange, children }) {
|
function Select({ id, label, value, onChange, children }) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor={id} className="block text-sm font-medium text-[#26454c]">
|
<label htmlFor={id} className="block text-sm font-medium text-body">
|
||||||
{label}
|
{label}
|
||||||
</label>
|
</label>
|
||||||
<div className="relative mt-2">
|
<div className="relative mt-2">
|
||||||
|
|
@ -96,7 +101,7 @@ function Select({ id, label, value, onChange, children }) {
|
||||||
function TypePicker({ value, onChange }) {
|
function TypePicker({ value, onChange }) {
|
||||||
return (
|
return (
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend className="text-base font-semibold text-[#26454c]">
|
<legend className="text-base font-semibold text-body">
|
||||||
What kind of feedback is this?
|
What kind of feedback is this?
|
||||||
</legend>
|
</legend>
|
||||||
<p className="mt-1 text-sm" style={{ color: MUTED }}>
|
<p className="mt-1 text-sm" style={{ color: MUTED }}>
|
||||||
|
|
@ -119,21 +124,21 @@ function TypePicker({ value, onChange }) {
|
||||||
<span
|
<span
|
||||||
className={
|
className={
|
||||||
"flex h-full flex-col gap-1 rounded-xl border p-4 transition-colors " +
|
"flex h-full flex-col gap-1 rounded-xl border p-4 transition-colors " +
|
||||||
"peer-focus-visible:ring-2 peer-focus-visible:ring-[#138ba0]/40 " +
|
"peer-focus-visible:ring-2 peer-focus-visible:ring-brand/40 " +
|
||||||
(selected
|
(selected
|
||||||
? "border-[#138ba0] bg-[#eef9fb]"
|
? "border-brand bg-tint"
|
||||||
: "border-[#4a6b72]/20 bg-white hover:border-[#138ba0]/50")
|
: "border-muted/20 bg-surface hover:border-brand/50")
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<span className="flex items-start justify-between gap-2">
|
<span className="flex items-start justify-between gap-2">
|
||||||
<span className="font-semibold text-[#26454c]">{type.label}</span>
|
<span className="font-semibold text-body">{type.label}</span>
|
||||||
<span
|
<span
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
className={
|
className={
|
||||||
"mt-0.5 h-4 w-4 shrink-0 rounded-full border-2 transition-colors " +
|
"mt-0.5 h-4 w-4 shrink-0 rounded-full border-2 transition-colors " +
|
||||||
(selected
|
(selected
|
||||||
? "border-[#138ba0] bg-[#0f7183] ring-2 ring-inset ring-white"
|
? "border-brand bg-action ring-2 ring-inset ring-white"
|
||||||
: "border-[#4a6b72]/30")
|
: "border-muted/30")
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -157,7 +162,7 @@ function LocationPicker({ page, section, onPageChange, onSectionChange }) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="flex flex-wrap items-center">
|
<div className="flex flex-wrap items-center">
|
||||||
<h3 className="text-base font-semibold text-[#26454c]">
|
<h3 className="text-base font-semibold text-body">
|
||||||
Where did you run into it?
|
Where did you run into it?
|
||||||
</h3>
|
</h3>
|
||||||
<OptionalTag />
|
<OptionalTag />
|
||||||
|
|
@ -216,8 +221,9 @@ function describeLocation(page, section) {
|
||||||
|
|
||||||
/* ── The form ────────────────────────────────────────────────── */
|
/* ── The form ────────────────────────────────────────────────── */
|
||||||
|
|
||||||
export default function FeedbackForm() {
|
export default function FeedbackForm({ fixedType }: { fixedType?: string } = {}) {
|
||||||
const [type, setType] = useState<any>(null);
|
const request = fixedType === DATA_REQUEST.id;
|
||||||
|
const [type, setType] = useState<any>(fixedType ?? null);
|
||||||
const [page, setPage] = useState(SITE_WIDE);
|
const [page, setPage] = useState(SITE_WIDE);
|
||||||
const [section, setSection] = useState(WHOLE_PAGE);
|
const [section, setSection] = useState(WHOLE_PAGE);
|
||||||
const [message, setMessage] = useState("");
|
const [message, setMessage] = useState("");
|
||||||
|
|
@ -233,7 +239,8 @@ export default function FeedbackForm() {
|
||||||
const [fieldErrors, setFieldErrors] = useState<any>({});
|
const [fieldErrors, setFieldErrors] = useState<any>({});
|
||||||
|
|
||||||
const sending = status === "sending";
|
const sending = status === "sending";
|
||||||
const ready = Boolean(type) && message.trim().length >= MIN_MESSAGE;
|
const ready =
|
||||||
|
Boolean(type) && message.trim().length >= MIN_MESSAGE && (!request || email.trim() !== "");
|
||||||
|
|
||||||
async function handleSubmit(event) {
|
async function handleSubmit(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -271,7 +278,7 @@ export default function FeedbackForm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
setType(null);
|
setType(fixedType ?? null);
|
||||||
setPage(SITE_WIDE);
|
setPage(SITE_WIDE);
|
||||||
setSection(WHOLE_PAGE);
|
setSection(WHOLE_PAGE);
|
||||||
setMessage("");
|
setMessage("");
|
||||||
|
|
@ -288,9 +295,9 @@ export default function FeedbackForm() {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
aria-live="polite"
|
aria-live="polite"
|
||||||
className="rounded-2xl border border-[#138ba0]/20 bg-white p-8 sm:p-10"
|
className="rounded-2xl border border-brand/20 bg-surface p-8 sm:p-10"
|
||||||
>
|
>
|
||||||
<h3 className="text-2xl font-bold" style={{ color: ACCENT }}>
|
<h3 className="text-2xl font-bold" style={{ color: accentText(ACCENT) }}>
|
||||||
Thanks, we've got it
|
Thanks, we've got it
|
||||||
</h3>
|
</h3>
|
||||||
{where && (
|
{where && (
|
||||||
|
|
@ -299,16 +306,18 @@ export default function FeedbackForm() {
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
<p className="mt-3 max-w-prose" style={{ color: MUTED }}>
|
<p className="mt-3 max-w-prose" style={{ color: MUTED }}>
|
||||||
{email
|
{request
|
||||||
? `We'll follow up at ${email} if we have questions.`
|
? `We'll reply to ${email}. We may ask you to confirm it's you before we change or delete anything.`
|
||||||
: "You sent this anonymously, so we won't be able to reply, but we read everything that comes in."}
|
: email
|
||||||
|
? `We'll follow up at ${email} if we have questions.`
|
||||||
|
: "You sent this anonymously, so we won't be able to reply, but we read everything that comes in."}
|
||||||
</p>
|
</p>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={reset}
|
onClick={reset}
|
||||||
className="mt-6 rounded-full border border-[#138ba0] px-5 py-2.5 font-semibold text-[#0f7183] transition-colors hover:bg-[#eef9fb] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#138ba0]/40"
|
className="mt-6 rounded-full border border-brand px-5 py-2.5 font-semibold text-link transition-colors hover:bg-tint focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/40"
|
||||||
>
|
>
|
||||||
Send more feedback
|
{request ? "Send another request" : "Send more feedback"}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
@ -318,30 +327,35 @@ export default function FeedbackForm() {
|
||||||
<form
|
<form
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
noValidate
|
noValidate
|
||||||
className="rounded-2xl border border-[#138ba0]/20 bg-white p-6 sm:p-8"
|
className="rounded-2xl border border-brand/20 bg-surface p-6 sm:p-8"
|
||||||
>
|
>
|
||||||
<TypePicker value={type} onChange={setType} />
|
{!fixedType && (
|
||||||
|
<>
|
||||||
|
<TypePicker value={type} onChange={setType} />
|
||||||
|
|
||||||
<div className="mt-10">
|
<div className="mt-10">
|
||||||
<LocationPicker
|
<LocationPicker
|
||||||
page={page}
|
page={page}
|
||||||
section={section}
|
section={section}
|
||||||
onPageChange={setPage}
|
onPageChange={setPage}
|
||||||
onSectionChange={setSection}
|
onSectionChange={setSection}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Message */}
|
{/* Message */}
|
||||||
<div className="mt-10">
|
<div className={fixedType ? "" : "mt-10"}>
|
||||||
<label
|
<label
|
||||||
htmlFor="feedback-message"
|
htmlFor="feedback-message"
|
||||||
className="text-base font-semibold text-[#26454c]"
|
className="text-base font-semibold text-body"
|
||||||
>
|
>
|
||||||
Tell us more
|
{request ? "Your request" : "Tell us more"}
|
||||||
</label>
|
</label>
|
||||||
<p className="mt-1 text-sm" style={{ color: MUTED }}>
|
<p className="mt-1 text-sm" style={{ color: MUTED }}>
|
||||||
What you expected to happen, and what happened instead, is the most
|
{request
|
||||||
useful thing you can give us.
|
? "Say what you'd like: to see the information we hold about you, to correct it, or to have it deleted. Tell us how you've been in touch with NGU (a retreat, a chapter, this site) so we can find it."
|
||||||
|
: "What you expected to happen, and what happened instead, is the most useful thing you can give us."}
|
||||||
</p>
|
</p>
|
||||||
<textarea
|
<textarea
|
||||||
id="feedback-message"
|
id="feedback-message"
|
||||||
|
|
@ -349,7 +363,11 @@ export default function FeedbackForm() {
|
||||||
maxLength={MAX_CHARS}
|
maxLength={MAX_CHARS}
|
||||||
value={message}
|
value={message}
|
||||||
onChange={(e) => setMessage(e.target.value)}
|
onChange={(e) => setMessage(e.target.value)}
|
||||||
placeholder="I was looking for the summer retreat dates and…"
|
placeholder={
|
||||||
|
request
|
||||||
|
? "Please delete the details I gave when I registered for…"
|
||||||
|
: "I was looking for the summer retreat dates and…"
|
||||||
|
}
|
||||||
aria-invalid={Boolean(fieldErrors.message)}
|
aria-invalid={Boolean(fieldErrors.message)}
|
||||||
aria-describedby={fieldErrors.message ? "feedback-message-error" : undefined}
|
aria-describedby={fieldErrors.message ? "feedback-message-error" : undefined}
|
||||||
className={`mt-4 resize-y ${fieldClass} ${
|
className={`mt-4 resize-y ${fieldClass} ${
|
||||||
|
|
@ -368,23 +386,26 @@ export default function FeedbackForm() {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Optional contact details */}
|
{/* Optional contact details */}
|
||||||
<div className="mt-8 rounded-xl border border-dashed border-[#4a6b72]/30 bg-[#eef9fb]/60 p-5 sm:p-6">
|
<div className="mt-8 rounded-xl border border-dashed border-muted/30 bg-tint/60 p-5 sm:p-6">
|
||||||
<div className="flex flex-wrap items-center">
|
<div className="flex flex-wrap items-center">
|
||||||
<h3 className="text-base font-semibold text-[#26454c]">Your details</h3>
|
<h3 className="text-base font-semibold text-body">
|
||||||
<OptionalTag />
|
{request ? "How we reach you" : "Your details"}
|
||||||
|
</h3>
|
||||||
|
{!request && <OptionalTag />}
|
||||||
</div>
|
</div>
|
||||||
<p className="mt-1 max-w-prose text-sm" style={{ color: MUTED }}>
|
<p className="mt-1 max-w-prose text-sm" style={{ color: MUTED }}>
|
||||||
Leave these blank and your feedback comes through anonymously. Fill
|
{request
|
||||||
them in only if you'd like a reply, we won't add you to any list.
|
? "We use these only to answer this request, and we won't add you to any list."
|
||||||
|
: "Leave these blank and your feedback comes through anonymously. Fill them in only if you'd like a reply, we won't add you to any list."}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="mt-5 grid gap-4 sm:grid-cols-2">
|
<div className="mt-5 grid gap-4 sm:grid-cols-2">
|
||||||
<div>
|
<div>
|
||||||
<label
|
<label
|
||||||
htmlFor="feedback-name"
|
htmlFor="feedback-name"
|
||||||
className="block text-sm font-medium text-[#26454c]"
|
className="block text-sm font-medium text-body"
|
||||||
>
|
>
|
||||||
Name <span className="font-normal text-[#4a6b72]">(optional)</span>
|
Name <span className="font-normal text-muted">(optional)</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="feedback-name"
|
id="feedback-name"
|
||||||
|
|
@ -398,14 +419,16 @@ export default function FeedbackForm() {
|
||||||
<div>
|
<div>
|
||||||
<label
|
<label
|
||||||
htmlFor="feedback-email"
|
htmlFor="feedback-email"
|
||||||
className="block text-sm font-medium text-[#26454c]"
|
className="block text-sm font-medium text-body"
|
||||||
>
|
>
|
||||||
Email <span className="font-normal text-[#4a6b72]">(optional)</span>
|
Email{" "}
|
||||||
|
<span className="font-normal text-muted">{request ? "(required)" : "(optional)"}</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="feedback-email"
|
id="feedback-email"
|
||||||
type="email"
|
type="email"
|
||||||
autoComplete="email"
|
autoComplete="email"
|
||||||
|
required={request}
|
||||||
value={email}
|
value={email}
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
aria-invalid={Boolean(fieldErrors.email)}
|
aria-invalid={Boolean(fieldErrors.email)}
|
||||||
|
|
@ -437,7 +460,7 @@ export default function FeedbackForm() {
|
||||||
{formError && (
|
{formError && (
|
||||||
<p
|
<p
|
||||||
role="alert"
|
role="alert"
|
||||||
className="mt-8 rounded-xl border border-[#b3261e]/30 bg-[#fdf3f2] px-4 py-3 text-sm text-[#b3261e]"
|
className="mt-8 rounded-xl border border-danger/30 bg-danger-tint px-4 py-3 text-sm text-danger"
|
||||||
>
|
>
|
||||||
{formError}
|
{formError}
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -447,13 +470,15 @@ export default function FeedbackForm() {
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={!ready || sending}
|
disabled={!ready || sending}
|
||||||
className="rounded-full bg-[#0f7183] px-7 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 disabled:text-white/80"
|
className="rounded-full bg-action px-7 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 disabled:text-white/80"
|
||||||
>
|
>
|
||||||
{sending ? "Sending…" : "Send feedback"}
|
{sending ? "Sending…" : request ? "Send request" : "Send feedback"}
|
||||||
</button>
|
</button>
|
||||||
{!ready && !sending && (
|
{!ready && !sending && (
|
||||||
<p className="text-sm" style={{ color: MUTED }}>
|
<p className="text-sm" style={{ color: MUTED }}>
|
||||||
Choose a type and write at least a sentence to send.
|
{request
|
||||||
|
? "Write at least a sentence and give an email address to send."
|
||||||
|
: "Choose a type and write at least a sentence to send."}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
import { useState } from "react";
|
|
||||||
import ArrowLink from "../../components/ArrowLink.tsx";
|
import ArrowLink from "../../components/ArrowLink.tsx";
|
||||||
import { orgLogo } from "../../lib/media.ts";
|
import { mediaUrl } from "../../lib/media.ts";
|
||||||
|
import Logo from "../../components/Logo.tsx";
|
||||||
import {
|
import {
|
||||||
initialsFor,
|
initialsFor,
|
||||||
orgPath,
|
orgPath,
|
||||||
useOrganizations,
|
useOrganizations,
|
||||||
byName,
|
byName,
|
||||||
} from "../../lib/organizations.ts";
|
} from "../../lib/organizations.ts";
|
||||||
|
import { accentText } from '../../lib/color.ts'
|
||||||
|
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
ORGANIZATION LIST: CARDS
|
ORGANIZATION LIST: CARDS
|
||||||
|
|
@ -23,8 +24,8 @@ import {
|
||||||
array, only the short card description.
|
array, only the short card description.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
const MUTED = "#7a9299";
|
const MUTED = "var(--color-muted)";
|
||||||
const INK = "#2c4a50";
|
const INK = "var(--color-body)";
|
||||||
const FALLBACK_COLOR = "#4a6b72";
|
const FALLBACK_COLOR = "#4a6b72";
|
||||||
|
|
||||||
/* Wide enough for a logo beside two lines of text, narrow enough
|
/* Wide enough for a logo beside two lines of text, narrow enough
|
||||||
|
|
@ -34,27 +35,20 @@ const CARD_MIN = "20rem";
|
||||||
const GRID_MAX = "88rem";
|
const GRID_MAX = "88rem";
|
||||||
|
|
||||||
function OrgMark({ org, color }) {
|
function OrgMark({ org, color }) {
|
||||||
const [failed, setFailed] = useState(false);
|
|
||||||
|
|
||||||
if (org.logo && !failed) {
|
|
||||||
return (
|
|
||||||
<img
|
|
||||||
src={orgLogo(org.logo) ?? undefined}
|
|
||||||
alt=""
|
|
||||||
onError={() => setFailed(true)}
|
|
||||||
className="h-14 w-14 object-contain rounded-xl shrink-0"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span
|
<Logo
|
||||||
className="h-14 w-14 rounded-xl shrink-0 flex items-center justify-center font-extrabold"
|
src={mediaUrl(org.logo)}
|
||||||
style={{ border: `1px solid ${color}`, color }}
|
className="h-14 w-14 object-contain rounded-xl shrink-0"
|
||||||
aria-hidden="true"
|
fallback={
|
||||||
>
|
<span
|
||||||
{initialsFor(org.name)}
|
className="h-14 w-14 rounded-xl shrink-0 flex items-center justify-center font-extrabold"
|
||||||
</span>
|
style={{ border: `1px solid ${color}`, color: accentText(color) }}
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
{initialsFor(org.name)}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,7 +64,7 @@ function OrgCard({ org, accent, pageLabel, siteLabel }) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="rounded-2xl p-6 h-full flex flex-col transition-transform duration-200 hover:scale-[1.01]"
|
className="rounded-2xl p-6 h-full flex flex-col transition-transform duration-200 hover:scale-[1.01]"
|
||||||
style={{ border: `1px solid ${color}`, background: "#ffffff" }}
|
style={{ border: `1px solid ${color}`, background: "var(--color-surface)" }}
|
||||||
>
|
>
|
||||||
<div className="flex items-start gap-4">
|
<div className="flex items-start gap-4">
|
||||||
<OrgMark org={org} color={color} />
|
<OrgMark org={org} color={color} />
|
||||||
|
|
@ -195,7 +189,7 @@ export default function OrgListCards({
|
||||||
|
|
||||||
if (error && organizations.length === 0) {
|
if (error && organizations.length === 0) {
|
||||||
return shell(
|
return shell(
|
||||||
<p className="font-semibold" style={{ color: accent }}>
|
<p className="font-semibold" style={{ color: accentText(accent) }}>
|
||||||
· This list couldn't be loaded just now, please try again shortly ·
|
· This list couldn't be loaded just now, please try again shortly ·
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
|
|
@ -203,7 +197,7 @@ export default function OrgListCards({
|
||||||
|
|
||||||
if (organizations.length === 0) {
|
if (organizations.length === 0) {
|
||||||
return shell(
|
return shell(
|
||||||
<p className="font-semibold" style={{ color: accent }}>
|
<p className="font-semibold" style={{ color: accentText(accent) }}>
|
||||||
{empty}
|
{empty}
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,11 @@ import { useEffect, useRef, useState } from "react";
|
||||||
import { useCommunity } from "../../lib/chapters.ts";
|
import { useCommunity } from "../../lib/chapters.ts";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import ArrowLink from "../../components/ArrowLink.tsx";
|
import ArrowLink from "../../components/ArrowLink.tsx";
|
||||||
import { orgLogo } from "../../lib/media.ts";
|
import { mediaUrl } from "../../lib/media.ts";
|
||||||
import { initialsFor, orgPath } from "../../lib/organizations.ts";
|
import { initialsFor, orgPath } from "../../lib/organizations.ts";
|
||||||
import { AREAS, AREA_NAMES } from "../../data/mapGrid.ts";
|
import { AREAS, AREA_NAMES } from "../../data/mapGrid.ts";
|
||||||
|
import { withAlpha, accentText, readableOn } from '../../lib/color.ts'
|
||||||
|
import { scrollBehavior } from "../../lib/motion.ts";
|
||||||
|
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
ORGANIZATION LIST: MAP
|
ORGANIZATION LIST: MAP
|
||||||
|
|
@ -40,9 +42,9 @@ const ROWS = 7;
|
||||||
// stays at max-w-6xl, so this deliberately breaks out past it.
|
// stays at max-w-6xl, so this deliberately breaks out past it.
|
||||||
const CONTENT_MAX = "88rem";
|
const CONTENT_MAX = "88rem";
|
||||||
|
|
||||||
const MUTED = "#7a9299";
|
const MUTED = "var(--color-muted)";
|
||||||
const RULE = "#cfe3e7";
|
const RULE = "color-mix(in srgb, var(--color-muted) 25%, transparent)";
|
||||||
const INK = "#2c4a50";
|
const INK = "var(--color-body)";
|
||||||
const FALLBACK_COLOR = "#4a6b72";
|
const FALLBACK_COLOR = "#4a6b72";
|
||||||
|
|
||||||
/* organizations.color is nullable; an SVG fill left undefined paints
|
/* organizations.color is nullable; an SVG fill left undefined paints
|
||||||
|
|
@ -214,7 +216,7 @@ function Tile({
|
||||||
height={size}
|
height={size}
|
||||||
rx={14}
|
rx={14}
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke={active ? colorOf(primary) : "#ffffff"}
|
stroke={active ? colorOf(primary) : "var(--color-surface)"}
|
||||||
strokeOpacity={active ? 1 : 0.55}
|
strokeOpacity={active ? 1 : 0.55}
|
||||||
strokeWidth={active ? 4 : 2}
|
strokeWidth={active ? 4 : 2}
|
||||||
className="transition-all duration-200"
|
className="transition-all duration-200"
|
||||||
|
|
@ -227,7 +229,7 @@ function Tile({
|
||||||
dominantBaseline="middle"
|
dominantBaseline="middle"
|
||||||
fontSize={fontSize}
|
fontSize={fontSize}
|
||||||
fontWeight="800"
|
fontWeight="800"
|
||||||
fill={count ? "#ffffff" : colorOf(primary)}
|
fill={count ? "var(--color-surface)" : colorOf(primary)}
|
||||||
style={{ pointerEvents: "none" }}
|
style={{ pointerEvents: "none" }}
|
||||||
>
|
>
|
||||||
{label || code}
|
{label || code}
|
||||||
|
|
@ -292,7 +294,7 @@ function LegendButton({ region, selected, setSelected, hovered, setHovered }) {
|
||||||
style={{
|
style={{
|
||||||
border: `1px solid ${colorOf(region)}`,
|
border: `1px solid ${colorOf(region)}`,
|
||||||
background: on ? colorOf(region) : "transparent",
|
background: on ? colorOf(region) : "transparent",
|
||||||
color: on ? "#ffffff" : INK,
|
color: on ? readableOn(colorOf(region)) : INK,
|
||||||
opacity: selected && selected !== region.id ? 0.45 : 1,
|
opacity: selected && selected !== region.id ? 0.45 : 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
@ -471,7 +473,7 @@ function OrgLogo({ org, color, size = "h-14 w-14" }) {
|
||||||
if (org.logo && !failed) {
|
if (org.logo && !failed) {
|
||||||
return (
|
return (
|
||||||
<img
|
<img
|
||||||
src={orgLogo(org.logo) ?? undefined}
|
src={mediaUrl(org.logo) ?? undefined}
|
||||||
alt={org.name}
|
alt={org.name}
|
||||||
onError={() => setFailed(true)}
|
onError={() => setFailed(true)}
|
||||||
className={`${size} object-contain rounded-xl shrink-0`}
|
className={`${size} object-contain rounded-xl shrink-0`}
|
||||||
|
|
@ -496,7 +498,7 @@ function ChapterCard({ chapter, color, open, onOpen }) {
|
||||||
className="rounded-2xl p-4 flex items-start gap-4 transition-all duration-200"
|
className="rounded-2xl p-4 flex items-start gap-4 transition-all duration-200"
|
||||||
style={{
|
style={{
|
||||||
border: `1px solid ${color}`,
|
border: `1px solid ${color}`,
|
||||||
background: open ? `${color}14` : "transparent",
|
background: open ? `${withAlpha(color, 8)}` : "transparent",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<OrgLogo org={chapter} color={color} />
|
<OrgLogo org={chapter} color={color} />
|
||||||
|
|
@ -574,7 +576,7 @@ function ChapterDetail({ chapter, region, onClose }) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="rounded-2xl p-6 mb-6"
|
className="rounded-2xl p-6 mb-6"
|
||||||
style={{ border: `2px solid ${colorOf(region)}`, background: `${colorOf(region)}0f` }}
|
style={{ border: `2px solid ${colorOf(region)}`, background: `${withAlpha(colorOf(region), 6)}` }}
|
||||||
>
|
>
|
||||||
<div className="flex items-start gap-4">
|
<div className="flex items-start gap-4">
|
||||||
<OrgLogo org={chapter} color={colorOf(region)} size="h-20 w-20" />
|
<OrgLogo org={chapter} color={colorOf(region)} size="h-20 w-20" />
|
||||||
|
|
@ -616,7 +618,7 @@ function ChapterDetail({ chapter, region, onClose }) {
|
||||||
<Link
|
<Link
|
||||||
to={orgPath(chapter)!}
|
to={orgPath(chapter)!}
|
||||||
className="py-2 px-5 rounded-xl font-bold text-sm transition-transform duration-200 hover:scale-105"
|
className="py-2 px-5 rounded-xl font-bold text-sm transition-transform duration-200 hover:scale-105"
|
||||||
style={{ background: colorOf(region), color: "#ffffff" }}
|
style={{ background: colorOf(region), color: readableOn(colorOf(region)) }}
|
||||||
>
|
>
|
||||||
Chapter page
|
Chapter page
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -723,7 +725,7 @@ function ChapterGrid({ regions, chapters, chaptersIn, subtextFor, openId, setOpe
|
||||||
export function OrgMapToggle({ view, setView, accent }) {
|
export function OrgMapToggle({ view, setView, accent }) {
|
||||||
const btn = active => ({
|
const btn = active => ({
|
||||||
background: active ? accent : "transparent",
|
background: active ? accent : "transparent",
|
||||||
color: active ? "#ffffff" : accent,
|
color: active ? readableOn(accent) : accentText(accent),
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -797,7 +799,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
||||||
// that it's stacked under the map and scrolling it would fight
|
// that it's stacked under the map and scrolling it would fight
|
||||||
// the page.
|
// the page.
|
||||||
if (box.scrollHeight <= box.clientHeight) return;
|
if (box.scrollHeight <= box.clientHeight) return;
|
||||||
box.scrollTo({ top: el.offsetTop - 8, behavior: "smooth" });
|
box.scrollTo({ top: el.offsetTop - 8, behavior: scrollBehavior() });
|
||||||
};
|
};
|
||||||
|
|
||||||
// Hovering or selecting a region on the map or legend brings its
|
// Hovering or selecting a region on the map or legend brings its
|
||||||
|
|
@ -834,7 +836,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
||||||
|
|
||||||
if (error && regions.length === 0) {
|
if (error && regions.length === 0) {
|
||||||
return shell(
|
return shell(
|
||||||
<p className="font-semibold" style={{ color: accent }}>
|
<p className="font-semibold" style={{ color: accentText(accent) }}>
|
||||||
· Chapters couldn't be loaded just now, please try again shortly ·
|
· Chapters couldn't be loaded just now, please try again shortly ·
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { useId, useState } from "react";
|
import { useId, useState } from "react";
|
||||||
import ArrowLink from "../../components/ArrowLink.tsx";
|
import ArrowLink from "../../components/ArrowLink.tsx";
|
||||||
import { orgLogo } from "../../lib/media.ts";
|
import { mediaUrl } from "../../lib/media.ts";
|
||||||
|
import Logo from "../../components/Logo.tsx";
|
||||||
import PlatformIcon from "../../components/PlatformIcon.tsx";
|
import PlatformIcon from "../../components/PlatformIcon.tsx";
|
||||||
import {
|
import {
|
||||||
areasSentence,
|
areasSentence,
|
||||||
|
|
@ -9,6 +10,7 @@ import {
|
||||||
useOrganizations,
|
useOrganizations,
|
||||||
byName,
|
byName,
|
||||||
} from "../../lib/organizations.ts";
|
} from "../../lib/organizations.ts";
|
||||||
|
import { accentText } from '../../lib/color.ts'
|
||||||
|
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
ORGANIZATION LIST: VERTICAL
|
ORGANIZATION LIST: VERTICAL
|
||||||
|
|
@ -38,9 +40,9 @@ import {
|
||||||
a partner row simply doesn't have them.
|
a partner row simply doesn't have them.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
const MUTED = "#7a9299";
|
const MUTED = "var(--color-muted)";
|
||||||
const RULE = "#cfe3e7";
|
const RULE = "color-mix(in srgb, var(--color-muted) 25%, transparent)";
|
||||||
const INK = "#2c4a50";
|
const INK = "var(--color-body)";
|
||||||
const FALLBACK_COLOR = "#4a6b72";
|
const FALLBACK_COLOR = "#4a6b72";
|
||||||
|
|
||||||
/* ── Row button ───────────────────────────────────────────────
|
/* ── Row button ───────────────────────────────────────────────
|
||||||
|
|
@ -61,38 +63,18 @@ function RowButton({ as: As = "button", color, children, ...rest }: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function OrgMark({ org, color }) {
|
function OrgMark({ org, color }) {
|
||||||
const [failed, setFailed] = useState(false);
|
const fallback = org.color ? (
|
||||||
|
<span className="h-3 w-3 rounded-full shrink-0" style={{ background: color }} aria-hidden="true" />
|
||||||
if (org.logo && !failed) {
|
) : (
|
||||||
return (
|
|
||||||
<img
|
|
||||||
src={orgLogo(org.logo) ?? undefined}
|
|
||||||
alt=""
|
|
||||||
onError={() => setFailed(true)}
|
|
||||||
className="h-8 w-8 object-contain shrink-0"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (org.color) {
|
|
||||||
return (
|
|
||||||
<span
|
|
||||||
className="h-3 w-3 rounded-full shrink-0"
|
|
||||||
style={{ background: color }}
|
|
||||||
aria-hidden="true"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<span
|
<span
|
||||||
className="h-8 w-8 rounded-lg shrink-0 flex items-center justify-center text-xs font-extrabold"
|
className="h-8 w-8 rounded-lg shrink-0 flex items-center justify-center text-xs font-extrabold"
|
||||||
style={{ border: `1px solid ${color}`, color }}
|
style={{ border: `1px solid ${color}`, color: accentText(color) }}
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
>
|
>
|
||||||
{initialsFor(org.name)}
|
{initialsFor(org.name)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
return <Logo src={mediaUrl(org.logo)} className="h-8 w-8 object-contain shrink-0" fallback={fallback} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
function OrgRow({ org, pageLabel, siteLabel }) {
|
function OrgRow({ org, pageLabel, siteLabel }) {
|
||||||
|
|
@ -290,7 +272,7 @@ export default function OrgListVertical({
|
||||||
|
|
||||||
if (error && organizations.length === 0) {
|
if (error && organizations.length === 0) {
|
||||||
return shell(
|
return shell(
|
||||||
<p className="font-semibold" style={{ color: accent }}>
|
<p className="font-semibold" style={{ color: accentText(accent) }}>
|
||||||
· This list couldn't be loaded just now, please try again shortly ·
|
· This list couldn't be loaded just now, please try again shortly ·
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
|
|
@ -298,7 +280,7 @@ export default function OrgListVertical({
|
||||||
|
|
||||||
if (organizations.length === 0) {
|
if (organizations.length === 0) {
|
||||||
return shell(
|
return shell(
|
||||||
<p className="font-semibold" style={{ color: accent }}>
|
<p className="font-semibold" style={{ color: accentText(accent) }}>
|
||||||
{empty}
|
{empty}
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,10 @@ import { NAV_ACTIONS, PAGE_LINKS, PAGE_SECTIONS } from '../../navConfig.ts'
|
||||||
import { awardHref, blogHref, eventHref, orgHref, personHref, teamHref } from '../../lib/hrefs.ts'
|
import { awardHref, blogHref, eventHref, orgHref, personHref, teamHref } from '../../lib/hrefs.ts'
|
||||||
import { siteUrl } from '../../lib/site.ts'
|
import { siteUrl } from '../../lib/site.ts'
|
||||||
import { useDirectory, type Directory } from '../../lib/useContent.ts'
|
import { useDirectory, type Directory } from '../../lib/useContent.ts'
|
||||||
|
import { accentText } from '../../lib/color.ts'
|
||||||
|
|
||||||
const TEAL = '#0f7183'
|
const TEAL = '#0f7183'
|
||||||
const MUTED = '#4a6b72'
|
const MUTED = 'var(--color-muted)'
|
||||||
|
|
||||||
/* PNG download size in pixels. Plenty for print at a few inches;
|
/* PNG download size in pixels. Plenty for print at a few inches;
|
||||||
anything bigger should use the SVG. */
|
anything bigger should use the SVG. */
|
||||||
|
|
@ -316,7 +317,7 @@ export default function QrCodeMaker() {
|
||||||
|
|
||||||
{kind === 'custom' ? (
|
{kind === 'custom' ? (
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="qr-custom" className="block text-sm font-medium text-[#26454c]">
|
<label htmlFor="qr-custom" className="block text-sm font-medium text-body">
|
||||||
Link
|
Link
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
|
|
@ -337,7 +338,7 @@ export default function QrCodeMaker() {
|
||||||
) : needsDirectory && loading && !directory ? (
|
) : needsDirectory && loading && !directory ? (
|
||||||
<p style={{ color: MUTED }}>Loading the list…</p>
|
<p style={{ color: MUTED }}>Loading the list…</p>
|
||||||
) : needsDirectory && error ? (
|
) : needsDirectory && error ? (
|
||||||
<p className="text-[#b3261e]">Couldn't load the list of pages. {error}</p>
|
<p className="text-danger">Couldn't load the list of pages. {error}</p>
|
||||||
) : choices.length === 0 ? (
|
) : choices.length === 0 ? (
|
||||||
<p style={{ color: MUTED }}>Nothing published here yet.</p>
|
<p style={{ color: MUTED }}>Nothing published here yet.</p>
|
||||||
) : (
|
) : (
|
||||||
|
|
@ -390,7 +391,7 @@ export default function QrCodeMaker() {
|
||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend className="text-sm font-medium text-[#26454c]">Colours</legend>
|
<legend className="text-sm font-medium text-body">Colours</legend>
|
||||||
<div className="mt-2 flex flex-wrap items-end gap-5">
|
<div className="mt-2 flex flex-wrap items-end gap-5">
|
||||||
<ColourInput id="qr-ink" label="Code" value={ink} onChange={setInk} />
|
<ColourInput id="qr-ink" label="Code" value={ink} onChange={setInk} />
|
||||||
<ColourInput id="qr-paper" label="Background" value={paper} onChange={setPaper} />
|
<ColourInput id="qr-paper" label="Background" value={paper} onChange={setPaper} />
|
||||||
|
|
@ -406,14 +407,14 @@ export default function QrCodeMaker() {
|
||||||
setDoveColor(QR_DOVE)
|
setDoveColor(QR_DOVE)
|
||||||
}}
|
}}
|
||||||
className="pb-2 text-sm underline"
|
className="pb-2 text-sm underline"
|
||||||
style={{ color: TEAL }}
|
style={{ color: accentText(TEAL) }}
|
||||||
>
|
>
|
||||||
Reset colours
|
Reset colours
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{warning && (
|
{warning && (
|
||||||
<p role="status" className="mt-2 rounded-lg bg-[#fdf3f2] px-3 py-2 text-sm text-[#b3261e]">
|
<p role="status" className="mt-2 rounded-lg bg-danger-tint px-3 py-2 text-sm text-danger">
|
||||||
{warning}
|
{warning}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
@ -421,16 +422,16 @@ export default function QrCodeMaker() {
|
||||||
|
|
||||||
{url && (
|
{url && (
|
||||||
<div>
|
<div>
|
||||||
<p className="text-sm font-medium text-[#26454c]">Links to</p>
|
<p className="text-sm font-medium text-body">Links to</p>
|
||||||
<div className="mt-2 flex flex-wrap items-center gap-3">
|
<div className="mt-2 flex flex-wrap items-center gap-3">
|
||||||
<code className="break-all rounded-lg bg-white px-3 py-2 text-sm text-[#26454c] ring-1 ring-[#4a6b72]/20">
|
<code className="break-all rounded-lg bg-surface px-3 py-2 text-sm text-body ring-1 ring-muted/20">
|
||||||
{url}
|
{url}
|
||||||
</code>
|
</code>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={copy}
|
onClick={copy}
|
||||||
className="rounded-full border px-4 py-2 text-sm font-semibold transition-colors hover:bg-[#138ba0]/10"
|
className="rounded-full border px-4 py-2 text-sm font-semibold transition-colors hover:bg-brand/10"
|
||||||
style={{ borderColor: TEAL, color: TEAL }}
|
style={{ borderColor: TEAL, color: accentText(TEAL) }}
|
||||||
>
|
>
|
||||||
{copied ? 'Copied ✓' : 'Copy link'}
|
{copied ? 'Copied ✓' : 'Copy link'}
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -442,7 +443,7 @@ export default function QrCodeMaker() {
|
||||||
<div className="flex flex-col items-center gap-5">
|
<div className="flex flex-col items-center gap-5">
|
||||||
{url ? (
|
{url ? (
|
||||||
<>
|
<>
|
||||||
<div className="w-full max-w-sm rounded-3xl bg-white p-6 shadow-lg ring-1 ring-[#4a6b72]/10">
|
<div className="w-full max-w-sm rounded-3xl bg-white p-6 shadow-lg ring-1 ring-muted/10">
|
||||||
<QrCode
|
<QrCode
|
||||||
ref={svgRef}
|
ref={svgRef}
|
||||||
value={url}
|
value={url}
|
||||||
|
|
@ -467,7 +468,7 @@ export default function QrCodeMaker() {
|
||||||
</p>
|
</p>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<div className="aspect-square w-full max-w-sm rounded-3xl bg-white/60 ring-1 ring-[#4a6b72]/10" />
|
<div className="aspect-square w-full max-w-sm rounded-3xl bg-white/60 ring-1 ring-muted/10" />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -479,7 +480,7 @@ function DownloadButton({ onClick, children }: { onClick: () => void; children:
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
className="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"
|
className="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"
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -487,8 +488,8 @@ function DownloadButton({ onClick, children }: { onClick: () => void; children:
|
||||||
}
|
}
|
||||||
|
|
||||||
const inputClass =
|
const inputClass =
|
||||||
'w-full rounded-xl border border-[#4a6b72]/25 bg-white px-4 py-3 text-[#26454c] ' +
|
'w-full rounded-xl border border-muted/25 bg-surface px-4 py-3 text-body ' +
|
||||||
'outline-none transition-colors focus:border-[#138ba0] focus:ring-2 focus:ring-[#138ba0]/25'
|
'outline-none transition-colors focus:border-brand focus:ring-2 focus:ring-brand/25'
|
||||||
|
|
||||||
/* A colour well with its hex beside it, both editable. */
|
/* A colour well with its hex beside it, both editable. */
|
||||||
function ColourInput({
|
function ColourInput({
|
||||||
|
|
@ -515,7 +516,7 @@ function ColourInput({
|
||||||
type="color"
|
type="color"
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(e) => onChange(e.target.value)}
|
onChange={(e) => onChange(e.target.value)}
|
||||||
className="h-9 w-11 cursor-pointer rounded border border-[#4a6b72]/25 bg-white"
|
className="h-9 w-11 cursor-pointer rounded border border-muted/25 bg-white"
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
|
@ -525,7 +526,7 @@ function ColourInput({
|
||||||
setText(e.target.value)
|
setText(e.target.value)
|
||||||
if (/^#[0-9a-f]{6}$/i.test(e.target.value)) onChange(e.target.value.toLowerCase())
|
if (/^#[0-9a-f]{6}$/i.test(e.target.value)) onChange(e.target.value.toLowerCase())
|
||||||
}}
|
}}
|
||||||
className="w-24 rounded-lg border border-[#4a6b72]/25 bg-white px-2 py-1.5 font-mono text-sm text-[#26454c] outline-none focus:border-[#138ba0]"
|
className="w-24 rounded-lg border border-muted/25 bg-surface px-2 py-1.5 font-mono text-sm text-body outline-none focus:border-brand"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -533,8 +534,8 @@ function ColourInput({
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectClass =
|
const selectClass =
|
||||||
'w-full appearance-none rounded-xl border border-[#4a6b72]/25 bg-white px-4 py-3 pr-10 text-[#26454c] ' +
|
'w-full appearance-none rounded-xl border border-muted/25 bg-surface px-4 py-3 pr-10 text-body ' +
|
||||||
'outline-none transition-colors focus:border-[#138ba0] focus:ring-2 focus:ring-[#138ba0]/25'
|
'outline-none transition-colors focus:border-brand focus:ring-2 focus:ring-brand/25'
|
||||||
|
|
||||||
function Select({
|
function Select({
|
||||||
id,
|
id,
|
||||||
|
|
@ -551,7 +552,7 @@ function Select({
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor={id} className="block text-sm font-medium text-[#26454c]">
|
<label htmlFor={id} className="block text-sm font-medium text-body">
|
||||||
{label}
|
{label}
|
||||||
</label>
|
</label>
|
||||||
<div className="relative mt-2">
|
<div className="relative mt-2">
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import { MONTH_LABELS, type PersonRef, type TimelineItem } from '../../../lib/timeline.ts'
|
import { MONTH_LABELS, type PersonRef, type TimelineItem } from '../../../lib/timeline.ts'
|
||||||
import { hrefFor, logoSrc, photoSrc } from '../../../lib/timelineRefs.ts'
|
import { hrefFor, logoSrc } from '../../../lib/timelineRefs.ts'
|
||||||
import { initials } from '../../../lib/media.ts'
|
import { initials, mediaUrl } from '../../../lib/media.ts'
|
||||||
|
|
||||||
const KIND_NAMES: Record<TimelineItem['kind'], string> = {
|
const KIND_NAMES: Record<TimelineItem['kind'], string> = {
|
||||||
milestone: 'Milestone',
|
milestone: 'Milestone',
|
||||||
|
|
@ -28,7 +28,7 @@ function fullMarker(item: TimelineItem): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
function PersonChip({ person }: { person: PersonRef }) {
|
function PersonChip({ person }: { person: PersonRef }) {
|
||||||
const src = photoSrc(person.photo)
|
const src = mediaUrl(person.photo)
|
||||||
return (
|
return (
|
||||||
<li className="ngu-tl__person">
|
<li className="ngu-tl__person">
|
||||||
{src ? (
|
{src ? (
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,11 @@
|
||||||
.ngu-tl {
|
.ngu-tl {
|
||||||
/* Defaults match the site palette; History.tsx overrides accent and
|
/* Defaults match the site palette; History.tsx overrides accent and
|
||||||
surface per section so the rail sits on the right background. */
|
surface per section so the rail sits on the right background. */
|
||||||
--tl-ink: #16343a;
|
--tl-ink: var(--color-ink);
|
||||||
--tl-muted: #4a6b72;
|
--tl-muted: var(--color-muted);
|
||||||
--tl-faint: #8aa7ad;
|
--tl-faint: color-mix(in srgb, var(--color-muted) 70%, transparent);
|
||||||
--tl-rail: #cfe4e8;
|
--tl-rail: color-mix(in srgb, var(--color-brand) 20%, transparent);
|
||||||
--tl-surface: #ffffff;
|
--tl-surface: var(--color-surface);
|
||||||
--tl-accent: #0f7183;
|
--tl-accent: #0f7183;
|
||||||
--tl-accent-soft: color-mix(in srgb, var(--tl-accent) 12%, transparent);
|
--tl-accent-soft: color-mix(in srgb, var(--tl-accent) 12%, transparent);
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@
|
||||||
line-height: 1.1;
|
line-height: 1.1;
|
||||||
writing-mode: vertical-rl;
|
writing-mode: vertical-rl;
|
||||||
text-orientation: sideways;
|
text-orientation: sideways;
|
||||||
color: var(--tl-accent);
|
color: color-mix(in srgb, var(--tl-accent) var(--accent-text-mix), #fff);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ngu-tl__decade--pre .ngu-tl__decadeNum {
|
.ngu-tl__decade--pre .ngu-tl__decadeNum {
|
||||||
|
|
@ -162,7 +162,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ngu-tl__yearBtn:hover .ngu-tl__yearLabel {
|
.ngu-tl__yearBtn:hover .ngu-tl__yearLabel {
|
||||||
color: var(--tl-accent);
|
color: color-mix(in srgb, var(--tl-accent) var(--accent-text-mix), #fff);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ngu-tl__yearBtn:focus-visible {
|
.ngu-tl__yearBtn:focus-visible {
|
||||||
|
|
@ -323,7 +323,7 @@ a.ngu-tl__entry:focus-visible {
|
||||||
}
|
}
|
||||||
|
|
||||||
a.ngu-tl__entry:hover .ngu-tl__entryTitle {
|
a.ngu-tl__entry:hover .ngu-tl__entryTitle {
|
||||||
color: var(--tl-accent);
|
color: color-mix(in srgb, var(--tl-accent) var(--accent-text-mix), #fff);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ngu-tl__entryMeta {
|
.ngu-tl__entryMeta {
|
||||||
|
|
@ -441,7 +441,7 @@ a.ngu-tl__entry--featured:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.ngu-tl__toolbarBtn:hover {
|
.ngu-tl__toolbarBtn:hover {
|
||||||
color: var(--tl-accent);
|
color: color-mix(in srgb, var(--tl-accent) var(--accent-text-mix), #fff);
|
||||||
border-color: var(--tl-accent);
|
border-color: var(--tl-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -505,7 +505,7 @@ a.ngu-tl__entry--featured:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.ngu-tl__upcomingBtn:hover {
|
.ngu-tl__upcomingBtn:hover {
|
||||||
color: var(--tl-accent);
|
color: color-mix(in srgb, var(--tl-accent) var(--accent-text-mix), #fff);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ngu-tl__upcomingBtn:focus-visible {
|
.ngu-tl__upcomingBtn:focus-visible {
|
||||||
|
|
@ -629,7 +629,7 @@ a.ngu-tl__entry--featured:hover {
|
||||||
font-size: 0.625rem;
|
font-size: 0.625rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 0.02em;
|
letter-spacing: 0.02em;
|
||||||
color: var(--tl-accent);
|
color: color-mix(in srgb, var(--tl-accent) var(--accent-text-mix), #fff);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ngu-tl__personName {
|
.ngu-tl__personName {
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ type CalendarBandProps = { id: string; title: string; blurb?: string | null }
|
||||||
|
|
||||||
export default function CalendarBand({ id, title, blurb }: CalendarBandProps) {
|
export default function CalendarBand({ id, title, blurb }: CalendarBandProps) {
|
||||||
return (
|
return (
|
||||||
<section id={id} className="py-24" style={{ background: '#f6fbfc' }}>
|
<section id={id} className="py-24" style={{ background: 'var(--color-tint-soft)' }}>
|
||||||
<div className="mx-auto mb-10 max-w-6xl px-6">
|
<div className="mx-auto mb-10 max-w-6xl px-6">
|
||||||
<h2 className="font-display text-4xl font-extrabold text-[#073d4a] md:text-5xl">
|
<h2 className="font-display text-4xl font-extrabold text-ink md:text-5xl">
|
||||||
{title}
|
{title}
|
||||||
</h2>
|
</h2>
|
||||||
{blurb && <p className="mt-3 max-w-xl text-lg text-[#4a6b72]">{blurb}</p>}
|
{blurb && <p className="mt-3 max-w-xl text-lg text-muted">{blurb}</p>}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<EventCalendar />
|
<EventCalendar />
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@ type FeaturedBandProps = {
|
||||||
|
|
||||||
export default function FeaturedBand({ id, title, blurb, cards }: FeaturedBandProps) {
|
export default function FeaturedBand({ id, title, blurb, cards }: FeaturedBandProps) {
|
||||||
return (
|
return (
|
||||||
<section id={id} className="py-24" style={{ background: '#f6fbfc' }}>
|
<section id={id} className="py-24" style={{ background: 'var(--color-tint-soft)' }}>
|
||||||
<div className="mx-auto max-w-6xl px-6">
|
<div className="mx-auto max-w-6xl px-6">
|
||||||
<h2 className="font-display text-4xl font-extrabold text-[#073d4a] md:text-5xl">{title}</h2>
|
<h2 className="font-display text-4xl font-extrabold text-ink md:text-5xl">{title}</h2>
|
||||||
{blurb && <p className="mt-4 max-w-2xl text-lg text-[#4a6b72]">{blurb}</p>}
|
{blurb && <p className="mt-4 max-w-2xl text-lg text-muted">{blurb}</p>}
|
||||||
<div className="mt-12">
|
<div className="mt-12">
|
||||||
<FeaturedCards cards={cards} />
|
<FeaturedCards cards={cards} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ import HomeLink from './HomeLink.tsx'
|
||||||
import { useHistory } from '../../../lib/useHistory.ts'
|
import { useHistory } from '../../../lib/useHistory.ts'
|
||||||
import { hrefFor, logoSrc } from '../../../lib/timelineRefs.ts'
|
import { hrefFor, logoSrc } from '../../../lib/timelineRefs.ts'
|
||||||
import { MONTH_LABELS, type TimelineItem } from '../../../lib/timeline.ts'
|
import { MONTH_LABELS, type TimelineItem } from '../../../lib/timeline.ts'
|
||||||
|
import { accentText } from '../../../lib/color.ts'
|
||||||
|
import { scrollBehavior } from '../../../lib/motion.ts';
|
||||||
|
|
||||||
const TEAL = '#0f7183'
|
const TEAL = '#0f7183'
|
||||||
const DRAG_SLOP = 6
|
const DRAG_SLOP = 6
|
||||||
|
|
@ -48,7 +50,7 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
|
||||||
const rail = railRef.current
|
const rail = railRef.current
|
||||||
const card = rail?.querySelector('li')
|
const card = rail?.querySelector('li')
|
||||||
if (!rail || !card) return
|
if (!rail || !card) return
|
||||||
rail.scrollBy({ left: direction * (card.clientWidth + 24), behavior: 'smooth' })
|
rail.scrollBy({ left: direction * (card.clientWidth + 24), behavior: scrollBehavior() })
|
||||||
}
|
}
|
||||||
|
|
||||||
const onPointerDown = (e: ReactPointerEvent<HTMLOListElement>) => {
|
const onPointerDown = (e: ReactPointerEvent<HTMLOListElement>) => {
|
||||||
|
|
@ -77,10 +79,10 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
|
||||||
<section id={id} className="overflow-hidden py-24" style={{ background: '#f4faf7' }}>
|
<section id={id} className="overflow-hidden py-24" style={{ background: '#f4faf7' }}>
|
||||||
<div className="mx-auto flex max-w-6xl flex-wrap items-end gap-6 px-6">
|
<div className="mx-auto flex max-w-6xl flex-wrap items-end gap-6 px-6">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="font-display text-4xl font-extrabold text-[#073d4a] md:text-5xl">
|
<h2 className="font-display text-4xl font-extrabold text-ink md:text-5xl">
|
||||||
{title}
|
{title}
|
||||||
</h2>
|
</h2>
|
||||||
{blurb && <p className="mt-3 max-w-xl text-lg text-[#4a6b72]">{blurb}</p>}
|
{blurb && <p className="mt-3 max-w-xl text-lg text-muted">{blurb}</p>}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{featured.length > 1 && (
|
{featured.length > 1 && (
|
||||||
|
|
@ -94,8 +96,8 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => step(direction as number)}
|
onClick={() => step(direction as number)}
|
||||||
aria-label={label as string}
|
aria-label={label as string}
|
||||||
className="flex h-12 w-12 items-center justify-center rounded-full border text-2xl transition-colors hover:bg-white"
|
className="flex h-12 w-12 items-center justify-center rounded-full border text-2xl transition-colors hover:bg-surface"
|
||||||
style={{ borderColor: TEAL, color: TEAL }}
|
style={{ borderColor: TEAL, color: accentText(TEAL) }}
|
||||||
>
|
>
|
||||||
{glyph}
|
{glyph}
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -105,7 +107,7 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{error ? (
|
{error ? (
|
||||||
<p className="mx-auto mt-10 max-w-6xl px-6 text-[#b3261e]">
|
<p className="mx-auto mt-10 max-w-6xl px-6 text-danger">
|
||||||
Couldn’t load the timeline. {error}{' '}
|
Couldn’t load the timeline. {error}{' '}
|
||||||
<button type="button" onClick={reload} className="underline">
|
<button type="button" onClick={reload} className="underline">
|
||||||
Try again
|
Try again
|
||||||
|
|
@ -114,7 +116,7 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
|
||||||
) : loading ? (
|
) : loading ? (
|
||||||
<div className="mx-auto mt-12 flex max-w-6xl gap-6 px-6" aria-hidden="true">
|
<div className="mx-auto mt-12 flex max-w-6xl gap-6 px-6" aria-hidden="true">
|
||||||
{[0, 1, 2].map((i) => (
|
{[0, 1, 2].map((i) => (
|
||||||
<div key={i} className="h-72 w-80 shrink-0 animate-pulse rounded-3xl bg-white" />
|
<div key={i} className="h-72 w-80 shrink-0 animate-pulse rounded-3xl bg-surface" />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
|
@ -154,7 +156,7 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
|
||||||
to="/history"
|
to="/history"
|
||||||
draggable={false}
|
draggable={false}
|
||||||
className="flex flex-1 flex-col justify-center rounded-3xl p-8 text-white transition-transform duration-300 hover:-translate-y-1"
|
className="flex flex-1 flex-col justify-center rounded-3xl p-8 text-white transition-transform duration-300 hover:-translate-y-1"
|
||||||
style={{ background: `linear-gradient(150deg, ${TEAL}, #073d4a)` }}
|
style={{ background: TEAL }}
|
||||||
>
|
>
|
||||||
<span className="font-display text-2xl font-extrabold">The whole story</span>
|
<span className="font-display text-2xl font-extrabold">The whole story</span>
|
||||||
<span className="mt-2 text-white/75">Every year, every milestone.</span>
|
<span className="mt-2 text-white/75">Every year, every milestone.</span>
|
||||||
|
|
@ -195,18 +197,18 @@ function RailCard({ item, showYear }: { item: TimelineItem; showYear: boolean })
|
||||||
className="mb-5 h-14 w-14 object-contain"
|
className="mb-5 h-14 w-14 object-contain"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<p className="text-xs font-bold uppercase tracking-[0.2em]" style={{ color: TEAL }}>
|
<p className="text-xs font-bold uppercase tracking-[0.2em]" style={{ color: accentText(TEAL) }}>
|
||||||
{dateLabel(item)}
|
{dateLabel(item)}
|
||||||
</p>
|
</p>
|
||||||
<p className="mt-2 font-display text-xl font-bold leading-snug text-[#073d4a]">
|
<p className="mt-2 font-display text-xl font-bold leading-snug text-ink">
|
||||||
{item.title}
|
{item.title}
|
||||||
</p>
|
</p>
|
||||||
{item.meta && <p className="mt-1 text-sm text-[#4a6b72]">{item.meta}</p>}
|
{item.meta && <p className="mt-1 text-sm text-muted">{item.meta}</p>}
|
||||||
{item.blurb && (
|
{item.blurb && (
|
||||||
<p className="mt-3 line-clamp-4 text-sm leading-relaxed text-[#4a6b72]">{item.blurb}</p>
|
<p className="mt-3 line-clamp-4 text-sm leading-relaxed text-muted">{item.blurb}</p>
|
||||||
)}
|
)}
|
||||||
{href && (
|
{href && (
|
||||||
<span className="mt-auto pt-5 text-sm font-semibold" style={{ color: TEAL }}>
|
<span className="mt-auto pt-5 text-sm font-semibold" style={{ color: accentText(TEAL) }}>
|
||||||
Read more →
|
Read more →
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
@ -214,15 +216,15 @@ function RailCard({ item, showYear }: { item: TimelineItem; showYear: boolean })
|
||||||
)
|
)
|
||||||
|
|
||||||
const card =
|
const card =
|
||||||
'flex flex-1 flex-col rounded-3xl border border-[#138ba0]/15 bg-white p-7 shadow-sm'
|
'flex flex-1 flex-col rounded-3xl border border-brand/15 bg-surface p-7 shadow-sm'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full flex-col">
|
<div className="flex h-full flex-col">
|
||||||
{/* The line, its dot, and the year where it changes. */}
|
{/* The line, its dot, and the year where it changes. */}
|
||||||
<div className="relative mb-4 h-8">
|
<div className="relative mb-4 h-8">
|
||||||
<div className="absolute inset-x-[-1.5rem] top-1/2 h-px bg-[#138ba0]/30" />
|
<div className="absolute inset-x-[-1.5rem] top-1/2 h-px bg-brand/30" />
|
||||||
<span
|
<span
|
||||||
className="absolute left-0 top-1/2 h-3 w-3 -translate-y-1/2 rounded-full border-2 bg-white"
|
className="absolute left-0 top-1/2 h-3 w-3 -translate-y-1/2 rounded-full border-2 bg-surface"
|
||||||
style={{ borderColor: TEAL }}
|
style={{ borderColor: TEAL }}
|
||||||
/>
|
/>
|
||||||
{showYear && (
|
{showYear && (
|
||||||
|
|
|
||||||
|
|
@ -40,18 +40,20 @@ import { useEffect, useState, type CSSProperties } from 'react'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
import HomeLink from './HomeLink.tsx'
|
import HomeLink from './HomeLink.tsx'
|
||||||
|
import VideoPlayer from '../../../components/VideoPlayer.tsx'
|
||||||
import DoveMark from '../../../components/DoveMark.tsx'
|
import DoveMark from '../../../components/DoveMark.tsx'
|
||||||
import PlatformIcon from '../../../components/PlatformIcon.tsx'
|
import PlatformIcon from '../../../components/PlatformIcon.tsx'
|
||||||
import { livestreamEmbedUrl, videoSource, type VideoSource } from '../../../lib/embeds.ts'
|
import { livestreamEmbedUrl, videoSource, type VideoSource } from '../../../lib/embeds.ts'
|
||||||
import { eventBackground, heroPhoto } from '../../../lib/media.ts'
|
import { mediaUrl } from '../../../lib/media.ts'
|
||||||
import { eventHref } from '../../../lib/hrefs.ts'
|
import { eventHref } from '../../../lib/hrefs.ts'
|
||||||
import { seriesLabel } from '../../../lib/eventSeries.ts'
|
import { seriesLabel } from '../../../lib/eventSeries.ts'
|
||||||
import type { Hero, HeroBackdrop, HeroEvent, HeroFeature, HeroSlide } from '../../../lib/useFrontPage.ts'
|
import type { Hero, HeroBackdrop, HeroEvent, HeroFeature, HeroSlide } from '../../../lib/useFrontPage.ts'
|
||||||
|
import { withAlpha } from '../../../lib/color.ts'
|
||||||
|
|
||||||
const DEEP = '#04262e'
|
const DEEP = '#04262e'
|
||||||
|
|
||||||
export default function HeroStage({ hero }: { hero: Hero | null }) {
|
export default function HeroStage({ hero }: { hero: Hero | null }) {
|
||||||
const slides = (hero?.slides ?? []).filter((slide) => heroPhoto(slide.media))
|
const slides = (hero?.slides ?? []).filter((slide) => mediaUrl(slide.media))
|
||||||
const embed = livestreamEmbedUrl(hero?.livestream?.url)
|
const embed = livestreamEmbedUrl(hero?.livestream?.url)
|
||||||
const video = videoSource(hero?.video?.url)
|
const video = videoSource(hero?.video?.url)
|
||||||
|
|
||||||
|
|
@ -186,7 +188,7 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
|
||||||
<HomeLink
|
<HomeLink
|
||||||
url={hero.primary.url}
|
url={hero.primary.url}
|
||||||
className="rounded-full px-8 py-4 text-lg font-bold text-[#04262e] shadow-xl transition-transform duration-300 hover:-translate-y-0.5 hover:scale-[1.03]"
|
className="rounded-full px-8 py-4 text-lg font-bold text-[#04262e] shadow-xl transition-transform duration-300 hover:-translate-y-0.5 hover:scale-[1.03]"
|
||||||
style={{ background: 'linear-gradient(120deg, #9fe7d0, #5ce7ff)' }}
|
style={{ background: '#9fe7d0' }}
|
||||||
>
|
>
|
||||||
{hero.primary.label}
|
{hero.primary.label}
|
||||||
</HomeLink>
|
</HomeLink>
|
||||||
|
|
@ -288,7 +290,7 @@ function PhotoBackdrop({ slides, seconds }: { slides: HeroSlide[]; seconds: numb
|
||||||
className={`hp-slide ${i === index ? 'hp-slide--on' : ''}`}
|
className={`hp-slide ${i === index ? 'hp-slide--on' : ''}`}
|
||||||
aria-hidden={i !== index}
|
aria-hidden={i !== index}
|
||||||
>
|
>
|
||||||
<img src={heroPhoto(slide.media) ?? ''} alt={slide.alt ?? ''} loading={i === 0 ? 'eager' : 'lazy'} />
|
<img src={mediaUrl(slide.media) ?? ''} alt={slide.alt ?? ''} loading={i === 0 ? 'eager' : 'lazy'} />
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<div
|
<div
|
||||||
|
|
@ -352,14 +354,17 @@ function PhotoBackdrop({ slides, seconds }: { slides: HeroSlide[]; seconds: numb
|
||||||
|
|
||||||
/* ── Livestream ──────────────────────────────────────────────── */
|
/* ── Livestream ──────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
/* The player loads when pressed, not with the page, so YouTube or
|
||||||
|
Facebook set nothing until someone asks to watch (Privacy page). */
|
||||||
function LiveFrame({ src, url, title }: { src: string | null; url: string; title?: string | null }) {
|
function LiveFrame({ src, url, title }: { src: string | null; url: string; title?: string | null }) {
|
||||||
|
const [watching, setWatching] = useState(false)
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="relative overflow-hidden rounded-3xl border border-white/15 bg-black shadow-2xl"
|
className="relative overflow-hidden rounded-3xl border border-white/15 bg-black shadow-2xl"
|
||||||
style={{ boxShadow: '0 30px 80px -20px rgba(16, 212, 138, 0.35)' }}
|
style={{ boxShadow: '0 30px 80px -20px rgba(16, 212, 138, 0.35)' }}
|
||||||
>
|
>
|
||||||
<div className="aspect-video w-full">
|
<div className="aspect-video w-full">
|
||||||
{src ? (
|
{src && watching ? (
|
||||||
<iframe
|
<iframe
|
||||||
src={src}
|
src={src}
|
||||||
title={title || 'Livestream'}
|
title={title || 'Livestream'}
|
||||||
|
|
@ -367,6 +372,17 @@ function LiveFrame({ src, url, title }: { src: string | null; url: string; title
|
||||||
allow="autoplay; encrypted-media; picture-in-picture; fullscreen"
|
allow="autoplay; encrypted-media; picture-in-picture; fullscreen"
|
||||||
allowFullScreen
|
allowFullScreen
|
||||||
/>
|
/>
|
||||||
|
) : src ? (
|
||||||
|
<div className="flex h-full w-full flex-col items-center justify-center gap-4 text-white">
|
||||||
|
<span className="hp-live-dot h-4 w-4 rounded-full bg-[#ff4d4d]" aria-hidden="true" />
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setWatching(true)}
|
||||||
|
className="rounded-full bg-white px-6 py-3 font-semibold text-[#04262e] hover:scale-105"
|
||||||
|
>
|
||||||
|
Watch live
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex h-full w-full flex-col items-center justify-center gap-4 text-white">
|
<div className="flex h-full w-full flex-col items-center justify-center gap-4 text-white">
|
||||||
<span className="hp-live-dot h-4 w-4 rounded-full bg-[#ff4d4d]" aria-hidden="true" />
|
<span className="hp-live-dot h-4 w-4 rounded-full bg-[#ff4d4d]" aria-hidden="true" />
|
||||||
|
|
@ -387,8 +403,9 @@ function LiveFrame({ src, url, title }: { src: string | null; url: string; title
|
||||||
|
|
||||||
/* A file plays in <video> with the browser's controls; preload
|
/* A file plays in <video> with the browser's controls; preload
|
||||||
"metadata" fetches enough for the first frame and the length,
|
"metadata" fetches enough for the first frame and the length,
|
||||||
not the whole file. An embed waits for play. A link that is
|
not the whole file. An embed is a VideoPlayer: a still until
|
||||||
neither still gets a button out to it. */
|
pressed, so the video's host sets nothing before then. A link
|
||||||
|
that is neither still gets a button out to it. */
|
||||||
function VideoFrame({
|
function VideoFrame({
|
||||||
source,
|
source,
|
||||||
url,
|
url,
|
||||||
|
|
@ -414,13 +431,7 @@ function VideoFrame({
|
||||||
preload="metadata"
|
preload="metadata"
|
||||||
/>
|
/>
|
||||||
) : source?.kind === 'embed' ? (
|
) : source?.kind === 'embed' ? (
|
||||||
<iframe
|
<VideoPlayer url={url} title={title || 'Featured video'} className="h-full" />
|
||||||
src={source.src}
|
|
||||||
title={title || 'Featured video'}
|
|
||||||
className="h-full w-full"
|
|
||||||
allow="encrypted-media; picture-in-picture; fullscreen"
|
|
||||||
allowFullScreen
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<div className="flex h-full w-full items-center justify-center">
|
<div className="flex h-full w-full items-center justify-center">
|
||||||
<HomeLink
|
<HomeLink
|
||||||
|
|
@ -444,14 +455,14 @@ function VideoFrame({
|
||||||
it's usually Register. */
|
it's usually Register. */
|
||||||
function EventPanel({ event }: { event: HeroEvent }) {
|
function EventPanel({ event }: { event: HeroEvent }) {
|
||||||
const color = event.color || '#0f7183'
|
const color = event.color || '#0f7183'
|
||||||
const photo = eventBackground(event.card_image)
|
const photo = mediaUrl(event.card_image)
|
||||||
const when = seriesLabel(event.series, event.starts_on) ?? event.date_label
|
const when = seriesLabel(event.series, event.starts_on) ?? event.date_label
|
||||||
const where = event.is_online && !event.location_label ? 'Online' : event.location_label
|
const where = event.is_online && !event.location_label ? 'Online' : event.location_label
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="overflow-hidden rounded-3xl border border-white/15 bg-white/10 text-white shadow-2xl backdrop-blur"
|
className="overflow-hidden rounded-3xl border border-white/15 bg-white/10 text-white shadow-2xl backdrop-blur"
|
||||||
style={{ boxShadow: `0 30px 80px -20px ${color}66` }}
|
style={{ boxShadow: `0 30px 80px -20px ${withAlpha(color, 40)}` }}
|
||||||
>
|
>
|
||||||
{photo ? (
|
{photo ? (
|
||||||
<img src={photo} alt="" className="aspect-[16/7] w-full object-cover" />
|
<img src={photo} alt="" className="aspect-[16/7] w-full object-cover" />
|
||||||
|
|
@ -459,7 +470,7 @@ function EventPanel({ event }: { event: HeroEvent }) {
|
||||||
<div
|
<div
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
className="aspect-[16/7] w-full"
|
className="aspect-[16/7] w-full"
|
||||||
style={{ background: `linear-gradient(135deg, ${color}, #04262e)` }}
|
style={{ background: `color-mix(in srgb, ${color} 35%, #04262e)` }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
@ -486,7 +497,7 @@ function EventPanel({ event }: { event: HeroEvent }) {
|
||||||
className={`inline-flex items-center gap-2 rounded-full px-6 py-3 font-semibold transition-transform hover:scale-105 ${
|
className={`inline-flex items-center gap-2 rounded-full px-6 py-3 font-semibold transition-transform hover:scale-105 ${
|
||||||
index === 0 ? 'text-[#04262e]' : 'border border-white/35 text-white hover:bg-white/10'
|
index === 0 ? 'text-[#04262e]' : 'border border-white/35 text-white hover:bg-white/10'
|
||||||
}`}
|
}`}
|
||||||
style={index === 0 ? { background: 'linear-gradient(120deg, #9fe7d0, #5ce7ff)' } : undefined}
|
style={index === 0 ? { background: '#9fe7d0' } : undefined}
|
||||||
>
|
>
|
||||||
<PlatformIcon platform={link.platform} />
|
<PlatformIcon platform={link.platform} />
|
||||||
{link.label}
|
{link.label}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import { Link } from 'react-router-dom'
|
||||||
import { eventHref } from '../../../lib/hrefs.ts'
|
import { eventHref } from '../../../lib/hrefs.ts'
|
||||||
import { upcomingOccurrences } from '../../../lib/eventSeries.ts'
|
import { upcomingOccurrences } from '../../../lib/eventSeries.ts'
|
||||||
import type { CountdownEvent } from '../../../lib/useFrontPage.ts'
|
import type { CountdownEvent } from '../../../lib/useFrontPage.ts'
|
||||||
|
import { withAlpha, accentText } from '../../../lib/color.ts'
|
||||||
|
|
||||||
const TEAL = '#0f7183'
|
const TEAL = '#0f7183'
|
||||||
|
|
||||||
|
|
@ -86,16 +87,16 @@ export default function NextEventCountdown({
|
||||||
<Link
|
<Link
|
||||||
to={eventHref(event.id)}
|
to={eventHref(event.id)}
|
||||||
className="group mx-auto flex max-w-6xl flex-col gap-6 rounded-3xl border bg-white/95 p-6 shadow-2xl backdrop-blur transition-transform duration-300 hover:-translate-y-1 md:flex-row md:items-center md:p-8"
|
className="group mx-auto flex max-w-6xl flex-col gap-6 rounded-3xl border bg-white/95 p-6 shadow-2xl backdrop-blur transition-transform duration-300 hover:-translate-y-1 md:flex-row md:items-center md:p-8"
|
||||||
style={{ borderColor: `${accent}55` }}
|
style={{ borderColor: `${withAlpha(accent, 33)}` }}
|
||||||
>
|
>
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<p className="text-xs font-bold uppercase tracking-[0.25em]" style={{ color: accent }}>
|
<p className="text-xs font-bold uppercase tracking-[0.25em]" style={{ color: accentText(accent) }}>
|
||||||
{live ? 'Happening now' : 'Next up'}
|
{live ? 'Happening now' : 'Next up'}
|
||||||
</p>
|
</p>
|
||||||
<p className="mt-1 truncate font-display text-2xl font-extrabold text-[#073d4a] md:text-3xl">
|
<p className="mt-1 truncate font-display text-2xl font-extrabold text-ink md:text-3xl">
|
||||||
{event.title}
|
{event.title}
|
||||||
</p>
|
</p>
|
||||||
<p className="mt-1 text-sm text-[#4a6b72]">
|
<p className="mt-1 text-sm text-muted">
|
||||||
{[event.theme && `“${event.theme}”`, event.date_label, where]
|
{[event.theme && `“${event.theme}”`, event.date_label, where]
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.join(' · ')}
|
.join(' · ')}
|
||||||
|
|
@ -108,7 +109,7 @@ export default function NextEventCountdown({
|
||||||
<div
|
<div
|
||||||
key={label}
|
key={label}
|
||||||
className="flex w-16 flex-col items-center rounded-2xl py-3 text-white md:w-20"
|
className="flex w-16 flex-col items-center rounded-2xl py-3 text-white md:w-20"
|
||||||
style={{ background: `linear-gradient(160deg, ${accent}, #073d4a)` }}
|
style={{ background: `color-mix(in srgb, ${accent} 35%, #04262e)` }}
|
||||||
>
|
>
|
||||||
<span className="font-display text-2xl font-bold tabular-nums md:text-3xl">
|
<span className="font-display text-2xl font-bold tabular-nums md:text-3xl">
|
||||||
{String(value).padStart(2, '0')}
|
{String(value).padStart(2, '0')}
|
||||||
|
|
@ -123,7 +124,7 @@ export default function NextEventCountdown({
|
||||||
|
|
||||||
<span
|
<span
|
||||||
className="self-start text-sm font-semibold transition-transform group-hover:translate-x-1 md:self-center"
|
className="self-start text-sm font-semibold transition-transform group-hover:translate-x-1 md:self-center"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
>
|
>
|
||||||
Details →
|
Details →
|
||||||
</span>
|
</span>
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import { useId, useRef, useState, type KeyboardEvent } from 'react'
|
||||||
|
|
||||||
import HomeLink, { isExternal } from './HomeLink.tsx'
|
import HomeLink, { isExternal } from './HomeLink.tsx'
|
||||||
import type { FrontPagePath } from '../../../lib/useFrontPage.ts'
|
import type { FrontPagePath } from '../../../lib/useFrontPage.ts'
|
||||||
|
import { withAlpha, accentText } from '../../../lib/color.ts'
|
||||||
|
|
||||||
type PathfinderProps = {
|
type PathfinderProps = {
|
||||||
id: string
|
id: string
|
||||||
|
|
@ -62,17 +63,17 @@ export default function Pathfinder({ id, title, blurb, paths }: PathfinderProps)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id={id} className="py-24" style={{ background: '#ffffff' }}>
|
<section id={id} className="py-24" style={{ background: 'var(--color-surface)' }}>
|
||||||
<div className="mx-auto max-w-6xl px-6">
|
<div className="mx-auto max-w-6xl px-6">
|
||||||
<div className="grid gap-12 lg:grid-cols-12">
|
<div className="grid gap-12 lg:grid-cols-12">
|
||||||
<div className="lg:col-span-5">
|
<div className="lg:col-span-5">
|
||||||
<p className="text-xs font-bold uppercase tracking-[0.3em] text-[#0f7183]">
|
<p className="text-xs font-bold uppercase tracking-[0.3em] text-link">
|
||||||
I’m looking to…
|
I’m looking to…
|
||||||
</p>
|
</p>
|
||||||
<h2 className="mt-3 font-display text-4xl font-extrabold text-[#073d4a] md:text-5xl">
|
<h2 className="mt-3 font-display text-4xl font-extrabold text-ink md:text-5xl">
|
||||||
{title}
|
{title}
|
||||||
</h2>
|
</h2>
|
||||||
{blurb && <p className="mt-4 text-lg text-[#4a6b72]">{blurb}</p>}
|
{blurb && <p className="mt-4 text-lg text-muted">{blurb}</p>}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
role="tablist"
|
role="tablist"
|
||||||
|
|
@ -100,18 +101,18 @@ export default function Pathfinder({ id, title, blurb, paths }: PathfinderProps)
|
||||||
className="group flex items-center gap-4 rounded-2xl border-2 px-5 py-4 text-left transition-all duration-300"
|
className="group flex items-center gap-4 rounded-2xl border-2 px-5 py-4 text-left transition-all duration-300"
|
||||||
style={{
|
style={{
|
||||||
borderColor: on ? color : 'rgba(19,139,160,0.12)',
|
borderColor: on ? color : 'rgba(19,139,160,0.12)',
|
||||||
background: on ? `${color}12` : '#ffffff',
|
background: on ? `${withAlpha(color, 7)}` : 'var(--color-surface)',
|
||||||
transform: on ? 'translateX(8px)' : undefined,
|
transform: on ? 'translateX(8px)' : undefined,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="flex h-12 w-12 shrink-0 items-center justify-center rounded-xl text-2xl transition-transform duration-300 group-hover:scale-110"
|
className="flex h-12 w-12 shrink-0 items-center justify-center rounded-xl text-2xl transition-transform duration-300 group-hover:scale-110"
|
||||||
style={{ background: on ? color : `${color}1f` }}
|
style={{ background: on ? color : `${withAlpha(color, 12)}` }}
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
>
|
>
|
||||||
{option.icon || '•'}
|
{option.icon || '•'}
|
||||||
</span>
|
</span>
|
||||||
<span className="font-display text-xl font-bold" style={{ color: on ? color : '#073d4a' }}>
|
<span className="font-display text-xl font-bold" style={{ color: on ? accentText(color) : 'var(--color-ink)' }}>
|
||||||
{option.label}
|
{option.label}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
|
|
@ -133,7 +134,7 @@ export default function Pathfinder({ id, title, blurb, paths }: PathfinderProps)
|
||||||
role="tabpanel"
|
role="tabpanel"
|
||||||
aria-labelledby={`${base}-tab-${selected}`}
|
aria-labelledby={`${base}-tab-${selected}`}
|
||||||
className="relative overflow-hidden rounded-[2rem] p-8 md:p-10 lg:col-span-7"
|
className="relative overflow-hidden rounded-[2rem] p-8 md:p-10 lg:col-span-7"
|
||||||
style={{ background: `linear-gradient(155deg, ${accent}14, ${accent}05 60%, #ffffff)` }}
|
style={{ background: withAlpha(accent, 5) }}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="pointer-events-none absolute -right-6 -top-10 select-none text-[10rem] leading-none opacity-10"
|
className="pointer-events-none absolute -right-6 -top-10 select-none text-[10rem] leading-none opacity-10"
|
||||||
|
|
@ -143,7 +144,7 @@ export default function Pathfinder({ id, title, blurb, paths }: PathfinderProps)
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{path.blurb && (
|
{path.blurb && (
|
||||||
<p className="hp-pop relative max-w-md font-display text-2xl font-semibold leading-snug text-[#073d4a]">
|
<p className="hp-pop relative max-w-md font-display text-2xl font-semibold leading-snug text-ink">
|
||||||
{path.blurb}
|
{path.blurb}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
@ -157,20 +158,20 @@ export default function Pathfinder({ id, title, blurb, paths }: PathfinderProps)
|
||||||
>
|
>
|
||||||
<HomeLink
|
<HomeLink
|
||||||
url={action.url}
|
url={action.url}
|
||||||
className="group flex h-full flex-col rounded-2xl bg-white p-6 shadow-sm ring-1 ring-black/5 transition-all duration-300 hover:-translate-y-1 hover:shadow-xl"
|
className="group flex h-full flex-col rounded-2xl bg-surface p-6 shadow-sm ring-1 ring-black/5 transition-all duration-300 hover:-translate-y-1 hover:shadow-xl"
|
||||||
>
|
>
|
||||||
<span className="flex items-start gap-2 font-display text-lg font-bold text-[#073d4a]">
|
<span className="flex items-start gap-2 font-display text-lg font-bold text-ink">
|
||||||
{action.label}
|
{action.label}
|
||||||
<span
|
<span
|
||||||
className="ml-auto transition-transform group-hover:translate-x-1"
|
className="ml-auto transition-transform group-hover:translate-x-1"
|
||||||
style={{ color: accent }}
|
style={{ color: accentText(accent) }}
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
>
|
>
|
||||||
{isExternal(action.url) ? '↗' : '→'}
|
{isExternal(action.url) ? '↗' : '→'}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
{action.description && (
|
{action.description && (
|
||||||
<span className="mt-2 text-sm leading-relaxed text-[#4a6b72]">
|
<span className="mt-2 text-sm leading-relaxed text-muted">
|
||||||
{action.description}
|
{action.description}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
import EventListCards from '../EventList-Cards.tsx'
|
import EventListCards from '../EventList-Cards.tsx'
|
||||||
|
import { accentText } from '../../../lib/color.ts'
|
||||||
|
|
||||||
const TEAL = '#0f7183'
|
const TEAL = '#0f7183'
|
||||||
|
|
||||||
|
|
@ -17,18 +18,18 @@ type RetreatsBandProps = { id: string; title: string; blurb?: string | null }
|
||||||
|
|
||||||
export default function RetreatsBand({ id, title, blurb }: RetreatsBandProps) {
|
export default function RetreatsBand({ id, title, blurb }: RetreatsBandProps) {
|
||||||
return (
|
return (
|
||||||
<section id={id} className="overflow-hidden py-24" style={{ background: '#eef9fb' }}>
|
<section id={id} className="overflow-hidden py-24" style={{ background: 'var(--color-tint)' }}>
|
||||||
<div className="mx-auto mb-12 flex max-w-6xl flex-wrap items-end gap-6 px-6">
|
<div className="mx-auto mb-12 flex max-w-6xl flex-wrap items-end gap-6 px-6">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="font-display text-4xl font-extrabold text-[#073d4a] md:text-5xl">
|
<h2 className="font-display text-4xl font-extrabold text-ink md:text-5xl">
|
||||||
{title}
|
{title}
|
||||||
</h2>
|
</h2>
|
||||||
{blurb && <p className="mt-3 max-w-xl text-lg text-[#4a6b72]">{blurb}</p>}
|
{blurb && <p className="mt-3 max-w-xl text-lg text-muted">{blurb}</p>}
|
||||||
</div>
|
</div>
|
||||||
<Link
|
<Link
|
||||||
to="/retreats"
|
to="/retreats"
|
||||||
className="ml-auto rounded-full border px-5 py-2 text-sm font-semibold transition-colors hover:bg-white"
|
className="ml-auto rounded-full border px-5 py-2 text-sm font-semibold transition-colors hover:bg-surface"
|
||||||
style={{ borderColor: TEAL, color: TEAL }}
|
style={{ borderColor: TEAL, color: accentText(TEAL) }}
|
||||||
>
|
>
|
||||||
All retreats →
|
All retreats →
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
|
||||||
id={id}
|
id={id}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className="relative overflow-hidden py-24"
|
className="relative overflow-hidden py-24"
|
||||||
style={{ background: 'linear-gradient(160deg, #073d4a 0%, #04262e 70%)' }}
|
style={{ background: '#073d4a' }}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="pointer-events-none absolute -left-40 -top-40 h-[32rem] w-[32rem] rounded-full opacity-25 blur-3xl"
|
className="pointer-events-none absolute -left-40 -top-40 h-[32rem] w-[32rem] rounded-full opacity-25 blur-3xl"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue