From a67ca983948520c4e17dbda1bc0135f54f0a7666 Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Sun, 27 Sep 2026 23:18:32 -0500 Subject: [PATCH] Move the NGU logos to src/assets/logos and load event logos from uploads The site's own logos now live in src/assets/logos. Event logos are no longer bundled: the event cards resolve them through media.ts like every other image, and a bare event-logo filename now means one in the uploads directory (fall-retreat-logo.svg has been moved there by hand). Organization logos on the cards resolve from org-logos. Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 2 +- server/src/pageMeta.js | 2 +- src/assets/Fall Logo.svg | 1 - src/assets/event-logos/fall-retreat-logo.svg | 1 - src/assets/event-logos/ngu-logo-white-bg.svg | 82 -------------------- src/assets/{ => logos}/NGU_Logo.svg | 0 src/assets/{ => logos}/NGU_Logo_WhiteBG.svg | 0 src/components/Footer.tsx | 2 +- src/components/Layout.tsx | 2 +- src/lib/media.ts | 7 +- src/pages/admin/AdminLayout.tsx | 2 +- src/pages/sections/EventList-Cards.tsx | 33 +++----- 12 files changed, 21 insertions(+), 113 deletions(-) delete mode 100644 src/assets/Fall Logo.svg delete mode 100644 src/assets/event-logos/fall-retreat-logo.svg delete mode 100644 src/assets/event-logos/ngu-logo-white-bg.svg rename src/assets/{ => logos}/NGU_Logo.svg (100%) rename src/assets/{ => logos}/NGU_Logo_WhiteBG.svg (100%) diff --git a/CLAUDE.md b/CLAUDE.md index acb20d0..1332872 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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). - `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. -- Logos: org logos in `public/org-logos/` (served at `/org-logos/`), event logos in `public/event-logos/`. The `` 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 `` component hides itself on load error. ## 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. diff --git a/server/src/pageMeta.js b/server/src/pageMeta.js index 69555fb..f47f28d 100644 --- a/server/src/pageMeta.js +++ b/server/src/pageMeta.js @@ -48,7 +48,7 @@ const DESCRIPTION_CHARS = 160; /* Where a bare filename lives, per kind. Mirrors src/lib/media.ts. */ const DIRS = { person: "/people", - eventLogo: "/event-logos", + eventLogo: "/uploads", eventBackground: "/event-backgrounds", organization: "/org-logos", team: "/team-logos", diff --git a/src/assets/Fall Logo.svg b/src/assets/Fall Logo.svg deleted file mode 100644 index 33f133f..0000000 --- a/src/assets/Fall Logo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/assets/event-logos/fall-retreat-logo.svg b/src/assets/event-logos/fall-retreat-logo.svg deleted file mode 100644 index 33f133f..0000000 --- a/src/assets/event-logos/fall-retreat-logo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/assets/event-logos/ngu-logo-white-bg.svg b/src/assets/event-logos/ngu-logo-white-bg.svg deleted file mode 100644 index 3202fa3..0000000 --- a/src/assets/event-logos/ngu-logo-white-bg.svg +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - Next Generation - of Unity - - - - diff --git a/src/assets/NGU_Logo.svg b/src/assets/logos/NGU_Logo.svg similarity index 100% rename from src/assets/NGU_Logo.svg rename to src/assets/logos/NGU_Logo.svg diff --git a/src/assets/NGU_Logo_WhiteBG.svg b/src/assets/logos/NGU_Logo_WhiteBG.svg similarity index 100% rename from src/assets/NGU_Logo_WhiteBG.svg rename to src/assets/logos/NGU_Logo_WhiteBG.svg diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 21974ea..d06455e 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,6 +1,6 @@ import { Link } from "react-router-dom"; 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"; const Social_Links = [ diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 6b999a7..d04bf59 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -2,7 +2,7 @@ import { useState, useEffect, useRef } from "react"; import { NavLink, Link, Outlet, useLocation } from "react-router-dom"; import { PAGE_LINKS, PAGE_SECTIONS, NAV_ACTIONS } from "../navConfig.ts"; 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"; /* ── Right-side nav actions ──────────────────────────────── */ diff --git a/src/lib/media.ts b/src/lib/media.ts index 35b35f0..f7da6a9 100644 --- a/src/lib/media.ts +++ b/src/lib/media.ts @@ -7,7 +7,7 @@ edit rather than a grep. ⚠ 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 references the paths. @@ -30,7 +30,10 @@ function inDir(dir: string) { } 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 orgLogo = inDir('/org-logos') // ⚠ guess export const teamLogo = inDir('/team-logos') // ⚠ guess diff --git a/src/pages/admin/AdminLayout.tsx b/src/pages/admin/AdminLayout.tsx index e68b59b..2a98f84 100644 --- a/src/pages/admin/AdminLayout.tsx +++ b/src/pages/admin/AdminLayout.tsx @@ -27,7 +27,7 @@ import { AdminTitleContext } from "../../lib/adminTitle.tsx"; import { AdminWidthContext } from "../../lib/adminWidth.tsx"; import { SITE_VERSION } from "../../lib/version.ts"; import { ROLE_LABELS, isSuper } from "../../lib/roles.ts"; -import nguLogo from "../../assets/NGU_Logo.svg"; +import nguLogo from "../../assets/logos/NGU_Logo.svg"; import { ADMIN_HOME, AREA_TITLES, diff --git a/src/pages/sections/EventList-Cards.tsx b/src/pages/sections/EventList-Cards.tsx index 238ab43..9fd8fd5 100644 --- a/src/pages/sections/EventList-Cards.tsx +++ b/src/pages/sections/EventList-Cards.tsx @@ -5,7 +5,7 @@ import { eventHref } from "../../lib/hrefs.ts"; import { EVENT_TYPES, eventTypeLabel } from "../../lib/eventTypes.ts"; import { seriesLabel } from "../../lib/eventSeries.ts"; 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 @@ -27,28 +27,17 @@ import { eventBackground, isAbsoluteMedia } from "../../lib/media.ts"; 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 organization's logo when an event doesn't name its own, so this fires only for an event with no host at all. */ const DEFAULT_ORG_LOGO = null; -/* An that removes itself if the file 404s. */ -function Logo({ file, alt = "", className }) { +/* An that removes itself if the file 404s. `src` is already + 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 src = logoSrc(file); if (!src || failed) return null; return ( - +
{typeBadge}

@@ -234,7 +223,7 @@ export function Card({ )}

@@ -245,7 +234,7 @@ export function Card({ <>
- + {typeBadge}

@@ -263,7 +252,7 @@ export function Card({