diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md index bd861f7..7e99a0e 100644 --- a/docs/updating-data-in-code.md +++ b/docs/updating-data-in-code.md @@ -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 **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) | -| 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` | The rule of thumb from `CLAUDE.md`: data belongs in the database, @@ -273,7 +273,8 @@ 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. | | 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). | -| 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. | +| 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 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` | | diff --git a/server/src/admin-schema.js b/server/src/admin-schema.js index 18ec7ab..72935f7 100644 --- a/server/src/admin-schema.js +++ b/server/src/admin-schema.js @@ -935,6 +935,7 @@ const siteSettings = { text("favicon"), text("apple_touch_icon"), enumeration("indexing", ["on", "off"]), + text("privacy_email"), ], children: [ diff --git a/server/src/migrations/039_privacy_contact.sql b/server/src/migrations/039_privacy_contact.sql new file mode 100644 index 0000000..4e37428 --- /dev/null +++ b/server/src/migrations/039_privacy_contact.sql @@ -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; diff --git a/server/src/pageMeta.js b/server/src/pageMeta.js index 5eb85ba..d0a21c8 100644 --- a/server/src/pageMeta.js +++ b/server/src/pageMeta.js @@ -102,12 +102,13 @@ export function siteFor(db) { ...base.robots, index: row.indexing ? row.indexing === "on" : base.robots?.index !== false, }, + privacyEmail: row.privacy_email || base.privacyEmail || "", pages, }; } /* 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. */ export function robotsTxt(site) { diff --git a/server/src/routes/feedback.js b/server/src/routes/feedback.js index 25fb7f2..0c377a4 100644 --- a/server/src/routes/feedback.js +++ b/server/src/routes/feedback.js @@ -29,10 +29,10 @@ const LIMITS = { 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, // 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 ──────────────────────────────────────────── */ @@ -76,6 +76,10 @@ feedback.post("/", async (c) => { const errors = {}; if (message.length < MIN_MESSAGE) errors.message = "Please write a little more."; 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) { return c.json({ error: "Validation failed", fields: errors }, 422); diff --git a/site.json b/site.json index 786515f..8d330e0 100644 --- a/site.json +++ b/site.json @@ -2,6 +2,7 @@ "title": "Next Generation of Unity", "url": "https://nextgenerationofunity.org", "description": "", + "privacyEmail": "", "robots": { "index": true }, diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 94767b0..1198c82 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -4,6 +4,7 @@ import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts"; import Banner from "./Banner.tsx"; import nguLogo from "../assets/logos/NGU_Logo.svg"; import Footer from "./Footer.tsx"; +import PrivacyNotice from "./PrivacyNotice.tsx"; /* ── Right-side nav actions ──────────────────────────────── */ @@ -269,6 +270,7 @@ export default function Layout() { {/*Site Footer applied to every page*/}
{/* Mobile menu */} diff --git a/src/components/LegalText.tsx b/src/components/LegalText.tsx new file mode 100644 index 0000000..f87d416 --- /dev/null +++ b/src/components/LegalText.tsx @@ -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 ( +
+ {parts.map((part) => ( +
+

{part.heading}

+
+ {part.body.map((paragraph, i) => ( +

{paragraph}

+ ))} + {part.list && ( +
    + {part.list.map((item, i) => ( +
  • {item}
  • + ))} +
+ )} + {part.after?.map((paragraph, i) => ( +

{paragraph}

+ ))} +
+
+ ))} +
+ ) +} diff --git a/src/components/PrivacyNotice.tsx b/src/components/PrivacyNotice.tsx new file mode 100644 index 0000000..a9f33bf --- /dev/null +++ b/src/components/PrivacyNotice.tsx @@ -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 ( +
+

+ 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.{' '} + + Privacy Policy + +

+ +
+ ) +} diff --git a/src/components/ScheduleBlock.tsx b/src/components/ScheduleBlock.tsx index 7261f2a..283caa1 100644 --- a/src/components/ScheduleBlock.tsx +++ b/src/components/ScheduleBlock.tsx @@ -80,6 +80,8 @@ function Avatar({ person, size }: { person: NonNullable -