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
|
|
@ -12,11 +12,11 @@ import { Link } from "react-router-dom";
|
|||
|
||||
import { get } from "../lib/api.ts";
|
||||
import { isBadId, personHref } from "../lib/hrefs.ts";
|
||||
import { personPhoto } from "../lib/media.ts";
|
||||
import { initials, personPhoto } from "../lib/media.ts";
|
||||
import "./PeopleTiles.css";
|
||||
|
||||
/**
|
||||
* PeopleTiles — a horizontal, polaroid-style people list.
|
||||
* PeopleTiles, a horizontal, polaroid-style people list.
|
||||
*
|
||||
* Supply data any of four ways:
|
||||
*
|
||||
|
|
@ -33,7 +33,7 @@ import "./PeopleTiles.css";
|
|||
* is_owner flag.
|
||||
*
|
||||
* With `peopleslug`, the person is fetched by id and any other key
|
||||
* on the entry overrides what came back — so a title can be given
|
||||
* on the entry overrides what came back, so a title can be given
|
||||
* per placement, and is blank when it isn't. A slug entry can sit
|
||||
* beside a fully-written person in the same array.
|
||||
*
|
||||
|
|
@ -42,7 +42,7 @@ import "./PeopleTiles.css";
|
|||
* md photo + name + title
|
||||
* lg photo + name + title, and a chevron on anyone who has
|
||||
* something to expand: pronouns, home organization, location,
|
||||
* public email or a bio. Not bio alone — the details panel is
|
||||
* public email or a bio. Not bio alone, the details panel is
|
||||
* worth opening before anyone has written prose.
|
||||
*
|
||||
* Field names follow the API (is_owner, location_label), so a row
|
||||
|
|
@ -51,8 +51,8 @@ import "./PeopleTiles.css";
|
|||
* Profiles
|
||||
* A person with a string id is taken to be a people row and links
|
||||
* to /people/:id. A tile with nothing to expand is that link; an
|
||||
* expandable one stays the button that opens its panel — a link
|
||||
* can't sit inside a button — and the panel carries the link
|
||||
* expandable one stays the button that opens its panel, a link
|
||||
* can't sit inside a button, and the panel carries the link
|
||||
* instead. A hand-written entry with no id links nowhere.
|
||||
*/
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ const SIZE_FEATURES: Record<PeopleTilesSize, { title: boolean; details: boolean
|
|||
|
||||
/* ── Data ──────────────────────────────────────────────────────
|
||||
Fetching lives here rather than in every section, but the view
|
||||
below stays pure — it only ever sees resolved groups, whatever
|
||||
below stays pure, it only ever sees resolved groups, whatever
|
||||
produced them.
|
||||
───────────────────────────────────────────────────────────── */
|
||||
|
||||
|
|
@ -290,7 +290,7 @@ function collectSlugs(
|
|||
}
|
||||
|
||||
/* The fetched record is the base; anything else on the entry wins,
|
||||
including an explicit null — that's how a title is deliberately
|
||||
including an explicit null, that's how a title is deliberately
|
||||
left blank rather than inherited. */
|
||||
function resolveAll(
|
||||
list: PersonInput[],
|
||||
|
|
@ -741,7 +741,7 @@ function findByKey(groups: PeopleGroup[], key: string | null) {
|
|||
}
|
||||
|
||||
/* The seat they hold here, or what they're called when there is no
|
||||
seat — the same fallback content.js applies to leadership rows. */
|
||||
seat, the same fallback content.js applies to leadership rows. */
|
||||
function titleOf(person: Person): string | null {
|
||||
return person.title || person.tagline || null;
|
||||
}
|
||||
|
|
@ -762,15 +762,6 @@ function hasDetails(person: Person): boolean {
|
|||
}
|
||||
|
||||
|
||||
function initials(name = ""): string {
|
||||
return name
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.slice(0, 2)
|
||||
.map((word) => word[0] || "")
|
||||
.join("")
|
||||
.toUpperCase();
|
||||
}
|
||||
|
||||
function resolveOrg(org: Person["org"]) {
|
||||
if (!org) return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue