Clean up code found in the audit
- Replace every em-dash in src and server/src with a colon, comma or hyphen - Give every relative import its file extension (.jsx imports of .tsx fixed) - Delete old-historyMock.ts, unused exports, unused CSS utilities, the unused @ alias and the fallback option nothing passed - One copy each of initials, capitalize, byName and the server's marks() - Move the organization, chapter and event hooks from src/data to src/lib - Schema sync always throws on a mismatch (strict was never turned off) - Replace the placeholder README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4066e9ec61
commit
5274e09571
75 changed files with 282 additions and 688 deletions
|
|
@ -8,9 +8,9 @@ import {
|
|||
type DecadeMeta,
|
||||
type SortDirection,
|
||||
type TimelineItem,
|
||||
} from '../../../lib/timeline'
|
||||
import TimelineDecade from './TimelineDecade'
|
||||
import TimelineUpcoming from './TimelineUpcoming'
|
||||
} from '../../../lib/timeline.ts'
|
||||
import TimelineDecade from './TimelineDecade.tsx'
|
||||
import TimelineUpcoming from './TimelineUpcoming.tsx'
|
||||
import './timeline.css'
|
||||
|
||||
const PARAM = 'y'
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import {
|
|||
withGapYears,
|
||||
type GroupedDecade,
|
||||
type SortDirection,
|
||||
} from '../../../lib/timeline'
|
||||
import TimelineYear from './TimelineYear'
|
||||
} from '../../../lib/timeline.ts'
|
||||
import TimelineYear from './TimelineYear.tsx'
|
||||
|
||||
type Props = {
|
||||
decade: GroupedDecade
|
||||
|
|
@ -45,7 +45,7 @@ export default function TimelineDecade({
|
|||
{decade.preProgram ? (
|
||||
<p className="ngu-tl__gapNote">
|
||||
<span aria-hidden="true">◌</span>
|
||||
Before the program — kept for context, not part of our record
|
||||
Before the program, kept for context, not part of our record
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Link } from 'react-router-dom'
|
||||
import { MONTH_LABELS, type PersonRef, type TimelineItem } from '../../../lib/timeline'
|
||||
import { hrefFor, logoSrc, photoSrc } from '../../../lib/timelineRefs'
|
||||
import { MONTH_LABELS, type PersonRef, type TimelineItem } from '../../../lib/timeline.ts'
|
||||
import { hrefFor, logoSrc, photoSrc } from '../../../lib/timelineRefs.ts'
|
||||
import { initials } from '../../../lib/media.ts'
|
||||
|
||||
const KIND_NAMES: Record<TimelineItem['kind'], string> = {
|
||||
milestone: 'Milestone',
|
||||
|
|
@ -10,7 +11,7 @@ const KIND_NAMES: Record<TimelineItem['kind'], string> = {
|
|||
people: 'People',
|
||||
}
|
||||
|
||||
/** Day number only — the month node above already carries the month. */
|
||||
/** Day number only, the month node above already carries the month. */
|
||||
function dayMarker(item: TimelineItem): string {
|
||||
if (item.precision !== 'day') return ''
|
||||
const day = Number(item.date.split('-')[2])
|
||||
|
|
@ -26,16 +27,6 @@ function fullMarker(item: TimelineItem): string {
|
|||
return `${month} ${Number(d)}`
|
||||
}
|
||||
|
||||
/** Initials stand in when a person has no photo on file. */
|
||||
function initials(name: string): string {
|
||||
return name
|
||||
.split(/\s+/)
|
||||
.slice(0, 2)
|
||||
.map((part) => part[0] ?? '')
|
||||
.join('')
|
||||
.toUpperCase()
|
||||
}
|
||||
|
||||
function PersonChip({ person }: { person: PersonRef }) {
|
||||
const src = photoSrc(person.photo)
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { useState } from 'react'
|
||||
import type { GroupedYear, SortDirection } from '../../../lib/timeline'
|
||||
import TimelineYear from './TimelineYear'
|
||||
import type { GroupedYear, SortDirection } from '../../../lib/timeline.ts'
|
||||
import TimelineYear from './TimelineYear.tsx'
|
||||
|
||||
type Props = {
|
||||
years: GroupedYear[]
|
||||
|
|
@ -17,7 +17,7 @@ type Props = {
|
|||
* order. That keeps the button anchored next to the decade marker
|
||||
* instead of drifting up the page as items appear.
|
||||
*
|
||||
* Membership is decided by date, not by a flag — see partitionByDate.
|
||||
* Membership is decided by date, not by a flag, see partitionByDate.
|
||||
* An event moves into the record on its own, with nothing to update.
|
||||
*/
|
||||
export default function TimelineUpcoming({
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { CSSProperties } from 'react'
|
||||
import type { GroupedYear } from '../../../lib/timeline'
|
||||
import TimelineEntry from './TimelineEntry'
|
||||
import type { GroupedYear } from '../../../lib/timeline.ts'
|
||||
import TimelineEntry from './TimelineEntry.tsx'
|
||||
|
||||
/** Dot diameter scales with volume, so the rail reads as a density chart. */
|
||||
function dotSize(count: number): string {
|
||||
|
|
@ -42,7 +42,7 @@ export default function TimelineYear({ year, open, onToggle }: Props) {
|
|||
/>
|
||||
<span className="ngu-tl__yearLabel">{year.year}</span>
|
||||
<span className="ngu-tl__yearCount">
|
||||
{empty ? '—' : `${year.count} ${year.count === 1 ? 'entry' : 'entries'}`}
|
||||
{empty ? '-' : `${year.count} ${year.count === 1 ? 'entry' : 'entries'}`}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* History timeline — scoped under .ngu-tl.
|
||||
* History timeline, scoped under .ngu-tl.
|
||||
*
|
||||
* Everything themeable is a custom property with a fallback, so rewiring to the
|
||||
* site tokens is a one-block edit at the top. Typefaces are deliberately not
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* ——— Decade block ——————————————————————————————————————————————— */
|
||||
/* --- Decade block ----------------------------------------------- */
|
||||
|
||||
.ngu-tl__decade {
|
||||
position: relative;
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
color: var(--tl-muted);
|
||||
}
|
||||
|
||||
/* ——— Decade header ——————————————————————————————————————————————— */
|
||||
/* --- Decade header ----------------------------------------------- */
|
||||
|
||||
.ngu-tl__decadeHead {
|
||||
position: relative;
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
color: var(--tl-faint);
|
||||
}
|
||||
|
||||
/* ——— Year node ———————————————————————————————————————————————— */
|
||||
/* --- Year node ------------------------------------------------ */
|
||||
|
||||
.ngu-tl__year {
|
||||
position: relative;
|
||||
|
|
@ -231,7 +231,7 @@
|
|||
font-weight: 450;
|
||||
}
|
||||
|
||||
/* ——— Expanded panel ——————————————————————————————————————————— */
|
||||
/* --- Expanded panel ------------------------------------------- */
|
||||
|
||||
.ngu-tl__panel {
|
||||
padding: 0.25rem 0 1.5rem var(--tl-gutter);
|
||||
|
|
@ -286,7 +286,7 @@
|
|||
gap: 0.125rem;
|
||||
}
|
||||
|
||||
/* ——— Entry ————————————————————————————————————————————————————— */
|
||||
/* --- Entry ----------------------------------------------------- */
|
||||
|
||||
.ngu-tl__entry {
|
||||
display: grid;
|
||||
|
|
@ -371,7 +371,7 @@ a.ngu-tl__entry:hover .ngu-tl__entryTitle {
|
|||
box-shadow: inset 0 0 0 1.5px var(--tl-faint);
|
||||
}
|
||||
|
||||
/* ——— Featured entries ————————————————————————————————————————— */
|
||||
/* --- Featured entries ----------------------------------------- */
|
||||
|
||||
.ngu-tl__featured {
|
||||
display: flex;
|
||||
|
|
@ -403,7 +403,7 @@ a.ngu-tl__entry--featured:hover {
|
|||
background: color-mix(in srgb, var(--tl-accent) 18%, transparent);
|
||||
}
|
||||
|
||||
/* ——— Empty state ——————————————————————————————————————————————— */
|
||||
/* --- Empty state ----------------------------------------------- */
|
||||
|
||||
.ngu-tl__empty {
|
||||
padding: 0.5rem 0 1.25rem var(--tl-gutter);
|
||||
|
|
@ -420,7 +420,7 @@ a.ngu-tl__entry--featured:hover {
|
|||
}
|
||||
}
|
||||
|
||||
/* ——— Toolbar + utilities ————————————————————————————————————— */
|
||||
/* --- Toolbar + utilities ------------------------------------- */
|
||||
|
||||
.ngu-tl__toolbar {
|
||||
display: flex;
|
||||
|
|
@ -468,7 +468,7 @@ a.ngu-tl__entry--featured:hover {
|
|||
border: 0;
|
||||
}
|
||||
|
||||
/* ——— Upcoming block ——————————————————————————————————————————
|
||||
/* --- Upcoming block ------------------------------------------
|
||||
Opens upward: the toggle is first in the DOM, column-reverse puts the
|
||||
list above it. Faded because none of it has happened yet. */
|
||||
|
||||
|
|
@ -556,7 +556,7 @@ a.ngu-tl__entry--featured:hover {
|
|||
}
|
||||
}
|
||||
|
||||
/* ——— Event / org / award logo ————————————————————————————————— */
|
||||
/* --- Event / org / award logo --------------------------------- */
|
||||
|
||||
.ngu-tl__logo {
|
||||
display: inline-block;
|
||||
|
|
@ -574,7 +574,7 @@ a.ngu-tl__entry--featured:hover {
|
|||
vertical-align: -0.3125rem;
|
||||
}
|
||||
|
||||
/* ——— People roster ——————————————————————————————————————————— */
|
||||
/* --- People roster ------------------------------------------- */
|
||||
|
||||
.ngu-tl__entryWrap {
|
||||
display: block;
|
||||
|
|
@ -643,7 +643,7 @@ a.ngu-tl__entry--featured:hover {
|
|||
color: var(--tl-faint);
|
||||
}
|
||||
|
||||
/* ——— Kind markers, continued ————————————————————————————————— */
|
||||
/* --- Kind markers, continued --------------------------------- */
|
||||
|
||||
.ngu-tl__kind--organization {
|
||||
border-radius: 2px;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue