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

@ -1,6 +1,7 @@
import { useId, useState } from "react";
import ArrowLink from "../../components/ArrowLink.tsx";
import { orgLogo } from "../../lib/media.ts";
import { mediaUrl } from "../../lib/media.ts";
import Logo from "../../components/Logo.tsx";
import PlatformIcon from "../../components/PlatformIcon.tsx";
import {
areasSentence,
@ -62,38 +63,18 @@ function RowButton({ as: As = "button", color, children, ...rest }: any) {
}
function OrgMark({ org, color }) {
const [failed, setFailed] = useState(false);
if (org.logo && !failed) {
return (
<img
src={orgLogo(org.logo) ?? undefined}
alt=""
onError={() => setFailed(true)}
className="h-8 w-8 object-contain shrink-0"
/>
);
}
if (org.color) {
return (
<span
className="h-3 w-3 rounded-full shrink-0"
style={{ background: color }}
aria-hidden="true"
/>
);
}
return (
const fallback = org.color ? (
<span className="h-3 w-3 rounded-full shrink-0" style={{ background: color }} aria-hidden="true" />
) : (
<span
className="h-8 w-8 rounded-lg shrink-0 flex items-center justify-center text-xs font-extrabold"
style={{ border: `1px solid ${color}`, color }}
style={{ border: `1px solid ${color}`, color: accentText(color) }}
aria-hidden="true"
>
{initialsFor(org.name)}
</span>
);
return <Logo src={mediaUrl(org.logo)} className="h-8 w-8 object-contain shrink-0" fallback={fallback} />;
}
function OrgRow({ org, pageLabel, siteLabel }) {