Finish the audit leftovers

- One mediaUrl in media.ts instead of 12 identical aliases and a
  kind map; orgPath builds on hrefs.ts's orgHref
- One Logo component (hides itself or shows a fallback when the file
  is missing) for event cards, org lists and chapter marks
- useHistory is a thin wrapper over useRecord
- adminSchema.ts split into adminSchema/, one file per entity plus
  shared.ts; the registry is unchanged (checked by loading both)
- JS smooth scrolls respect reduced motion (lib/motion.ts)
- Content-Security-Policy in Report-Only, with /api/csp-report logging
  what it would block

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-28 22:49:07 -05:00
parent c74ad746f5
commit e4a9c96f7e
42 changed files with 1968 additions and 2043 deletions

View file

@ -2,10 +2,11 @@ import { useEffect, useRef, useState } from "react";
import { useCommunity } from "../../lib/chapters.ts";
import { Link } from "react-router-dom";
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 { AREAS, AREA_NAMES } from "../../data/mapGrid.ts";
import { withAlpha, accentText, readableOn } from '../../lib/color.ts'
import { scrollBehavior } from "../../lib/motion.ts";
/* ═══════════════════════════════════════════════════════════════
ORGANIZATION LIST: MAP
@ -472,7 +473,7 @@ function OrgLogo({ org, color, size = "h-14 w-14" }) {
if (org.logo && !failed) {
return (
<img
src={orgLogo(org.logo) ?? undefined}
src={mediaUrl(org.logo) ?? undefined}
alt={org.name}
onError={() => setFailed(true)}
className={`${size} object-contain rounded-xl shrink-0`}
@ -798,7 +799,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
// that it's stacked under the map and scrolling it would fight
// the page.
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