From a5c4e365cdf847f9c73129fcfa6afb6d7e9613df Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Thu, 1 Oct 2026 03:49:41 -0500 Subject: [PATCH 001/115] Side nav circle shows above the first divider, sits further left, and slides left rather than being cut at the content The nav column clipped on every side, cutting the circle off above the first section line; it clips sideways only now. The circle keeps its right edge inside the column, so a narrower window moves it off the screen's left edge instead of cutting it at the content. Co-Authored-By: Claude Opus 5.5 --- src/components/PageShell.tsx | 47 +++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/src/components/PageShell.tsx b/src/components/PageShell.tsx index cf5f4b2..8951eaf 100644 --- a/src/components/PageShell.tsx +++ b/src/components/PageShell.tsx @@ -111,21 +111,32 @@ const circleSize = (box: { width: number; height: number }) => const STICK = "calc(var(--header-h, 5rem) + 1rem)"; const LIST_TOP = 32; const LIST_LEFT = 16; +/* How far left of the list's center the circle sits. */ +const CIRCLE_SHIFT = 24; export default function PageShell({ title, intro, sections, sideNav = false }: PageShellProps) { // The list's measured box, so its circle can center on it from a // layer of its own (below). + // The column's width too: the circle keeps its right edge inside + // it, sliding off the screen's left edge instead when the window + // narrows. const listRef = useRef(null); + const columnRef = useRef(null); const [listBox, setListBox] = useState<{ width: number; height: number } | null>(null); + const [columnWidth, setColumnWidth] = useState(0); useEffect(() => { - const el = listRef.current; - if (!el) return; - const ro = new ResizeObserver(([entry]) => - setListBox({ width: entry.borderBoxSize[0].inlineSize, height: entry.borderBoxSize[0].blockSize }), - ); - ro.observe(el); + const list = listRef.current; + const column = columnRef.current; + if (!list || !column) return; + const ro = new ResizeObserver(() => { + setListBox({ width: list.offsetWidth, height: list.offsetHeight }); + setColumnWidth(column.offsetWidth); + }); + ro.observe(list); + ro.observe(column); return () => ro.disconnect(); }, [sideNav]); + const circle = listBox && circleSize(listBox); // The tab's title as the visitor moves around. The first load's // comes from the server (pageMeta.js), which also sets the page's @@ -160,12 +171,14 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P {sideNav ? (
{/* The margin left of the content (72rem, its text 1.5rem in), - clipping anything wider so the circle never reaches the - content. clip, not hidden: hidden would make it a scroll - container, and the sticky layers in it would stop - sticking. */} + clipping sideways only (the circle shows above and below + the list, past the column's top), so nothing reaches the + content or the screen's edge. clip, not hidden: hidden + would make it a scroll container, and the sticky layers in + it would stop sticking. */} diff --git a/src/components/admin/SectionNav.tsx b/src/components/admin/SectionNav.tsx index 9e9c165..05e2ae1 100644 --- a/src/components/admin/SectionNav.tsx +++ b/src/components/admin/SectionNav.tsx @@ -28,7 +28,7 @@ export type EditorSection = { const ACTIVE_LINE = 140; -function useActiveSection(sections: EditorSection[]) { +export function useActiveSection(sections: EditorSection[]) { const [active, setActive] = useState(sections[0]?.id ?? null); const ids = sections.map((section) => section.id).join("|"); From 7f45006253df6e0ab7c52668471ec106f63fb950 Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Thu, 1 Oct 2026 04:03:32 -0500 Subject: [PATCH 004/115] Side nav entries take their section's color; the circle stays on the "On this page" heading Hovered and lit entries use their section's accent (as heading text), the editors' nav keeping the link teal. The circle's leftward shift stops at the heading's center, so short titles no longer pull it off the heading. Co-Authored-By: Claude Opus 5.5 --- src/components/PageShell.tsx | 21 ++++++++++++++++----- src/components/admin/SectionNav.tsx | 17 +++++++++++++---- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/components/PageShell.tsx b/src/components/PageShell.tsx index dc43ba6..4935ccb 100644 --- a/src/components/PageShell.tsx +++ b/src/components/PageShell.tsx @@ -121,7 +121,9 @@ const CIRCLE_GAP = 8 + 4; green and amber their own, teal and deep teal (and any other) teal. */ const circleFamily = (accent?: string) => accent === ACCENTS.green ? "green" : accent === ACCENTS.amber ? "amber" : "teal"; -/* How far left of the list's center the circle sits. */ +/* How far left of the list's center the circle sits, at most: never + left of the "On this page" heading's own center, so a list of short + titles keeps it on the heading. */ const CIRCLE_SHIFT = 24; export default function PageShell({ title, intro, sections, sideNav = false }: PageShellProps) { @@ -132,14 +134,20 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P // narrows. const listRef = useRef(null); const columnRef = useRef(null); - const [listBox, setListBox] = useState<{ width: number; height: number } | null>(null); + const [listBox, setListBox] = useState<{ width: number; height: number; heading: number } | null>(null); const [columnWidth, setColumnWidth] = useState(0); useEffect(() => { const list = listRef.current; const column = columnRef.current; if (!list || !column) return; const ro = new ResizeObserver(() => { - setListBox({ width: list.offsetWidth, height: list.offsetHeight }); + const heading = list.querySelector("[data-nav-heading]"); + setListBox({ + width: list.offsetWidth, + height: list.offsetHeight, + // The heading's center, from the list's left. + heading: heading ? heading.offsetLeft + heading.offsetWidth / 2 : 0, + }); setColumnWidth(column.offsetWidth); }); ro.observe(list); @@ -147,7 +155,7 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P return () => ro.disconnect(); }, [sideNav]); const circle = listBox && circleSize(listBox); - const navSections = sideNav ? sections.map((s) => ({ id: s.id, label: s.title })) : []; + const navSections = sideNav ? sections.map((s) => ({ id: s.id, label: s.title, accent: s.accent })) : []; const active = useActiveSection(navSections); const activeAccent = sections.find((s) => s.id === active)?.accent; const listTop = listBox && circle ? Math.max(LIST_TOP, CIRCLE_GAP + circle / 2 - listBox.height / 2) : LIST_TOP; @@ -208,7 +216,10 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P style={{ width: circle, height: circle, - left: Math.min(LIST_LEFT + listBox.width / 2 - CIRCLE_SHIFT - circle / 2, columnWidth - circle), + left: Math.min( + LIST_LEFT + Math.max(listBox.width / 2 - CIRCLE_SHIFT, listBox.heading) - circle / 2, + columnWidth - circle, + ), top: listTop + listBox.height / 2 - circle / 2, }} /> diff --git a/src/components/admin/SectionNav.tsx b/src/components/admin/SectionNav.tsx index 05e2ae1..190e990 100644 --- a/src/components/admin/SectionNav.tsx +++ b/src/components/admin/SectionNav.tsx @@ -18,10 +18,14 @@ import { useEffect, useState } from "react"; import { scrollBehavior } from "../../lib/motion.ts"; +import { accentText } from "../../lib/color.ts"; export type EditorSection = { id: string; label: string; + /** The public pages' section color: its entry takes it when hovered + or lit. Without one (the editors), the link teal. */ + accent?: string; count?: number; hasError?: boolean; }; @@ -91,7 +95,7 @@ export function SectionNav({ sections, wrap = false }: { sections: EditorSection return (