From 26fdea8ffd08837367b02adce131592374a0d1f5 Mon Sep 17 00:00:00 2001 From: Hao Yan Date: Mon, 26 Oct 2026 03:38:54 -0400 Subject: [PATCH 1/5] fix(chrome): spell out the name beside the logo, rebuild the footer, sharpen the tab icon --- src/app/favicon.ico | Bin 2845 -> 3862 bytes src/app/icon.svg | 16 ++++ src/components/Footer.module.css | 134 ++++++++++++++++++++--------- src/components/Footer.tsx | 78 ++++++++++++----- src/components/Mark.module.css | 4 - src/components/Mark.tsx | 9 -- src/components/Nav.module.css | 23 +++-- src/components/Nav.tsx | 8 +- src/components/PageLoad.module.css | 60 +++++++++++++ src/components/PageLoad.tsx | 70 +++++++++++++++ 10 files changed, 320 insertions(+), 82 deletions(-) create mode 100644 src/app/icon.svg create mode 100644 src/components/PageLoad.module.css create mode 100644 src/components/PageLoad.tsx diff --git a/src/app/favicon.ico b/src/app/favicon.ico index 48f9ce9c656940ea7414394d2fa106925d21982e..fbcb055711fbea435100303d086581f21cbdd174 100644 GIT binary patch delta 3781 zcmV;$4m$Cj7M30~000310{{>Z00031AOM2`001@s001B$00031AOPtE006lH001yB z00031AOLg+005!~ku)WL0!m3lK~#9!rISl&6LAp6gH@B(CN`<@frmm5BE~AVTF{Gl zQM9Ni2tpOagT@#|P(dpQ-aL3RSO~cU0+t?X>OoX!rHZI|RqLZDYLjN0N1I1Yy4mbz zH~F0ZMv+!4R1b6b4>Q00=9^iKRGh*8gl3@)C6R|L3n)qa!U3#*Nyufvg+{<kO;s9-{8~ZA@p`$LM9yf9l)AJA&+z_iO%CE zpj~E!w%!Em*>fm=iv?Bszzqj_k6lJK8vO%+q+jW}hL$bu@V$D0ox66UR^JG{aTWUS z_d^kQgrED7OT=l+IVJ)XgvUO^yru~?T7#nUjeLw6*U*ox!Y1cRHOY(yV(s4ys!? zeB>y~iljmpE!D%asSUA-aVVuCDIjN0S#4z03RS_LefyC~Pm)Xtk+Cmm-L{=JVS>x$ zLV?et+UQnnm6+6ucB4WFMzDCoyVoEzT(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9..ffd0c2e 100644 --- a/src/components/Footer.module.css +++ b/src/components/Footer.module.css @@ -1,41 +1,65 @@ +/* Two ruled rows under the diagram. Phones: just the link columns, side + by side. Wide: the mark fills the label column, standing on the rule + below it, the page's load time takes the middle and the link columns + sit at the right, ending where the deadline would be. */ + .footer { - composes: row from "./Grid.module.css"; - display: grid; - grid-template-columns: 1fr; - row-gap: 14px; - padding: 28px var(--pad) 40px; color: var(--ink-muted); font-family: var(--mono); font-size: 12px; line-height: 1.6; } -.brand { - display: flex; - align-items: center; - gap: 10px; - color: var(--ink); - font-family: var(--sans); - font-size: 17px; - font-weight: 650; - letter-spacing: -0.02em; +/* Pages takes the width of its longest title; contact gets the rest, so + the email address fits beside it on a phone */ +.top { + composes: row from "./Grid.module.css"; + display: grid; + grid-template-columns: auto minmax(0, 1fr); + grid-template-areas: "pages contact"; + gap: 32px 40px; + padding: 28px var(--late) 32px 0; +} + +.pages { + grid-area: pages; + padding-left: var(--pad); +} + +.contact { + grid-area: contact; } +/* Wide screens only */ +.timing, .mark { - display: block; - width: 25px; - height: 18px; + display: none; } -.note { - margin: 0; +.timing { + grid-area: timing; } -.links { - display: flex; - flex-wrap: wrap; - gap: 6px 22px; +.mark { + grid-area: mark; justify-self: start; + align-self: end; + height: auto; + margin-left: var(--pad); +} + +.colLabel { + margin: 0 0 12px; + font-size: 11px; + font-weight: 500; + letter-spacing: 0.08em; + text-transform: uppercase; +} + +.list { + display: grid; + justify-items: start; + gap: 6px; margin: 0; padding: 0; list-style: none; @@ -45,34 +69,62 @@ display: inline-flex; align-items: center; gap: 8px; - justify-self: start; - padding: 2px 0; color: var(--ink); - text-decoration: underline; + font-family: var(--sans); + font-size: 15px; + font-weight: 500; + line-height: 1.5; + text-decoration: none; text-decoration-thickness: 1px; - text-underline-offset: 4px; - transition: none; + text-underline-offset: 5px; } -.link:hover, -.link:focus-visible { - background: var(--ink); - color: var(--bg); - text-decoration: none; +.link:hover { + text-decoration-line: underline; } .link:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; } +.base { + composes: row from "./Grid.module.css"; + display: flex; + flex-wrap: wrap; + justify-content: space-between; + gap: 4px 24px; + padding: 16px var(--pad) 28px; +} +.base p { + margin: 0; +} + @media (min-width: 900px) { - .footer { - grid-template-columns: var(--c3) 1fr auto; - align-items: center; - padding: 32px var(--late) 48px 0; + .top { + grid-template-columns: var(--c3) minmax(0, 1fr) auto auto; + grid-template-areas: "mark timing pages contact"; + column-gap: 0; + padding: 36px var(--late) 0 0; + } + .pages, + .contact, + .timing { + align-self: start; + padding: 0 var(--pad) 48px; + } + .timing { + padding-right: 56px; + } + .pages { + padding-right: 56px; + } + .timing, + .mark { + display: block; + } + .mark { + width: calc(var(--c3) - 2 * var(--pad)); } - .brand, - .note, - .links { - margin: 0 var(--pad); + .base { + padding: 18px calc(var(--late) + var(--pad)) 32px var(--pad); } } diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 0d68337..90fa315 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,33 +1,71 @@ +import Link from "next/link"; + import { Arrow } from "./Button"; import styles from "./Footer.module.css"; import { Crosses, VRule } from "./Grid"; -import { Mark, Name } from "./Mark"; -import { CONTACTS } from "./siteData"; +import { Mark } from "./Mark"; +import { PageLoad } from "./PageLoad"; +import { CONTACTS, SECTIONS, href } from "./siteData"; + +// The build's year. The site is rebuilt on every deploy. +const YEAR = new Date().getFullYear(); // Outside the diagram: the deadline stops at the footer's rule, on a -// maroon + mark +// maroon + mark. Below it the mark, large, this page's load time, a +// column of pages and a column of ways to reach the club. Then the fine +// print. export function Footer() { return (
- - -
+
+ + + +
+ + +
+
+

Load time

+ +
-
-

- Student-run. Not an official McMaster University entity. -

- +
+ +

© {YEAR} McMaster Low Latency Labs

+

Student-run. Not an official McMaster University entity.

+
); } diff --git a/src/components/Mark.module.css b/src/components/Mark.module.css index 1408f63..b64e6f3 100644 --- a/src/components/Mark.module.css +++ b/src/components/Mark.module.css @@ -5,7 +5,3 @@ .accent { fill: var(--accent); } - -.three { - color: var(--accent); -} diff --git a/src/components/Mark.tsx b/src/components/Mark.tsx index 4a7bbf2..49f029d 100644 --- a/src/components/Mark.tsx +++ b/src/components/Mark.tsx @@ -25,12 +25,3 @@ export function Mark({ className }: { className: string }) { ); } - -// "ML³" in text, with the ³ in the mark's maroon -export function Name() { - return ( - - ML³ - - ); -} diff --git a/src/components/Nav.module.css b/src/components/Nav.module.css index f5bffcc..bbee27a 100644 --- a/src/components/Nav.module.css +++ b/src/components/Nav.module.css @@ -20,13 +20,10 @@ justify-self: start; display: inline-flex; align-items: center; - gap: 10px; + gap: 12px; height: 56px; padding: 0 var(--pad); color: var(--ink); - font-size: 19px; - font-weight: 650; - letter-spacing: -0.02em; text-decoration: none; } .brand:focus-visible { @@ -36,8 +33,22 @@ .brandMark { display: block; - width: 31px; - height: 22px; + flex: none; + width: 36px; + height: 26px; +} + +/* The name in the site's label type, one line per span */ +.brandName { + font-family: var(--mono); + font-size: 10.5px; + font-weight: 500; + line-height: 1.35; + letter-spacing: 0.08em; + text-transform: uppercase; +} +.brandName span { + display: block; } .navCta { diff --git a/src/components/Nav.tsx b/src/components/Nav.tsx index 427e935..6303d64 100644 --- a/src/components/Nav.tsx +++ b/src/components/Nav.tsx @@ -5,7 +5,7 @@ import { useSelectedLayoutSegment } from "next/navigation"; import { ButtonLink } from "./Button"; import { Crosses, VRule } from "./Grid"; -import { Mark, Name } from "./Mark"; +import { Mark } from "./Mark"; import styles from "./Nav.module.css"; import { SECTIONS, href } from "./siteData"; @@ -20,13 +20,17 @@ export function Nav() {

- It sees the pole d ms late. Push d past{" "} - {deadline} ms and it falls. + It sees the pole d ms late. Past {deadline}{" "} + ms it can no longer settle. Push further and it falls.

- + d, theta: {"\\theta"} }} + details={ + + } + /> ); } diff --git a/src/components/ControlToy.module.css b/src/components/ControlToy.module.css index 9224537..387924c 100644 --- a/src/components/ControlToy.module.css +++ b/src/components/ControlToy.module.css @@ -79,11 +79,6 @@ .readouts dt { font-size: 10.5px; } -.readouts dt i { - font: italic 400 13px/1 var(--sans); - letter-spacing: 0; - text-transform: none; -} .readouts dd { margin: 0; color: var(--ink); @@ -497,75 +492,6 @@ vertical-align: 1px; } -.caption i { - font: italic 400 12.5px/1 var(--sans); -} - -/* Closed by default; the summary is a quiet mono toggle */ -.more { - margin-top: 12px; -} -.more summary { - width: fit-content; - cursor: pointer; - list-style: none; - color: var(--ink); - letter-spacing: 0.08em; - text-transform: uppercase; -} -.more summary::-webkit-details-marker { - display: none; -} -.more summary::before { - content: "+"; - display: inline-block; - width: 2ch; - color: var(--accent); -} -.more[open] summary::before { - content: "−"; -} -.more summary:hover { - color: var(--accent); -} -.more summary:focus-visible { - outline: 1px solid var(--accent); - outline-offset: 3px; -} - -/* Each entry under its own hairline, two to a row on wide screens */ -.model { - display: grid; - grid-template-columns: minmax(0, 1fr); - gap: 14px 32px; - margin: 14px 0 0; -} -.model > div { - padding-top: 8px; - border-top: 1px solid var(--rule); -} -.model dt { - margin-bottom: 4px; - color: var(--ink-muted); - font-size: 10px; - font-weight: 500; - letter-spacing: 0.1em; - text-transform: uppercase; -} -.model dd { - margin: 0; -} -.model b { - color: var(--ink); - font-weight: 500; -} - -@media (min-width: 600px) { - .model { - grid-template-columns: repeat(2, minmax(0, 1fr)); - } -} - @media (min-width: 900px) { .caption { padding-top: 22px; diff --git a/src/components/ControlToy.tsx b/src/components/ControlToy.tsx index 694ef9b..549f04f 100644 --- a/src/components/ControlToy.tsx +++ b/src/components/ControlToy.tsx @@ -2,7 +2,9 @@ import { type MouseEvent, + type ReactNode, useEffect, + useLayoutEffect, useId, useMemo, useRef, @@ -11,13 +13,10 @@ import { } from "react"; import { - AUTO_NUDGE_MS, type CartPole, DEG, - GAINS, MAX_DELAY_MS, MODEL, - NUDGE, SCENARIO_MS, runScenario, } from "@/lib/cartpole"; @@ -55,10 +54,12 @@ const getRMServer = () => false; type Props = { deadlineMs: number; // from findDeadline(), run at build time - marginMs: number; // from linearDelayMargin() + // Typeset by the server (Tex), so KaTeX never ships to the browser + math: { d: ReactNode; theta: ReactNode }; + details: ReactNode; }; -export function ControlToy({ deadlineMs, marginMs }: Props) { +export function ControlToy({ deadlineMs, math, details }: Props) { const reduced = useSyncExternalStore(subscribeRM, getRM, getRMServer); const [delay, setDelay] = useState(INITIAL_DELAY_MS); const [liveFall, setLiveFall] = useState(null); @@ -204,13 +205,15 @@ export function ControlToy({ deadlineMs, marginMs }: Props) { }; }, [reduced]); + // Also when the live loop starts, so a simulation created after the + // knob has moved runs at the knob's delay useEffect(() => { if (simRef.current) simRef.current.delay = delay; - }, [delay]); + }, [delay, reduced]); // A React render re-applies the first-frame attributes only when they - // change (a resize). Put the live pose back straight away. - useEffect(() => { + // change (a resize). Put the live pose back before the browser paints. + useLayoutEffect(() => { if (reduced) return; const sim = simRef.current; const mech = mechRef.current; @@ -270,9 +273,7 @@ export function ControlToy({ deadlineMs, marginMs }: Props) {
1 kHz
-
- d -
+
{math.d}
{delay} ms
@@ -600,6 +601,7 @@ export function ControlToy({ deadlineMs, marginMs }: Props) { value={delay} max={MAX_DELAY_MS} deadline={deadlineMs} + symbol={math.d} onChange={setDelay} /> @@ -608,12 +610,13 @@ export function ControlToy({ deadlineMs, marginMs }: Props) {
- Fig. 4Pole angle θ, {reduced ? "first" : "last"}{" "} - {SCENARIO_MS / 1000} s + Fig. 4Pole angle {math.theta},{" "} + {reduced ? "first" : "last"} {SCENARIO_MS / 1000} s
-
+

Model

-

+

Fig. 3A cart-pole under state feedback, read{" "} - d ms late.{" "} + {math.d} ms late.{" "} Simulated

- {/* The model's parameters, collapsed under the figure */} -
- Model details -
-
-
Plant
-
- Cart {MODEL.cartMass.toFixed(1)} kg on a ± - {MODEL.trackHalf} m track. Pole:{" "} - {MODEL.poleMass} kg point mass on a{" "} - {MODEL.poleLength} m massless rod. -
-
-
-
Controller
-
- u = {GAINS.th}θ + {GAINS.om}ω + {GAINS.x}x +{" "} - {GAINS.v}v, clipped to ±{MODEL.forceLimit}{" "} - N. LQR gains, rounded. It reads the state - from a ring buffer, d steps back. -
-
-
-
Physics
-
- RK4, fixed {MODEL.stepMs} ms step. The - controller runs every step (1 kHz). Test - nudge: {NUDGE} rad/s every{" "} - {AUTO_NUDGE_MS / 1000} s, alternating sides. -
-
-
-
Deadline
-
- {deadlineMs} ms: the largest d{" "} - at which a 1 µrad tilt still dies out, found - by bisection on this simulation at build - time. The linearised loop's delay - margin, {marginMs.toFixed(1)} ms, agrees to - within a step. -
-
-
-
+ {details}
diff --git a/src/components/Hero.tsx b/src/components/Hero.tsx index e9f2e9b..546a996 100644 --- a/src/components/Hero.tsx +++ b/src/components/Hero.tsx @@ -139,6 +139,12 @@ export function Hero() { const st = drag.current; const el = root.current; if (e.pointerId !== st.id || !el) return; + // The press ended off the scrubber before a drag began, so onUp + // never heard about it: this is a hover, not a drag + if (!st.on && e.buttons === 0) { + st.id = -1; + return; + } if (!st.on) { // Only a sideways drag scrubs, so a vertical swipe still scrolls const dx = Math.abs(e.clientX - st.x); diff --git a/src/components/LatencyKnob.module.css b/src/components/LatencyKnob.module.css index f9184eb..82d56ed 100644 --- a/src/components/LatencyKnob.module.css +++ b/src/components/LatencyKnob.module.css @@ -26,12 +26,6 @@ text-transform: uppercase; color: var(--ink); } -.label i { - margin-left: 2px; - font: italic 400 14px/1 var(--sans); - letter-spacing: 0; - text-transform: none; -} .value { font-family: var(--mono); @@ -118,6 +112,13 @@ top: 6px; right: 0; } +/* On the narrowest phones it would run into the deadline's label; the + hatch and the verdict under the scale still say it */ +@media (max-width: 379px) { + .unstableLabel { + display: none; + } +} .deadline { position: absolute; diff --git a/src/components/LatencyKnob.tsx b/src/components/LatencyKnob.tsx index 6175c59..156a6da 100644 --- a/src/components/LatencyKnob.tsx +++ b/src/components/LatencyKnob.tsx @@ -1,6 +1,6 @@ "use client"; -import type { CSSProperties, KeyboardEvent } from "react"; +import type { CSSProperties, KeyboardEvent, ReactNode } from "react"; import { Crosses, VRule } from "./Grid"; import styles from "./LatencyKnob.module.css"; @@ -10,13 +10,21 @@ type Props = { value: number; max: number; deadline: number; + symbol: ReactNode; // d, typeset by the server onChange: (v: number) => void; }; // A native range input (keyboard, touch and screen readers for free) laid // over a drawn scale: ticks every 10 ms, the deadline in maroon and the // unstable side hatched like the page's late column. -export function LatencyKnob({ id, value, max, deadline, onChange }: Props) { +export function LatencyKnob({ + id, + value, + max, + deadline, + symbol, + onChange, +}: Props) { const pct = (v: number) => `${(v / max) * 100}%`; const late = value > deadline; const ticks: number[] = []; @@ -56,7 +64,7 @@ export function LatencyKnob({ id, value, max, deadline, onChange }: Props) {
div { + padding-top: 8px; + border-top: 1px solid var(--rule); +} +.model dt { + margin-bottom: 4px; + color: var(--ink-muted); + font-size: 10px; + font-weight: 500; + letter-spacing: 0.1em; + text-transform: uppercase; +} +.model dd { + margin: 0; +} +.model b { + color: var(--ink); + font-weight: 500; +} + +@media (min-width: 600px) { + .model { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } +} diff --git a/src/components/ModelDetails.tsx b/src/components/ModelDetails.tsx new file mode 100644 index 0000000..4fbe2cc --- /dev/null +++ b/src/components/ModelDetails.tsx @@ -0,0 +1,58 @@ +import { AUTO_NUDGE_MS, GAINS, MODEL, NUDGE } from "@/lib/cartpole"; + +import styles from "./ModelDetails.module.css"; +import { Tex } from "./Tex"; + +const LAW = `u = ${GAINS.th}\\theta + ${GAINS.om}\\omega + ${GAINS.x}x + ${GAINS.v}v`; + +type Props = { + deadlineMs: number; // from findDeadline(), run at build time + marginMs: number; // from linearDelayMargin() +}; + +// The model's parameters, collapsed under the cart-pole figure +export function ModelDetails({ deadlineMs, marginMs }: Props) { + return ( +
+ Model details +
+
+
Plant
+
+ Cart {MODEL.cartMass.toFixed(1)} kg on a ± + {MODEL.trackHalf} m track. Pole: {MODEL.poleMass} kg + point mass on a {MODEL.poleLength} m massless rod. +
+
+
+
Controller
+
+ {LAW}, clipped to ±{MODEL.forceLimit} N. LQR + gains, rounded. It reads the state from a ring buffer,{" "} + d steps back. +
+
+
+
Physics
+
+ RK4, fixed {MODEL.stepMs} ms step. The controller runs + every step (1 kHz). Test nudge: {NUDGE} rad/s every{" "} + {AUTO_NUDGE_MS / 1000} s, alternating sides. +
+
+
+
Deadline
+
+ {deadlineMs} ms: the largest d at + which a 1 µrad tilt still dies out, found by bisection + on this simulation at build time. The linearised + loop's delay margin, {marginMs.toFixed(1)} ms, + agrees to about a step. Just past the deadline, the ± + {MODEL.forceLimit} N limit can hold the pole in a steady + wobble instead of letting it fall. +
+
+
+
+ ); +} diff --git a/src/components/Tex.module.css b/src/components/Tex.module.css new file mode 100644 index 0000000..fd30b1b --- /dev/null +++ b/src/components/Tex.module.css @@ -0,0 +1,5 @@ +/* Math also sits in uppercase, letter-spaced labels; keep both off it */ +.tex { + letter-spacing: 0; + text-transform: none; +} diff --git a/src/components/Tex.tsx b/src/components/Tex.tsx new file mode 100644 index 0000000..60b441f --- /dev/null +++ b/src/components/Tex.tsx @@ -0,0 +1,18 @@ +import katex from "katex"; +import "katex/dist/katex.min.css"; + +import styles from "./Tex.module.css"; + +// LaTeX, typeset by KaTeX when the page is built. Only the HTML and the +// stylesheet reach the browser, not KaTeX itself, so this stays a server +// component; client components take its output as props. +export function Tex({ children }: { children: string }) { + return ( + + ); +} diff --git a/src/lib/cartpole.test.ts b/src/lib/cartpole.test.ts index 8c89e18..d6c0a3c 100644 --- a/src/lib/cartpole.test.ts +++ b/src/lib/cartpole.test.ts @@ -64,8 +64,9 @@ describe("the deadline", () => { }); // Two independent routes to the same number: brute simulation of the - // nonlinear sampled loop, and the phase margin of the linearised one - test("agrees with the linear delay margin to within 2 ms", () => { - expect(Math.abs(linearDelayMargin() - deadline)).toBeLessThanOrEqual(2); + // nonlinear sampled loop, and the phase margin of the linearised one. + // Model details says they agree to about a step (1 ms). + test("agrees with the linear delay margin to about a step", () => { + expect(Math.abs(linearDelayMargin() - deadline)).toBeLessThan(1.5); }); }); From 4115c1c9896430f441d73db4cb74b4a43ecd5843 Mon Sep 17 00:00:00 2001 From: Hao Yan Date: Mon, 26 Oct 2026 03:38:56 -0400 Subject: [PATCH 3/5] refactor: share styles and constants, move the chrome to the root layout, split the cart-pole --- .github/workflows/deploy.yaml | 16 +- README.md | 6 +- ...no-Medium.ttf => ibm-plex-mono-medium.ttf} | Bin ...PlexMono-OFL.txt => ibm-plex-mono-ofl.txt} | 0 ...ight-Medium.ttf => inter-tight-medium.ttf} | Bin ...InterTight-OFL.txt => inter-tight-ofl.txt} | 0 ...-SemiBold.ttf => inter-tight-semibold.ttf} | Bin .../{logo-dark.png => ml3-logo-dark.png} | Bin .../brand/{logo.png => ml3-logo-light.png} | Bin .../brand/{logo-traced.svg => ml3-mark.svg} | 0 src/app/(site)/contact/page.tsx | 9 - src/app/(site)/get-involved/page.tsx | 9 - src/app/(site)/layout.tsx | 54 --- src/app/(site)/projects/page.tsx | 9 - src/app/(site)/sponsors/page.tsx | 9 - src/app/(site)/team/page.tsx | 9 - src/app/contact/page.tsx | 20 + src/app/get-involved/page.tsx | 9 + src/app/globals.css | 6 +- src/app/icon.svg | 2 +- src/app/{(site) => }/layout.module.css | 2 - src/app/layout.tsx | 66 +++- src/app/og.png/route.tsx | 9 +- src/app/{(site) => }/page.tsx | 4 + src/app/projects/page.tsx | 9 + src/app/shared-metadata.ts | 31 +- src/app/sponsors/page.tsx | 9 + src/app/team/page.tsx | 9 + src/components/CartPoleDrawings.tsx | 316 ++++++++++++++++ src/components/ControlToy.module.css | 55 +-- src/components/ControlToy.tsx | 353 ++---------------- src/components/EmptySection.tsx | 71 ---- src/components/Grid.module.css | 51 ++- src/components/Hero.module.css | 163 +++----- src/components/Hero.tsx | 45 ++- src/components/LatencyKnob.module.css | 43 +-- src/components/LatencyKnob.tsx | 10 +- ...tion.module.css => SectionPage.module.css} | 12 +- src/components/SectionPage.tsx | 77 ++++ src/components/TimingStrip.module.css | 40 +- src/components/TimingStrip.tsx | 37 +- src/components/cartpolePaint.ts | 12 +- src/components/markData.ts | 2 +- src/lib/cartpole.ts | 10 +- src/lib/motion.ts | 19 + vitest.config.ts => vitest.config.mts | 0 46 files changed, 818 insertions(+), 795 deletions(-) rename assets/fonts/{IBMPlexMono-Medium.ttf => ibm-plex-mono-medium.ttf} (100%) rename assets/fonts/{IBMPlexMono-OFL.txt => ibm-plex-mono-ofl.txt} (100%) rename assets/fonts/{InterTight-Medium.ttf => inter-tight-medium.ttf} (100%) rename assets/fonts/{InterTight-OFL.txt => inter-tight-ofl.txt} (100%) rename assets/fonts/{InterTight-SemiBold.ttf => inter-tight-semibold.ttf} (100%) rename public/media/brand/{logo-dark.png => ml3-logo-dark.png} (100%) rename public/media/brand/{logo.png => ml3-logo-light.png} (100%) rename public/media/brand/{logo-traced.svg => ml3-mark.svg} (100%) delete mode 100644 src/app/(site)/contact/page.tsx delete mode 100644 src/app/(site)/get-involved/page.tsx delete mode 100644 src/app/(site)/layout.tsx delete mode 100644 src/app/(site)/projects/page.tsx delete mode 100644 src/app/(site)/sponsors/page.tsx delete mode 100644 src/app/(site)/team/page.tsx create mode 100644 src/app/contact/page.tsx create mode 100644 src/app/get-involved/page.tsx rename src/app/{(site) => }/layout.module.css (97%) rename src/app/{(site) => }/page.tsx (89%) create mode 100644 src/app/projects/page.tsx create mode 100644 src/app/sponsors/page.tsx create mode 100644 src/app/team/page.tsx create mode 100644 src/components/CartPoleDrawings.tsx delete mode 100644 src/components/EmptySection.tsx rename src/components/{EmptySection.module.css => SectionPage.module.css} (90%) create mode 100644 src/components/SectionPage.tsx create mode 100644 src/lib/motion.ts rename vitest.config.ts => vitest.config.mts (100%) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 86999cb..5e56ad8 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,18 +1,21 @@ name: Deploy to GitHub Pages +# Pull requests get the same checks and build, without the deploy on: push: branches: ["main"] + pull_request: workflow_dispatch: +# Read-only by default; only the deploy job can write to Pages permissions: contents: read - pages: write - id-token: write +# One run per branch or pull request. A new push replaces a pull request's +# run, but never cancels a deploy that is under way. concurrency: - group: "pages" - cancel-in-progress: true + group: pages-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: build: @@ -55,11 +58,16 @@ jobs: # artifact as-is, without a Jekyll pass to hide _next/ from, and # upload-pages-artifact v5 drops dotfiles by default anyway. - name: Upload artifact + if: github.event_name != 'pull_request' uses: actions/upload-pages-artifact@v5 with: path: ./out deploy: + if: github.event_name != 'pull_request' + permissions: + pages: write + id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/README.md b/README.md index 5fe37cc..4221f8d 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ npm run dev ``` src/ - app/ # App Router: root layout, global styles, shared metadata - (site)/ # The site's chrome (nav, deadline, footer) and its pages + app/ # App Router: the pages, the root layout with the site's + # chrome (nav, deadline, footer), styles and metadata components/ # UI components lib/ # Framework-free logic public/ # Served as-is, including CNAME - media/brand/ # Logo + media/brand/ # Logo: light and dark PNGs, and the mark as SVG assets/fonts/ # Fonts for the link-preview image (OFL) ``` diff --git a/assets/fonts/IBMPlexMono-Medium.ttf b/assets/fonts/ibm-plex-mono-medium.ttf similarity index 100% rename from assets/fonts/IBMPlexMono-Medium.ttf rename to assets/fonts/ibm-plex-mono-medium.ttf diff --git a/assets/fonts/IBMPlexMono-OFL.txt b/assets/fonts/ibm-plex-mono-ofl.txt similarity index 100% rename from assets/fonts/IBMPlexMono-OFL.txt rename to assets/fonts/ibm-plex-mono-ofl.txt diff --git a/assets/fonts/InterTight-Medium.ttf b/assets/fonts/inter-tight-medium.ttf similarity index 100% rename from assets/fonts/InterTight-Medium.ttf rename to assets/fonts/inter-tight-medium.ttf diff --git a/assets/fonts/InterTight-OFL.txt b/assets/fonts/inter-tight-ofl.txt similarity index 100% rename from assets/fonts/InterTight-OFL.txt rename to assets/fonts/inter-tight-ofl.txt diff --git a/assets/fonts/InterTight-SemiBold.ttf b/assets/fonts/inter-tight-semibold.ttf similarity index 100% rename from assets/fonts/InterTight-SemiBold.ttf rename to assets/fonts/inter-tight-semibold.ttf diff --git a/public/media/brand/logo-dark.png b/public/media/brand/ml3-logo-dark.png similarity index 100% rename from public/media/brand/logo-dark.png rename to public/media/brand/ml3-logo-dark.png diff --git a/public/media/brand/logo.png b/public/media/brand/ml3-logo-light.png similarity index 100% rename from public/media/brand/logo.png rename to public/media/brand/ml3-logo-light.png diff --git a/public/media/brand/logo-traced.svg b/public/media/brand/ml3-mark.svg similarity index 100% rename from public/media/brand/logo-traced.svg rename to public/media/brand/ml3-mark.svg diff --git a/src/app/(site)/contact/page.tsx b/src/app/(site)/contact/page.tsx deleted file mode 100644 index f9d915a..0000000 --- a/src/app/(site)/contact/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { EmptySection } from "@/components/EmptySection"; - -import { sectionMetadata } from "../../shared-metadata"; - -export const metadata = sectionMetadata("contact"); - -export default function ContactPage() { - return ; -} diff --git a/src/app/(site)/get-involved/page.tsx b/src/app/(site)/get-involved/page.tsx deleted file mode 100644 index 4d57d67..0000000 --- a/src/app/(site)/get-involved/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { EmptySection } from "@/components/EmptySection"; - -import { sectionMetadata } from "../../shared-metadata"; - -export const metadata = sectionMetadata("get-involved"); - -export default function GetInvolvedPage() { - return ; -} diff --git a/src/app/(site)/layout.tsx b/src/app/(site)/layout.tsx deleted file mode 100644 index 84af019..0000000 --- a/src/app/(site)/layout.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import type { Metadata } from "next"; -import { IBM_Plex_Mono, Inter_Tight } from "next/font/google"; -import type { ReactNode } from "react"; - -import { Footer } from "@/components/Footer"; -import { Late } from "@/components/Grid"; -import { Nav } from "@/components/Nav"; - -import styles from "./layout.module.css"; - -// Inter Tight for the wordmark and text: a neo-grotesk with tight default -// spacing that holds up at 100px+. IBM Plex Mono for labels, figure -// captions and buttons, like a datasheet. Math is typeset by KaTeX (Tex). -const sans = Inter_Tight({ - subsets: ["latin"], - variable: "--font-inter-tight", - display: "swap", -}); - -const mono = IBM_Plex_Mono({ - subsets: ["latin"], - weight: ["400", "500"], - variable: "--font-plex-mono", - display: "swap", -}); - -// Pages give a short title ("Team"); the landing page keeps the default -export const metadata: Metadata = { - title: { - default: "ML³ Labs", - template: "%s · ML³ Labs", - }, -}; - -// The site's chrome: fonts, nav, the deadline line and the footer. The -// root layout stays bare, so a page outside this route group can bring its -// own. -export default function SiteLayout({ children }: { children: ReactNode }) { - return ( -
- - Skip to content - -
-
-
- ); -} diff --git a/src/app/(site)/projects/page.tsx b/src/app/(site)/projects/page.tsx deleted file mode 100644 index 424058a..0000000 --- a/src/app/(site)/projects/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { EmptySection } from "@/components/EmptySection"; - -import { sectionMetadata } from "../../shared-metadata"; - -export const metadata = sectionMetadata("projects"); - -export default function ProjectsPage() { - return ; -} diff --git a/src/app/(site)/sponsors/page.tsx b/src/app/(site)/sponsors/page.tsx deleted file mode 100644 index 96cf707..0000000 --- a/src/app/(site)/sponsors/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { EmptySection } from "@/components/EmptySection"; - -import { sectionMetadata } from "../../shared-metadata"; - -export const metadata = sectionMetadata("sponsors"); - -export default function SponsorsPage() { - return ; -} diff --git a/src/app/(site)/team/page.tsx b/src/app/(site)/team/page.tsx deleted file mode 100644 index c95ffe5..0000000 --- a/src/app/(site)/team/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { EmptySection } from "@/components/EmptySection"; - -import { sectionMetadata } from "../../shared-metadata"; - -export const metadata = sectionMetadata("team"); - -export default function TeamPage() { - return ; -} diff --git a/src/app/contact/page.tsx b/src/app/contact/page.tsx new file mode 100644 index 0000000..3391402 --- /dev/null +++ b/src/app/contact/page.tsx @@ -0,0 +1,20 @@ +import { SectionPage } from "@/components/SectionPage"; +import { CONTACTS, EMAIL } from "@/components/siteData"; + +import { sectionMetadata } from "../shared-metadata"; + +export const metadata = sectionMetadata("contact"); + +// The one nav page with content already: the email, then the other ways to +// reach the club +export default function ContactPage() { + return ( + + ); +} diff --git a/src/app/get-involved/page.tsx b/src/app/get-involved/page.tsx new file mode 100644 index 0000000..a1a535f --- /dev/null +++ b/src/app/get-involved/page.tsx @@ -0,0 +1,9 @@ +import { SectionPage } from "@/components/SectionPage"; + +import { sectionMetadata } from "../shared-metadata"; + +export const metadata = sectionMetadata("get-involved"); + +export default function GetInvolvedPage() { + return ; +} diff --git a/src/app/globals.css b/src/app/globals.css index 393f65f..c8c114b 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -9,13 +9,11 @@ --ink: #11151b; --accent: #8b2145; --text: #3a3a3a; - --text-strong: var(--ink); - --text-muted: rgba(17, 21, 27, 0.55); /* The site's drawing language: ink at fixed alphas over --bg, so a hairline is the same weight in the nav, a figure and the footer. - --text-muted is too light for the 10-12px mono labels (about 4:1); - --ink-muted clears 4.5:1. --ink-faint never carries text. */ + --ink-muted is 0.66 because the 10-12px mono labels need 4.5:1, which + 0.55 misses (about 4:1). --ink-faint never carries text. */ --ink-muted: rgba(17, 21, 27, 0.66); --ink-soft: rgba(17, 21, 27, 0.5); --ink-faint: rgba(17, 21, 27, 0.3); diff --git a/src/app/icon.svg b/src/app/icon.svg index f6d7e05..f6659e6 100644 --- a/src/app/icon.svg +++ b/src/app/icon.svg @@ -1,5 +1,5 @@ - {children} + +
+ + Skip to content + +
+
+
+ ); } diff --git a/src/app/og.png/route.tsx b/src/app/og.png/route.tsx index 373ea29..50ec3c3 100644 --- a/src/app/og.png/route.tsx +++ b/src/app/og.png/route.tsx @@ -32,9 +32,9 @@ const font = (file: string) => export async function GET() { const [medium, semibold, mono] = await Promise.all([ - font("InterTight-Medium.ttf"), - font("InterTight-SemiBold.ttf"), - font("IBMPlexMono-Medium.ttf"), + font("inter-tight-medium.ttf"), + font("inter-tight-semibold.ttf"), + font("ibm-plex-mono-medium.ttf"), ]); return new ImageResponse( @@ -160,8 +160,7 @@ export async function GET() { height: OG_IMAGE.height, fonts: [ { name: "Inter Tight", data: medium, weight: 500 }, - // The file is the 650 cut, the weight the site sets the name in; - // Satori only takes the standard steps, so it is filed under 600 + // SemiBold (600), the weight the hero sets the name in { name: "Inter Tight", data: semibold, weight: 600 }, { name: "IBM Plex Mono", data: mono, weight: 500 }, ], diff --git a/src/app/(site)/page.tsx b/src/app/page.tsx similarity index 89% rename from src/app/(site)/page.tsx rename to src/app/page.tsx index bed0d46..e7861fb 100644 --- a/src/app/(site)/page.tsx +++ b/src/app/page.tsx @@ -2,6 +2,10 @@ import { ControlSection } from "@/components/ControlSection"; import { Hero } from "@/components/Hero"; import { TimingStrip } from "@/components/TimingStrip"; +import { pageMetadata } from "./shared-metadata"; + +export const metadata = pageMetadata("/"); + // The thesis, then the proof: a handshake that meets its deadline, a // control loop you can make late, and the same handshake missing it export default function Home() { diff --git a/src/app/projects/page.tsx b/src/app/projects/page.tsx new file mode 100644 index 0000000..d5ed2c5 --- /dev/null +++ b/src/app/projects/page.tsx @@ -0,0 +1,9 @@ +import { SectionPage } from "@/components/SectionPage"; + +import { sectionMetadata } from "../shared-metadata"; + +export const metadata = sectionMetadata("projects"); + +export default function ProjectsPage() { + return ; +} diff --git a/src/app/shared-metadata.ts b/src/app/shared-metadata.ts index 83581e4..4fb0e98 100644 --- a/src/app/shared-metadata.ts +++ b/src/app/shared-metadata.ts @@ -2,15 +2,21 @@ import type { Metadata } from "next"; import { href, section, type Section } from "@/components/siteData"; +export const SITE_NAME = "ML³ Labs"; + export const description = "McMaster Low Latency Labs. A deadline is a correctness condition."; +// "Team · ML³ Labs", or the site name alone +export const titleFor = (title?: string) => + title ? `${title} · ${SITE_NAME}` : SITE_NAME; + // The preview card, built by og.png/route.tsx export const OG_IMAGE = { url: "/og.png", width: 1200, height: 630, - alt: "ML³ Labs: McMaster Low Latency Labs. A deadline is a correctness condition.", + alt: `${SITE_NAME}: ${description}`, } as const; export const twitter = { @@ -23,24 +29,27 @@ export const twitter = { // into it, so every page spreads these in export const openGraph = { type: "website", - siteName: "ML³ Labs", + siteName: SITE_NAME, description, images: OG_IMAGE, locale: "en_US", } as const; -// Without its own canonical and og:url, a section page would inherit the -// root's "/" and tell crawlers it is a copy of the landing page -export function sectionMetadata(slug: Section["slug"]): Metadata { - const { title } = section(slug); - const url = href(slug); - // The tab title gets " · ML³ Labs" from the (site) layout's template; - // og and twitter titles are not templated, so they carry it themselves - const full = `${title} · ML³ Labs`; +// A page's canonical URL and link-preview titles. Without its own +// canonical and og:url, a page would inherit the root's "/" and tell +// crawlers it is a copy of the landing page. The og and twitter titles +// are not templated like the tab title, so they carry the site name. +export function pageMetadata(url: string, title?: string): Metadata { + const full = titleFor(title); return { - title, alternates: { canonical: url }, openGraph: { ...openGraph, url, title: full }, twitter: { ...twitter, title: full }, }; } + +// The tab title gets the site name from the root layout's template +export function sectionMetadata(slug: Section["slug"]): Metadata { + const { title } = section(slug); + return { title, ...pageMetadata(href(slug), title) }; +} diff --git a/src/app/sponsors/page.tsx b/src/app/sponsors/page.tsx new file mode 100644 index 0000000..dad91fa --- /dev/null +++ b/src/app/sponsors/page.tsx @@ -0,0 +1,9 @@ +import { SectionPage } from "@/components/SectionPage"; + +import { sectionMetadata } from "../shared-metadata"; + +export const metadata = sectionMetadata("sponsors"); + +export default function SponsorsPage() { + return ; +} diff --git a/src/app/team/page.tsx b/src/app/team/page.tsx new file mode 100644 index 0000000..8e1ebaa --- /dev/null +++ b/src/app/team/page.tsx @@ -0,0 +1,9 @@ +import { SectionPage } from "@/components/SectionPage"; + +import { sectionMetadata } from "../shared-metadata"; + +export const metadata = sectionMetadata("team"); + +export default function TeamPage() { + return ; +} diff --git a/src/components/CartPoleDrawings.tsx b/src/components/CartPoleDrawings.tsx new file mode 100644 index 0000000..e0c2616 --- /dev/null +++ b/src/components/CartPoleDrawings.tsx @@ -0,0 +1,316 @@ +import type { Ref } from "react"; + +import { MODEL, SCENARIO_MS } from "@/lib/cartpole"; + +import { + type MechFrame, + type MechGeom, + SCOPE_H, + type ScopeFrame, + type ScopeGeom, + signed, +} from "./cartpolePaint"; +import styles from "./ControlToy.module.css"; + +// The cart-pole figure's two drawings, as their first frame. ControlToy +// animates them afterwards through the nodes marked data-k, which +// mechNodes() and scopeNodes() in cartpolePaint.ts look up by those names: +// rename one here and rename it there. + +export function Mechanism({ + ref, + g, + f0, + hatchId, +}: { + ref: Ref; + g: MechGeom; + f0: MechFrame; + hatchId: string; +}) { + return ( + + + + + + + + {/* The floor runs on past both ends, so it stays put + while the rest pans */} + + + + {/* Track and end stops */} + + + + + + + {/* What the controller sees: the state d ms ago */} + + + + + + + + + + + + + + + + {[-1, 1].map((side) => ( + + + + + ))} + + {g.showMass && ( + + {MODEL.cartMass.toFixed(1)} kg + + )} + + + + + + + + + + + {f0.th.text} + + + {f0.u.text || " "} + + + {f0.x.text} + + + + + + + ); +} + +export function Scope({ + ref, + sg, + sc0, + reduced, + clipId, + traceId, +}: { + ref: Ref; + sg: ScopeGeom; + sc0: ScopeFrame; + reduced: boolean; + clipId: string; + traceId: string; +}) { + const secTicks: number[] = []; + for (let k = 0; k <= SCENARIO_MS / 1000; k++) secTicks.push(k); + const yOf = (deg: number) => sg.mid - deg * sg.degPx; + + return ( + + + + + + + + {[-20, -10, 10, 20].map((d) => ( + + ))} + + {[20, 0, -20].map((d) => ( + + {signed(d, 0, "°")} + + ))} + {secTicks.map((k) => ( + + ))} + {(reduced + ? (["0 s", "4 s", "8 s"] as const) + : (["−8 s", "−4 s", "now"] as const) + ).map((t, i) => ( + + {t} + + ))} + + + + + + + + + ); +} diff --git a/src/components/ControlToy.module.css b/src/components/ControlToy.module.css index 387924c..9831d77 100644 --- a/src/components/ControlToy.module.css +++ b/src/components/ControlToy.module.css @@ -37,28 +37,13 @@ /* ----------------------------------------------------------------- header */ .meta { - composes: row from "./Grid.module.css"; - display: flex; + composes: figHead from "./Grid.module.css"; flex-wrap: wrap; - align-items: center; - justify-content: space-between; - gap: 10px 16px; - min-height: 44px; - padding: 10px calc(var(--late) + var(--pad)) 10px var(--pad); - font-family: var(--mono); - font-size: 11px; - font-weight: 500; - letter-spacing: 0.08em; - text-transform: uppercase; - color: var(--ink-muted); + padding-top: 10px; + padding-bottom: 10px; } .metaFig { - color: var(--ink); - white-space: nowrap; -} -.metaFig span { - margin-left: 10px; - color: var(--ink-muted); + composes: figNo from "./Grid.module.css"; } /* Phones: the figure name and tag on one line, the readouts under them */ @@ -83,16 +68,14 @@ margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; +} +.readouts dd:not(.status) { letter-spacing: 0.02em; text-transform: none; } .readouts dd[data-late="true"] { color: var(--accent); } -.readouts .status { - letter-spacing: 0.14em; - text-transform: uppercase; -} /* Missed snaps to a filled maroon chip, like a pressed button */ .readouts .status[data-late="true"] { border-color: var(--accent); @@ -102,9 +85,6 @@ @media (min-width: 900px) { .meta { - display: grid; - grid-template-columns: calc(var(--c3) - var(--pad)) 1fr auto; - gap: 0; padding-top: 0; padding-bottom: 0; } @@ -361,6 +341,7 @@ } .scopeHead { + composes: numbered from "./Grid.module.css"; display: flex; flex-wrap: wrap; justify-content: space-between; @@ -371,22 +352,15 @@ font-size: 10.5px; line-height: 1.5; } -.scopeHead b { - margin-right: 10px; - color: var(--ink); - font-weight: 500; - letter-spacing: 0.08em; - text-transform: uppercase; -} .scopeKey { display: flex; flex-wrap: wrap; gap: 2px 12px; } +/* Its height is SCOPE_H, set inline */ .scopeBox { position: relative; - height: 112px; margin: 0 var(--pad); } .scope { @@ -459,14 +433,10 @@ /* ---------------------------------------------------------------- caption */ .caption { - composes: row split from "./Grid.module.css"; + composes: row split caption from "./Grid.module.css"; row-gap: 12px; padding-top: 16px; padding-bottom: 32px; - color: var(--ink-muted); - font-family: var(--mono); - font-size: 11px; - line-height: 1.55; } .capLabel { composes: label from "./Grid.module.css"; @@ -479,13 +449,6 @@ max-width: 62em; margin: 0; } -.capText b { - margin-right: 10px; - color: var(--ink); - font-weight: 500; - letter-spacing: 0.08em; - text-transform: uppercase; -} .capText .tag { display: inline-block; margin-left: 4px; diff --git a/src/components/ControlToy.tsx b/src/components/ControlToy.tsx index 549f04f..59b2afa 100644 --- a/src/components/ControlToy.tsx +++ b/src/components/ControlToy.tsx @@ -21,6 +21,7 @@ import { runScenario, } from "@/lib/cartpole"; import { onFrame } from "@/lib/frameLoop"; +import { prefersReducedMotion, subscribeReducedMotion } from "@/lib/motion"; import { applyMech, @@ -37,21 +38,13 @@ import { scopeNodes, } from "./cartpolePaint"; import styles from "./ControlToy.module.css"; +import { Mechanism, Scope } from "./CartPoleDrawings"; import { Crosses, VRule } from "./Grid"; import { LatencyKnob } from "./LatencyKnob"; const INITIAL_DELAY_MS = 30; const CATCH_TILT = 0.5 * DEG; -const RM = "(prefers-reduced-motion: reduce)"; -function subscribeRM(cb: () => void) { - const mq = window.matchMedia(RM); - mq.addEventListener("change", cb); - return () => mq.removeEventListener("change", cb); -} -const getRM = () => window.matchMedia(RM).matches; -const getRMServer = () => false; - type Props = { deadlineMs: number; // from findDeadline(), run at build time // Typeset by the server (Tex), so KaTeX never ships to the browser @@ -60,7 +53,11 @@ type Props = { }; export function ControlToy({ deadlineMs, math, details }: Props) { - const reduced = useSyncExternalStore(subscribeRM, getRM, getRMServer); + const reduced = useSyncExternalStore( + subscribeReducedMotion, + prefersReducedMotion, + () => false, + ); const [delay, setDelay] = useState(INITIAL_DELAY_MS); const [liveFall, setLiveFall] = useState(null); const [size, setSize] = useState({ w: 640, h: 320, sw: 640 }); @@ -212,7 +209,8 @@ export function ControlToy({ deadlineMs, math, details }: Props) { }, [delay, reduced]); // A React render re-applies the first-frame attributes only when they - // change (a resize). Put the live pose back before the browser paints. + // change: a resize, or the drawings remounting. Put the live pose back + // before the browser paints. useLayoutEffect(() => { if (reduced) return; const sim = simRef.current; @@ -242,10 +240,9 @@ export function ControlToy({ deadlineMs, math, details }: Props) { function onStageClick(e: MouseEvent) { if ((e.target as Element).closest("[data-overlay]")) return; const sim = simRef.current; - const g = geomRef.current?.mg; - if (reduced || !sim || !g || sim.fallen) return; + if (reduced || !sim || sim.fallen) return; const rect = e.currentTarget.getBoundingClientRect(); - const bobX = rect.left + (bobScreenX(sim, g) * rect.width) / g.w; + const bobX = rect.left + (bobScreenX(sim, mg) * rect.width) / mg.w; nudge(e.clientX < bobX ? 1 : -1); } @@ -255,9 +252,6 @@ export function ControlToy({ deadlineMs, math, details }: Props) { const clipId = `${uid}-clip`; const traceId = `${uid}-trace`; const capId = `${uid}-cap`; - const secTicks: number[] = []; - for (let k = 0; k <= SCENARIO_MS / 1000; k++) secTicks.push(k); - const yOf = (deg: number) => sg.mid - deg * sg.degPx; return (
@@ -299,212 +293,13 @@ export function ControlToy({ deadlineMs, math, details }: Props) { data-reduced={reduced} onClick={onStageClick} > - - - - - - - - {/* The floor runs on past both ends, so it stays put - while the rest pans */} - - - - {/* Track and end stops */} - - - - - - - {/* What the controller sees: the state d ms ago */} - - - - - - - - - - - - - - - - {[-1, 1].map((side) => ( - - - - - ))} - - {g.showMass && ( - - {MODEL.cartMass.toFixed(1)} kg - - )} - - - - - - - - - - - {f0.th.text} - - - {f0.u.text || " "} - - - {f0.x.text} - - - - - - + g={g} + f0={f0} + hatchId={hatchId} + /> {fall === null ? ( -
- + - - - - - - - {[-20, -10, 10, 20].map((d) => ( - - ))} - - {[20, 0, -20].map((d) => ( - - {d > 0 ? `+${d}°` : d < 0 ? `−${-d}°` : "0°"} - - ))} - {secTicks.map((k) => ( - - ))} - {(reduced - ? (["0 s", "4 s", "8 s"] as const) - : (["−8 s", "−4 s", "now"] as const) - ).map((t, i) => ( - - {t} - - ))} - - - - - - - - + sg={sg} + sc0={sc0} + reduced={reduced} + clipId={clipId} + traceId={traceId} + />
diff --git a/src/components/EmptySection.tsx b/src/components/EmptySection.tsx deleted file mode 100644 index 185c166..0000000 --- a/src/components/EmptySection.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import { ButtonLink } from "./Button"; -import styles from "./EmptySection.module.css"; -import { Crosses, VRule } from "./Grid"; -import { CONTACTS, EMAIL, SECTIONS, type Section } from "./siteData"; -import { TimingStrip } from "./TimingStrip"; - -const two = (n: number) => String(n).padStart(2, "0"); - -// Every nav page until it has content: its name, an undefined ACK, and a -// line on what will go there. Contact is the exception: it already has its -// content, the ways to reach the club. -export function EmptySection({ slug }: { slug: Section["slug"] }) { - const i = SECTIONS.findIndex((s) => s.slug === slug); - const page = SECTIONS[i]; - const contact = slug === "contact"; - - return ( - <> -
- - -

- {two(i + 1)} / {two(SECTIONS.length)} -

-

- {page.title} -

-
- - - -
- - -

- {contact ? "Reach us" : "Status"} -

-
- {contact ? ( - - {EMAIL} - - ) : ( -

Nothing here yet.

- )} -

{page.line}

- {contact && ( -
- {CONTACTS.slice(1).map((c) => ( - - {c.label} - - ))} -
- )} -
-
- - ); -} diff --git a/src/components/Grid.module.css b/src/components/Grid.module.css index 8085c99..47534fe 100644 --- a/src/components/Grid.module.css +++ b/src/components/Grid.module.css @@ -1,7 +1,7 @@ /* The page is one timing diagram. Every row has a 1px rule on top, + marks where rules cross, a column rule at --c3 (wide screens) and the deadline at --D, with the late column after it. --pad, --late, --c3 and --D come - from the site frame (src/app/(site)/layout.module.css). */ + from the site frame (src/app/layout.module.css). */ .row { position: relative; @@ -119,6 +119,50 @@ padding: 0 var(--pad); } +/* A figure's header row: its number and name on the left, readouts or + controls on the right. Wide, the number fills the label column. */ +.figHead { + composes: row; + display: flex; + align-items: center; + justify-content: space-between; + gap: 10px 16px; + min-height: 44px; + padding-right: calc(var(--late) + var(--pad)); + padding-left: var(--pad); + font-family: var(--mono); + font-size: 11px; + font-weight: 500; + letter-spacing: 0.08em; + text-transform: uppercase; + color: var(--ink-muted); +} +.figNo { + color: var(--ink); + white-space: nowrap; +} +.figNo span { + margin-left: 10px; + color: var(--ink-muted); +} + +/* Figure captions, led by the figure number in bold caps. .numbered gives + any other block the same number style. */ +.caption { + composes: numbered; + color: var(--ink-muted); + font-family: var(--mono); + font-size: 11px; + line-height: 1.55; +} +.numbered b { + margin-right: 10px; + color: var(--ink); + font-weight: 500; + letter-spacing: 0.08em; + text-transform: uppercase; +} + @media (min-width: 900px) { .split { grid-template-columns: var(--c3) 1fr; @@ -127,4 +171,9 @@ .vr { display: block; } + .figHead { + display: grid; + grid-template-columns: calc(var(--c3) - var(--pad)) 1fr auto; + gap: 0; + } } diff --git a/src/components/Hero.module.css b/src/components/Hero.module.css index 0afd3f7..ff26953 100644 --- a/src/components/Hero.module.css +++ b/src/components/Hero.module.css @@ -38,38 +38,16 @@ } .meta { - composes: row from "./Grid.module.css"; - display: flex; - align-items: center; - justify-content: space-between; - gap: 16px; - height: 44px; - padding: 0 calc(var(--late) + var(--pad)) 0 var(--pad); - font-family: var(--mono); - font-size: 11px; - font-weight: 500; - letter-spacing: 0.08em; - text-transform: uppercase; - color: var(--ink-muted); + composes: figHead from "./Grid.module.css"; } .metaFig { - color: var(--ink); - white-space: nowrap; -} -.metaFig span { - margin-left: 10px; - color: var(--ink-muted); + composes: figNo from "./Grid.module.css"; } .metaCap { display: none; } @media (min-width: 900px) { - .meta { - display: grid; - grid-template-columns: calc(var(--c3) - var(--pad)) 1fr auto; - gap: 0; - } .metaCap { display: block; overflow: hidden; @@ -91,10 +69,7 @@ } .stage { - composes: row from "./Grid.module.css"; - display: grid; - grid-template-columns: 1fr; - padding-right: var(--late); + composes: row split from "./Grid.module.css"; } .markCol { @@ -109,9 +84,6 @@ } @media (min-width: 900px) { - .stage { - grid-template-columns: var(--c3) 1fr; - } .markCol { padding: 56px 0 30px; } @@ -441,55 +413,55 @@ writing-mode: vertical-rl; } -/* Boot sequence. t0 = 300 ms after load, one tick per 120 ms: - t1 bar-1, t2 bar-2, t3 bar-3, t4 the ³ lands as the sweep arrives. - Every final keyframe equals the base style, so with no animation (or - reduced motion) the page shows the finished frame. */ - -.boot .sweep { - animation: sweep 480ms linear 300ms both; -} -.boot .clk { - animation: wipe 480ms linear 300ms both; -} -.boot .head { - animation: sweep 480ms linear 300ms both; -} -/* The label only snaps in once the line has landed */ -.boot .sweepTag { - animation: appear 780ms step-end both; -} -.boot .l1 { - animation: rise1 80ms steps(4, jump-start) 420ms both; -} -.boot .l2 { - animation: rise2 80ms steps(4, jump-start) 540ms both; -} -.boot .l3 { - animation: rise3 80ms steps(4, jump-start) 660ms both; -} -.boot .l4 { - animation: - appear 708ms step-end both, - land 72ms steps(3, jump-end) 708ms both; -} -.boot .lgRow[data-k] { - animation-name: lit; - animation-duration: var(--at); - animation-timing-function: step-end; - animation-fill-mode: both; -} -.boot .lgRow .hi { - animation-name: appear; - animation-duration: var(--at); - animation-timing-function: step-end; - animation-fill-mode: both; -} -.boot .lgRow .lo { - animation-name: vanish; - animation-duration: var(--at); - animation-timing-function: step-end; - animation-fill-mode: both; +/* Boot sequence, on the clock Hero.tsx sets from src/lib/motion.ts: --t0 + after load, then one --tick per step. t1 bar-1, t2 bar-2, t3 bar-3, t4 the + ³ lands as the sweep arrives. It only runs when motion is welcome. Every + final keyframe equals the base style, so otherwise the page shows the + finished frame. */ +@media (prefers-reduced-motion: no-preference) { + .boot .sweep, + .boot .head { + animation: sweep calc(4 * var(--tick)) linear var(--t0) both; + } + .boot .clk { + animation: wipe calc(4 * var(--tick)) linear var(--t0) both; + } + /* The label only snaps in once the line has landed */ + .boot .sweepTag { + animation: appear calc(var(--t0) + 4 * var(--tick)) step-end both; + } + /* Each bar rises in 80 ms, starting on its tick */ + .boot .l1 { + --top: 63.4%; + animation: rise 80ms steps(4, jump-start) calc(var(--t0) + var(--tick)) + both; + } + .boot .l2 { + --top: 40%; + animation: rise 80ms steps(4, jump-start) + calc(var(--t0) + 2 * var(--tick)) both; + } + .boot .l3 { + --top: 17.1%; + animation: rise 80ms steps(4, jump-start) + calc(var(--t0) + 3 * var(--tick)) both; + } + /* The ³ appears 72 ms early and drops in, landing on t4 */ + .boot .l4 { + --land-at: calc(var(--t0) + 4 * var(--tick) - 72ms); + animation: + appear var(--land-at) step-end both, + land 72ms steps(3, jump-end) var(--land-at) both; + } + .boot .lgRow[data-k] { + animation: lit var(--at) step-end both; + } + .boot .lgRow .hi { + animation: appear var(--at) step-end both; + } + .boot .lgRow .lo { + animation: vanish var(--at) step-end both; + } } @keyframes sweep { @@ -508,31 +480,15 @@ clip-path: inset(-4px -4px -4px -4px); } } -/* Each bar is revealed from the baseline up to its own top edge (bar-1 - 63.7%, bar-2 40.3%, bar-3 17.4% of the viewBox height), so the four steps - are four equal quarters of that bar */ -@keyframes rise1 { +/* Each bar is revealed from the baseline up to its own top edge, --top + (bar-1 63.7%, bar-2 40.3%, bar-3 17.4% of the viewBox height), so the + four steps are four equal quarters of that bar */ +@keyframes rise { from { clip-path: inset(calc(100% + 3px) -2px -2px -2px); } to { - clip-path: inset(63.4% -2px -2px -2px); - } -} -@keyframes rise2 { - from { - clip-path: inset(calc(100% + 3px) -2px -2px -2px); - } - to { - clip-path: inset(40% -2px -2px -2px); - } -} -@keyframes rise3 { - from { - clip-path: inset(calc(100% + 3px) -2px -2px -2px); - } - to { - clip-path: inset(17.1% -2px -2px -2px); + clip-path: inset(var(--top) -2px -2px -2px); } } @keyframes appear { @@ -592,11 +548,6 @@ } @media (prefers-reduced-motion: reduce) { - .boot *, - .boot *::before, - .boot *::after { - animation: none !important; - } .replay { display: none; } diff --git a/src/components/Hero.tsx b/src/components/Hero.tsx index 546a996..d1daea3 100644 --- a/src/components/Hero.tsx +++ b/src/components/Hero.tsx @@ -4,6 +4,12 @@ import { useEffect, useRef } from "react"; import type { CSSProperties, PointerEvent } from "react"; import { onFrame } from "@/lib/frameLoop"; +import { + BOOT_SWEEP_MS, + BOOT_T0_MS, + BOOT_TICK_MS, + prefersReducedMotion, +} from "@/lib/motion"; import { ButtonLink } from "./Button"; import { Crosses, VRule } from "./Grid"; @@ -21,22 +27,17 @@ import { href } from "./siteData"; // This component only adds two controls on top: Replay, and scrubbing the // clock by dragging across the mark. -const SWEEP_MS = 480; // four ticks of 120 ms, as in the CSS - -// at: when each row flips, t0 (300 ms) + k ticks +// Each row flips at t0 + k ticks const LEGEND = [ - { k: 1, tick: "t1", signal: "bar-1", lo: "low", hi: "high", at: "420ms" }, - { k: 2, tick: "t2", signal: "bar-2", lo: "low", hi: "high", at: "540ms" }, - { k: 3, tick: "t3", signal: "bar-3", lo: "low", hi: "high", at: "660ms" }, - { - k: 4, - tick: "t4", - signal: "³", - lo: "pending", - hi: "on deadline", - at: "780ms", - }, -]; + { k: 1, signal: "bar-1", lo: "low", hi: "high" }, + { k: 2, signal: "bar-2", lo: "low", hi: "high" }, + { k: 3, signal: "bar-3", lo: "low", hi: "high" }, + { k: 4, signal: "³", lo: "pending", hi: "on deadline" }, +].map((row) => ({ + ...row, + tick: `t${row.k}`, + at: `${BOOT_T0_MS + row.k * BOOT_TICK_MS}ms`, +})); const LAYERS = [ { k: 1, d: MARK_BAR_1, cls: styles.l1, fill: styles.ink }, @@ -45,12 +46,15 @@ const LAYERS = [ { k: 4, d: MARK_THREE, cls: styles.l4, fill: styles.accent }, ]; +// The boot clock, for the CSS to time every step from +const CLOCK = { + "--t0": `${BOOT_T0_MS}ms`, + "--tick": `${BOOT_TICK_MS}ms`, +} as CSSProperties; + // Four clock periods across the mark; the last rising edge is the deadline const CLK = "M0 13V1H50V13H100V1H150V13H200V1H250V13H300V1H350V13H400V1"; -const reducedMotion = () => - window.matchMedia("(prefers-reduced-motion: reduce)").matches; - export function Hero() { const root = useRef(null); const mark = useRef(null); @@ -102,7 +106,7 @@ export function Hero() { // loop of its own. Reduced motion skips straight to the end. const finish = () => { cancelFinish(); - if (reducedMotion()) { + if (prefersReducedMotion()) { toStatic(); return; } @@ -110,7 +114,7 @@ export function Hero() { let t0 = -1; stopFinish.current = onFrame((now) => { if (t0 < 0) t0 = now; - const p = Math.min(1, from + (now - t0) / SWEEP_MS); + const p = Math.min(1, from + (now - t0) / BOOT_SWEEP_MS); setP(p); if (p >= 1) { cancelFinish(); @@ -175,6 +179,7 @@ export function Hero() {