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 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-27 23:18:32 -05:00
parent 84e4e2acae
commit a67ca98394
12 changed files with 21 additions and 113 deletions

View file

@ -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,

View file

@ -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 <img> that removes itself if the file 404s. */
function Logo({ file, alt = "", className }) {
/* An <img> 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 (
<img
@ -165,8 +154,8 @@ export function Card({
}) {
const past = ev.status === "past";
const color = ev.color || defaultColor;
const orgLogo = ev.org_logo || DEFAULT_ORG_LOGO;
const eventLogo = ev.event_logo;
const orgLogo = orgLogoSrc(ev.org_logo) || DEFAULT_ORG_LOGO;
const eventLogo = eventLogoSrc(ev.event_logo);
const schedule = seriesLabel(ev.series, ev.starts_on);
const links = ev.links ?? [];
const igHandle = ev.instagram || null;
@ -216,7 +205,7 @@ export function Card({
{compact ? (
/* ── GRID CARD: layout driven by .ev-grid container queries ── */
<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">
{typeBadge}
<h3 className="text-3xl font-900 leading-tight">
@ -234,7 +223,7 @@ export function Card({
)}
</div>
<Logo
file={eventLogo}
src={eventLogo}
alt={ev.title}
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="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}
<h3 className="text-4xl font-900">
<TitleLink ev={ev} linked={linked}>
@ -263,7 +252,7 @@ export function Card({
</div>
<div className="md:col-span-1 flex items-center justify-end">
<Logo
file={eventLogo}
src={eventLogo}
alt={ev.title}
className="w-full h-auto max-h-72 object-contain"
/>