Tidy the structure the audit found
- The colour defaults have one source, server/src/themeDefaults.js, read by the server and the admin; the build stops if src/index.css disagrees with it - server/src/admin-schema.js split into admin-schema/, one file per entity plus columns.js (the registry checked identical) - loadOwned() in shape.js replaces the same three loads on four detail routes (every public route checked identical); one NO_STORE - One OrgLogo component for the org lists and the chapter map; an organization's own page now shows the same initials as the lists - One localISO() for the viewer's calendar day, in place of three - Boot refuses a descriptor dropdown value the table's CHECK doesn't allow, instead of it failing on save - Deleted the unused Other.tsx and white-background logo; chapters.ts is useCommunity.ts; isSuper() in the Panel; stale comments and docs corrected Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
048c7599ce
commit
f934b1dd93
44 changed files with 1187 additions and 1170 deletions
|
|
@ -30,7 +30,8 @@ import {
|
|||
type OrganizationRecord,
|
||||
} from '../lib/useContent.ts'
|
||||
import { orgHref, orgListHref, teamHref } from '../lib/hrefs.ts'
|
||||
import { initials, mediaUrl } from '../lib/media.ts'
|
||||
import { mediaUrl } from '../lib/media.ts'
|
||||
import { initialsFor } from '../lib/organizations.ts'
|
||||
import Logo from '../components/Logo.tsx'
|
||||
import { withAlpha, accentText, readableOn, BRAND } from '../lib/color.ts'
|
||||
|
||||
|
|
@ -370,7 +371,7 @@ function ChapterMark({ file, name, accent }: { file?: string | null; name: strin
|
|||
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)}
|
||||
{initialsFor(name)}
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
export default function Other() {
|
||||
return (
|
||||
<>
|
||||
<section id="sectiona" className="scroll-mt-28 px-6 py-20">
|
||||
<h1 className="text-4xl font-bold">Section A</h1>
|
||||
</section>
|
||||
|
||||
<section id="sectionb" className="scroll-mt-28 px-6 py-20">
|
||||
<h2 className="text-4xl font-bold">Section B</h2>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ import { useCallback, useEffect, useState } from "react";
|
|||
import { del, get, patch } from "../../lib/api.ts";
|
||||
import { isUnauthorized, useAuth } from "../../lib/auth.tsx";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { ROLES, ROLE_LABELS, ROLE_NOTES } from "../../lib/roles.ts";
|
||||
import { ROLES, ROLE_LABELS, ROLE_NOTES, isSuper } from "../../lib/roles.ts";
|
||||
|
||||
/* SQLite hands back "2026-09-22 04:11:07": UTC, but without the
|
||||
marker that says so. Left alone, browsers read it as local time
|
||||
|
|
@ -166,7 +166,7 @@ export default function AdminPanel() {
|
|||
|
||||
const { system, content, users } = data;
|
||||
const activeSupers = users.filter(
|
||||
(u) => u.role === "superadmin" && u.is_active === 1,
|
||||
(u) => isSuper(u) && u.is_active === 1,
|
||||
).length;
|
||||
|
||||
return (
|
||||
|
|
@ -225,7 +225,7 @@ export default function AdminPanel() {
|
|||
{users.map((row) => {
|
||||
const isMe = row.id === me?.id;
|
||||
const lastSuper =
|
||||
row.role === "superadmin" && row.is_active === 1 && activeSupers <= 1;
|
||||
isSuper(row) && row.is_active === 1 && activeSupers <= 1;
|
||||
const locked = isMe || lastSuper;
|
||||
const busy = busyId === row.id;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ import { firstOccurrenceFrom, occurrencesBetween, seriesTimes } from '../../lib/
|
|||
import { eventHref } from '../../lib/hrefs.ts'
|
||||
import type { EventListItem } from '../../lib/useContent.ts'
|
||||
import { withAlpha, accentText, readableOn, BRAND } from '../../lib/color.ts'
|
||||
import { localISO } from '../../lib/timeline.ts'
|
||||
|
||||
export type CalendarControl = 'scope' | 'type' | 'online' | 'search'
|
||||
export type CalendarView = 'month' | 'list'
|
||||
|
|
@ -94,8 +95,7 @@ type Segment = Occurrence & {
|
|||
|
||||
/* ── Dates ───────────────────────────────────────────────────── */
|
||||
|
||||
const pad = (n: number) => String(n).padStart(2, '0')
|
||||
const iso = (d: Date) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`
|
||||
const iso = (d: Date) => localISO(d)
|
||||
|
||||
function parse(date: string): Date {
|
||||
const [y, m, d] = date.split('-').map(Number)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
import { ArrowUpRight } from '@phosphor-icons/react';
|
||||
import ArrowLink from "../../components/ArrowLink.tsx";
|
||||
import { mediaUrl } from "../../lib/media.ts";
|
||||
import Logo from "../../components/Logo.tsx";
|
||||
import OrgLogo from "../../components/OrgLogo.tsx";
|
||||
import {
|
||||
initialsFor,
|
||||
orgPath,
|
||||
useOrganizations,
|
||||
byName,
|
||||
|
|
@ -35,24 +33,6 @@ const FALLBACK_COLOR = "#4a6b72";
|
|||
const CARD_MIN = "20rem";
|
||||
const GRID_MAX = "88rem";
|
||||
|
||||
function OrgMark({ org, color }) {
|
||||
return (
|
||||
<Logo
|
||||
src={mediaUrl(org.logo)}
|
||||
className="h-14 w-14 object-contain rounded-xl shrink-0"
|
||||
fallback={
|
||||
<span
|
||||
className="h-14 w-14 rounded-xl shrink-0 flex items-center justify-center font-extrabold"
|
||||
style={{ border: `1px solid ${color}`, color: accentText(color) }}
|
||||
aria-hidden="true"
|
||||
>
|
||||
{initialsFor(org.name)}
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function OrgCard({ org, accent, pageLabel, siteLabel }) {
|
||||
const color = org.color || accent;
|
||||
const path = orgPath(org);
|
||||
|
|
@ -68,7 +48,7 @@ function OrgCard({ org, accent, pageLabel, siteLabel }) {
|
|||
style={{ border: `1px solid ${color}`, background: "var(--color-surface)" }}
|
||||
>
|
||||
<div className="flex items-start gap-4">
|
||||
<OrgMark org={org} color={color} />
|
||||
<OrgLogo org={org} color={color} />
|
||||
|
||||
<div className="min-w-0 flex-1">
|
||||
<h3 className="text-xl font-extrabold leading-tight" style={{ color }}>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
import { CaretRight, X } from '@phosphor-icons/react';
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useCommunity } from "../../lib/chapters.ts";
|
||||
import { useCommunity } from "../../lib/useCommunity.ts";
|
||||
import { Link } from "react-router-dom";
|
||||
import ArrowLink from "../../components/ArrowLink.tsx";
|
||||
import { mediaUrl } from "../../lib/media.ts";
|
||||
import Logo from "../../components/Logo.tsx";
|
||||
import { initialsFor, orgPath } from "../../lib/organizations.ts";
|
||||
import OrgLogo from "../../components/OrgLogo.tsx";
|
||||
import { 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";
|
||||
|
|
@ -468,26 +467,6 @@ function RegionBlock({
|
|||
color. Selecting another card swaps the panel's contents.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
/* Logo, or the organization's initials when there's no file or it
|
||||
fails to load. Decorative: the name is right beside it. */
|
||||
function OrgLogo({ org, color, size = "h-14 w-14" }) {
|
||||
return (
|
||||
<Logo
|
||||
src={mediaUrl(org.logo)}
|
||||
className={`${size} object-contain rounded-xl shrink-0`}
|
||||
fallback={
|
||||
<div
|
||||
className={`${size} rounded-xl shrink-0 flex items-center justify-center font-extrabold`}
|
||||
style={{ border: `1px solid ${color}`, color: accentText(color) }}
|
||||
aria-hidden="true"
|
||||
>
|
||||
{initialsFor(org.name)}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function ChapterCard({ chapter, color, open, onOpen }) {
|
||||
return (
|
||||
<div
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue