Feature fixes: admin nav, hero event, schedule block, SEO, site settings, Google sign-in, QR tool #12

Merged
ngu-git-admin merged 14 commits from feature-fixes into main 2026-09-28 08:12:29 +01:00
12 changed files with 21 additions and 113 deletions
Showing only changes of commit a67ca98394 - Show all commits

View file

@ -57,7 +57,7 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu
- `navConfig.ts` is the single source of truth for navigation, routes, and actions (header, footer, pages). - `navConfig.ts` is the single source of truth for navigation, routes, and actions (header, footer, pages).
- `api.ts` is the shared caching client used by frontend data hooks. - `api.ts` is the shared caching client used by frontend data hooks.
- `docs/updating-data-in-code.md`: where content that isn't in the database lives (admin dropdown labels, fixed value lists, nav, banner, decades, map grid) and how to change it. Keep it current when adding a dropdown or code-owned content. - `docs/updating-data-in-code.md`: where content that isn't in the database lives (admin dropdown labels, fixed value lists, nav, banner, decades, map grid) and how to change it. Keep it current when adding a dropdown or code-owned content.
- Logos: org logos in `public/org-logos/` (served at `/org-logos/`), event logos in `public/event-logos/`. The `<Logo>` component hides itself on load error. - Logos: org logos in `public/org-logos/` (served at `/org-logos/`); event logos are uploads (`/uploads/`, a bare filename resolves there). The site's own NGU logos are bundled from `src/assets/logos/`. Image paths resolve through `src/lib/media.ts`. The `<Logo>` component hides itself on load error.
## Rules and gotchas ## Rules and gotchas
- **Role checks must use ladder comparisons, never equality.** Roles rank viewer → editor → admin → superadmin. Use the minimum-rank helpers from `src/lib/roles.ts` (`canWrite`, `canDelete`, `isSuper`, `atLeast`). Where a local variable shadows the name, import with an alias, e.g. `canWrite as roleCanWrite`. `role === "admin"` silently excludes higher roles and has caused repeated bugs. - **Role checks must use ladder comparisons, never equality.** Roles rank viewer → editor → admin → superadmin. Use the minimum-rank helpers from `src/lib/roles.ts` (`canWrite`, `canDelete`, `isSuper`, `atLeast`). Where a local variable shadows the name, import with an alias, e.g. `canWrite as roleCanWrite`. `role === "admin"` silently excludes higher roles and has caused repeated bugs.

View file

@ -48,7 +48,7 @@ const DESCRIPTION_CHARS = 160;
/* Where a bare filename lives, per kind. Mirrors src/lib/media.ts. */ /* Where a bare filename lives, per kind. Mirrors src/lib/media.ts. */
const DIRS = { const DIRS = {
person: "/people", person: "/people",
eventLogo: "/event-logos", eventLogo: "/uploads",
eventBackground: "/event-backgrounds", eventBackground: "/event-backgrounds",
organization: "/org-logos", organization: "/org-logos",
team: "/team-logos", team: "/team-logos",

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 221 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 221 KiB

View file

@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="403.64276mm"
height="86.755943mm"
viewBox="0 0 403.64273 86.755943"
version="1.1"
id="svg5"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs2" />
<g
id="layer10"
style="display:inline"
transform="translate(-344.28592,167.60401)">
<g
id="g3">
<circle
style="display:inline;fill:#008da9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.634488;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path205602-8-3-1"
cx="403.82111"
cy="-121.75806"
r="40.889923" />
<path
id="path1887-1-3-7-7-6-2"
style="color:#000000;display:inline;fill:#008da9;fill-opacity:1;stroke:none;stroke-width:2.284;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 443.45159,-167.57122 c -8.63995,3.71591 -17.05927,7.97953 -25.85742,11.27148 -3.76442,1.391 -7.68514,2.52606 -11.12305,4.64648 -3.58916,2.42042 -5.95825,6.25942 -7.35135,10.29228 -1.23335,3.0863 -2.32136,6.17712 -3.84982,9.11983 -3.67393,-2.17848 -7.69746,-4.08371 -12.04108,-4.24843 -4.09333,-0.39358 -8.26381,0.55262 -11.85512,2.53592 -6.41916,3.13465 -11.92468,7.82515 -18.56868,10.51862 -2.73797,1.21486 -5.51687,2.3331 -8.27926,3.49077 -0.88252,2.47734 0.77854,5.31191 3.20508,6.10351 4.27199,1.7128 8.98018,1.56772 13.49433,1.35771 4.71612,-0.31488 9.32779,-1.47771 13.7933,-2.98449 4.28568,-1.20657 8.61172,-2.23873 13.00143,-3.03728 -2.64145,2.85774 -6.27041,4.39222 -9.272,6.78523 -0.9862,0.76271 -1.85771,1.89939 -1.64657,3.21845 0.1709,1.85512 1.7211,3.08775 2.9593,4.29677 2.6421,2.35246 5.95831,4.07918 9.49722,4.487017 1.35103,0.106385 2.71085,-0.642417 3.25697,-1.900747 1.43582,-2.68121 2.25426,-5.67671 4.35603,-7.93655 1.20099,-1.4152 3.08751,-1.77888 4.83141,-2.01081 3.79664,-0.62592 7.50391,-2.47133 9.93534,-5.50938 1.37471,-1.65305 2.10201,-3.71602 2.52235,-5.79656 0.1379,-0.6722 1.04486,-0.68506 1.58622,-0.85974 1.78218,-0.35339 3.91283,-0.77776 4.83392,-2.54366 0.89776,-1.84635 -0.0715,-4.04503 -1.61189,-5.21854 -2.41639,-1.86664 -5.65021,-3.01579 -8.63111,-2.61499 2.2258,-1.54005 4.74178,-2.58917 7.19752,-3.70372 6.31792,-2.71081 13.11161,-4.94567 18.40937,-9.54069 3.73885,-3.20962 6.79577,-7.24801 8.78271,-11.76096 0.80138,-2.0522 1.44232,-4.33553 0.95805,-6.5376 -0.3398,-1.04637 -1.34059,-2.15906 -2.5332,-1.91992 z" />
<path
id="path92116-3-2-7-1-4"
style="display:inline;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.222835;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 401.4397,-85.357733 -5.07733,3.7999 c 1.40469,0.28813 3.37038,0.49431 4.1477,0.56482 0,0 13.4726,-8.14749 21.27399,-14.00284 7.80139,-5.855347 13.28514,-13.045137 15.64699,-18.030857 4.23462,-8.93904 5.76755,-17.18121 4.93866,-21.94278 -2.3532,12.13055 -6.84548,20.1394 -8.91525,22.66728 -2.77658,3.39114 -7.3818,10.79482 -14.1263,15.035397 -8.02485,5.04559 -16.87157,10.25674 -17.88846,11.90908 z" />
<path
fill="#519259"
d="m 401.25566,-85.224563 c 2.11431,-7.90893 7.29014,-19.728807 13.53049,-25.077287 3.15174,-2.74769 6.75532,-5.34691 11.45401,-7.64618 4.36158,-2.05194 6.70709,-3.73973 9.19688,-6.81027 3.40267,-3.94053 5.90574,-7.35199 6.96383,-10.47421 0.22347,8.84634 -6.48806,19.37766 -9.02864,23.54668 -6.2265,9.41606 -10.0147,12.608287 -17.50625,17.196147 -4.38236,2.60687 -9.65678,5.68615 -14.61032,9.26512 z"
fill-opacity="1"
fill-rule="nonzero"
id="path184-6-7-6-9-3-2"
style="display:inline;fill:#358a0d;fill-opacity:1;stroke:none;stroke-width:0.625031;stroke-opacity:1" />
<path
style="color:#000000;display:inline;fill:#ffffff;stroke:none;stroke-width:2.284;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 358.52422,-123.11955 c 3.13369,-1.59928 7.04147,-4.49077 10.29591,-6.33595 3.25443,-1.84519 6.30899,-3.58417 9.61426,-4.20523 2.65302,-0.4889 6.37319,-0.18817 9.07211,0.58357 2.69896,0.77175 5.57299,2.70484 7.16593,3.40762 1.59295,0.70275 2.24655,0.19006 2.82855,-0.77494 0.582,-0.96504 2.81839,-6.05064 3.84362,-8.9293 1.02519,-2.87864 2.26409,-5.72337 4.14553,-7.76121 1.88144,-2.03782 2.31893,-2.07776 4.06202,-3.15865 1.74307,-1.08086 10.24244,-3.71628 14.53403,-5.61581 4.29158,-1.89953 8.11957,-3.58996 12.24067,-5.48028 4.12109,-1.89033 6.08861,-2.79441 7.30709,-3.29554 0.273,0.73801 -0.2034,3.06663 -1.16031,5.22317 -0.95691,2.15654 -2.9569,5.04357 -4.86279,7.26365 -1.90589,2.22009 -4.28775,4.10342 -6.82223,5.66812 -2.53448,1.56467 -4.53981,2.45823 -7.60439,3.71266 -3.06457,1.25446 -11.88915,4.7102 -14.64698,7.12005 -2.75786,2.40984 -4.18313,6.63212 -3.64772,7.60115 0.5354,0.96902 2.51391,-1.48598 3.81084,-2.34867 1.29694,-0.8627 1.95172,-1.05814 3.14897,-1.09198 1.17765,-0.0172 2.77532,0.40067 3.29849,0.63293 1.48441,0.659 3.97438,2.00122 3.54176,3.36038 -0.16368,0.51434 -0.19462,0.56904 -3.05611,1.25841 -2.86151,0.68935 -3.48508,1.29579 -3.81533,3.74861 -0.22097,1.47094 -1.44719,3.88743 -3.13317,5.28015 -1.68596,1.39274 -4.55099,2.93627 -8.41717,3.35482 -3.86617,0.41855 -6.17544,3.97192 -6.93256,5.37259 -0.75713,1.40064 -2.66104,5.90506 -2.99685,6.15238 -0.3358,0.24732 -2.76998,-0.36582 -3.79458,-0.82517 -1.02463,-0.45935 -2.612,-1.39111 -3.63624,-2.16132 -1.02425,-0.7702 -3.457,-2.975 -3.0018,-3.64018 0.45519,-0.66516 1.56543,-1.35445 2.73515,-2.12254 1.16972,-0.76811 3.86984,-2.33631 5.3456,-3.59002 1.47576,-1.25372 2.7334,-2.47754 3.4042,-3.48323 0.67079,-1.00567 0.9358,-2.14286 -0.28206,-2.7388 -1.21786,-0.59597 -1.84092,-0.39835 -4.4486,0.0225 -2.60769,0.42097 -4.8218,1.10142 -8.46858,1.9005 -3.64678,0.79905 -7.82786,2.49393 -10.97221,3.07304 -3.14439,0.5791 -4.3363,0.83756 -8.5197,0.95691 -4.1834,0.11935 -7.15938,-0.35864 -8.95468,-0.91763 -1.7953,-0.55899 -2.64147,-1.55556 -2.60415,-2.17667 3.90737,-1.58574 7.9469,-3.2841 11.38348,-5.04009 z"
id="path1887-1-3-7-7-6" />
<path
fill="#519259"
d="m 412.95849,-81.884143 c 4.58067,-1.05723 7.7275,-1.9948 13.67931,-5.91343 5.95181,-3.91863 10.62995,-9.54813 13.02992,-14.097387 2.39997,-4.54926 4.34384,-10.28218 4.83384,-15.81643 0.49,-5.53425 0.14775,-11.25197 -2.10696,-17.66367 0.15927,9.10203 -2.7414,15.06092 -4.17879,18.80503 -1.43739,3.74411 -4.80196,9.50687 -8.2717,13.57264 -3.46184,4.223207 -7.82036,7.647487 -12.67981,10.383567 -5.38026,3.05578 -13.21504,8.4585 -16.7484,11.61577 4.01135,0.4226 9.12694,-0.10316 12.44259,-0.88609 z"
fill-opacity="1"
fill-rule="nonzero"
id="path182-2-6-6-7-2-2"
style="display:inline;fill:#358a0d;fill-opacity:1;stroke:none;stroke-width:0.717458;stroke-opacity:1" />
</g>
<g
id="g40616-9"
transform="translate(13.096206,-216.39844)"
style="display:inline">
<g
id="g2-4">
<text
xml:space="preserve"
style="font-size:34.109px;line-height:1.25;font-family:Impact;-inkscape-font-specification:Impact;letter-spacing:0px;word-spacing:0px;display:inline;stroke-width:0.852729"
x="451.59149"
y="89.758339"
id="text156858-3-8"><tspan
id="tspan156856-8-82"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:34.109px;font-family:Poppins;-inkscape-font-specification:'Poppins, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#008da9;fill-opacity:1;stroke-width:0.852729"
x="451.59149"
y="89.758339">Next Generation</tspan></text>
<text
xml:space="preserve"
style="font-size:33.8136px;line-height:1.25;font-family:Impact;-inkscape-font-specification:Impact;letter-spacing:0px;word-spacing:0px;display:inline;stroke-width:0.845345"
x="469.26224"
y="119.08144"
id="text156858-3-1-4"><tspan
id="tspan156856-8-8-5"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:33.8136px;font-family:Poppins;-inkscape-font-specification:'Poppins, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#008da9;fill-opacity:1;stroke-width:0.845345"
x="469.26224"
y="119.08144">of Unity</tspan></text>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 8.4 KiB

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Before After
Before After

View file

@ -1,6 +1,6 @@
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts"; import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts";
import nguLogo from "../assets/NGU_Logo.svg"; import nguLogo from "../assets/logos/NGU_Logo.svg";
import PlatformIcon from "./PlatformIcon.tsx"; import PlatformIcon from "./PlatformIcon.tsx";
const Social_Links = [ const Social_Links = [

View file

@ -2,7 +2,7 @@ import { useState, useEffect, useRef } from "react";
import { NavLink, Link, Outlet, useLocation } from "react-router-dom"; import { NavLink, Link, Outlet, useLocation } from "react-router-dom";
import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts"; import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts";
import Banner from "./Banner.jsx"; import Banner from "./Banner.jsx";
import nguLogo from "../assets/NGU_Logo.svg"; import nguLogo from "../assets/logos/NGU_Logo.svg";
import Footer from "./Footer.tsx"; import Footer from "./Footer.tsx";
/* ── Right-side nav actions ──────────────────────────────── */ /* ── Right-side nav actions ──────────────────────────────── */

View file

@ -7,7 +7,7 @@
edit rather than a grep. edit rather than a grep.
⚠ Only two of these directories are confirmed by the admin help ⚠ Only two of these directories are confirmed by the admin help
text: people/ and event-logos/. The other three are a guess at text: people/. Event logos are uploads. The other three are a guess at
your convention. Check public/ and fix them here — nothing else your convention. Check public/ and fix them here — nothing else
references the paths. references the paths.
@ -30,7 +30,10 @@ function inDir(dir: string) {
} }
export const personPhoto = inDir('/people') // confirmed export const personPhoto = inDir('/people') // confirmed
export const eventLogo = inDir('/event-logos') // confirmed // Event logos are uploads. A bare filename is one copied into the
// uploads directory by hand (fall-retreat-logo.svg was); anything
// uploaded through the admin is already /uploads/…
export const eventLogo = inDir('/uploads')
export const eventBackground = inDir('/event-backgrounds') export const eventBackground = inDir('/event-backgrounds')
export const orgLogo = inDir('/org-logos') // ⚠ guess export const orgLogo = inDir('/org-logos') // ⚠ guess
export const teamLogo = inDir('/team-logos') // ⚠ guess export const teamLogo = inDir('/team-logos') // ⚠ guess

View file

@ -27,7 +27,7 @@ import { AdminTitleContext } from "../../lib/adminTitle.tsx";
import { AdminWidthContext } from "../../lib/adminWidth.tsx"; 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/NGU_Logo.svg"; import nguLogo from "../../assets/logos/NGU_Logo.svg";
import { import {
ADMIN_HOME, ADMIN_HOME,
AREA_TITLES, AREA_TITLES,

View file

@ -5,7 +5,7 @@ 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, isAbsoluteMedia } from "../../lib/media.ts"; import { eventBackground, eventLogo as eventLogoSrc, orgLogo as orgLogoSrc } from "../../lib/media.ts";
/* ═══════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════
EVENT LIST — CARDS EVENT LIST — CARDS
@ -27,28 +27,17 @@ import { eventBackground, isAbsoluteMedia } from "../../lib/media.ts";
nothing but retreats shows no control at all. nothing but retreats shows no control at all.
═══════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════ */
const LOGO_FILES = import.meta.glob("../../assets/event-logos/*.svg", {
eager: true,
import: "default",
});
const LOGOS = Object.fromEntries(
Object.entries(LOGO_FILES).map(([path, src]) => [path.split("/").pop(), src])
);
/* A bundled logo by filename, or an upload or URL as it is. */
const logoSrc = file =>
(file && LOGOS[file]) || (isAbsoluteMedia(file) ? file : null);
/* Last resort only. The API already falls back to the host /* Last resort only. The API already falls back to the host
organization's logo when an event doesn't name its own, so this organization's logo when an event doesn't name its own, so this
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. */ /* An <img> that removes itself if the file 404s. `src` is already
function Logo({ file, alt = "", className }) { resolved by media.ts: an event logo from the uploads directory, an
organization's from org-logos, anything with a path or URL as is. */
function Logo({ src, alt = "", className }) {
const [failed, setFailed] = useState(false); const [failed, setFailed] = useState(false);
const src = logoSrc(file);
if (!src || failed) return null; if (!src || failed) return null;
return ( return (
<img <img
@ -165,8 +154,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 = ev.org_logo || DEFAULT_ORG_LOGO; const orgLogo = orgLogoSrc(ev.org_logo) || DEFAULT_ORG_LOGO;
const eventLogo = ev.event_logo; const eventLogo = eventLogoSrc(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;
@ -216,7 +205,7 @@ export function Card({
{compact ? ( {compact ? (
/* ── GRID CARD: layout driven by .ev-grid container queries ── */ /* ── GRID CARD: layout driven by .ev-grid container queries ── */
<div className="ev-grid mb-2"> <div className="ev-grid mb-2">
<Logo file={orgLogo} className="ev-ngu h-11 w-auto mb-4" /> <Logo src={orgLogo} className="ev-ngu h-11 w-auto mb-4" />
<div className="ev-info"> <div className="ev-info">
{typeBadge} {typeBadge}
<h3 className="text-3xl font-900 leading-tight"> <h3 className="text-3xl font-900 leading-tight">
@ -234,7 +223,7 @@ export function Card({
)} )}
</div> </div>
<Logo <Logo
file={eventLogo} src={eventLogo}
alt={ev.title} alt={ev.title}
className="ev-image w-full h-auto object-contain" className="ev-image w-full h-auto object-contain"
/> />
@ -245,7 +234,7 @@ export function Card({
<> <>
<div className="grid grid-cols-1 md:grid-cols-3 gap-x-8 mb-4"> <div className="grid grid-cols-1 md:grid-cols-3 gap-x-8 mb-4">
<div className="md:col-span-2"> <div className="md:col-span-2">
<Logo file={orgLogo} className="h-15 w-auto mb-6" /> <Logo src={orgLogo} className="h-15 w-auto mb-6" />
{typeBadge} {typeBadge}
<h3 className="text-4xl font-900"> <h3 className="text-4xl font-900">
<TitleLink ev={ev} linked={linked}> <TitleLink ev={ev} linked={linked}>
@ -263,7 +252,7 @@ export function Card({
</div> </div>
<div className="md:col-span-1 flex items-center justify-end"> <div className="md:col-span-1 flex items-center justify-end">
<Logo <Logo
file={eventLogo} src={eventLogo}
alt={ev.title} alt={ev.title}
className="w-full h-auto max-h-72 object-contain" className="w-full h-auto max-h-72 object-contain"
/> />