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:
parent
c74ad746f5
commit
e4a9c96f7e
42 changed files with 1968 additions and 2043 deletions
|
|
@ -30,8 +30,9 @@ import {
|
|||
type OrganizationRecord,
|
||||
} from '../lib/useContent.ts'
|
||||
import { orgHref, orgListHref, teamHref } from '../lib/hrefs.ts'
|
||||
import { orgLogo, personPhoto } from '../lib/media.ts'
|
||||
import { withAlpha, accentText } from '../lib/color.ts'
|
||||
import { initials, mediaUrl } from '../lib/media.ts'
|
||||
import Logo from '../components/Logo.tsx'
|
||||
import { withAlpha, accentText, readableOn } from '../lib/color.ts'
|
||||
|
||||
const TEAL = '#0f7183'
|
||||
const BODY = 'var(--color-muted)'
|
||||
|
|
@ -147,7 +148,7 @@ export default function OrganizationDetail() {
|
|||
title: leader.title,
|
||||
pronouns: leader.pronouns,
|
||||
public_email: leader.public_email,
|
||||
photo: personPhoto(leader.photo),
|
||||
photo: mediaUrl(leader.photo),
|
||||
is_owner: leader.is_owner,
|
||||
}))}
|
||||
/>
|
||||
|
|
@ -179,7 +180,7 @@ export default function OrganizationDetail() {
|
|||
className="flex items-center gap-4 rounded-lg border p-4 transition-colors hover:bg-tint"
|
||||
style={{ borderColor: `${withAlpha(accent, 25)}` }}
|
||||
>
|
||||
<Logo file={chapter.logo} name={chapter.name} accent={accent} />
|
||||
<ChapterMark file={chapter.logo} name={chapter.name} accent={accent} />
|
||||
<span>
|
||||
<span className="block font-semibold" style={{ color: accentText(accent) }}>
|
||||
{chapter.name}
|
||||
|
|
@ -359,28 +360,22 @@ function Contact({ org, accent }: { org: OrganizationRecord; accent: string }) {
|
|||
)
|
||||
}
|
||||
|
||||
function Logo({
|
||||
file,
|
||||
name,
|
||||
accent,
|
||||
}: {
|
||||
file?: string | null
|
||||
name: string
|
||||
accent: string
|
||||
}) {
|
||||
const src = orgLogo(file)
|
||||
if (!src) {
|
||||
return (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-xs font-bold text-white"
|
||||
style={{ background: accent }}
|
||||
>
|
||||
{name.slice(0, 2).toUpperCase()}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
return <img src={src} alt="" loading="lazy" className="h-10 w-10 shrink-0 object-contain" />
|
||||
function ChapterMark({ file, name, accent }: { file?: string | null; name: string; accent: string }) {
|
||||
return (
|
||||
<Logo
|
||||
src={mediaUrl(file)}
|
||||
className="h-10 w-10 shrink-0 object-contain"
|
||||
fallback={
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-xs font-bold"
|
||||
style={{ background: accent, color: readableOn(accent) }}
|
||||
>
|
||||
{initials(name)}
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
/* ── Leadership → team blocks ────────────────────────────────── */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue