feat(header,home): one header for every size; a slimmer home page

Header
- The logo always leftmost; the filter beside it with the icons in the
  corner; the page's controls on a second row below lg, in line from lg;
  the filter centred from 2xl, each page's at a set width.
- Every control one height (h-9); the platform filter a segmented control
  like its neighbours, in the header at every width.
- Major Releases / All Builds is one toggle, "All builds" (?view=all).

Home
- Below 1800px no latest-release lines (the grid opens on those
  releases): only the way into the Time Machine, a grid card wide.
- 1800px and up: the timeline as wide as its widest row and centred with
  the panel, so switching lines moves nothing and short rows leave no
  empty stretch.
- Skeletons follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ccandClaude Opus 5.5 committed 2026-12-04 19:56:00 +01:00
1 parent f891a5f918
commit 6805a003c9
9 files changed
+195 -334

No files matched your search

+1 -1
View File
@@ -48,7 +48,7 @@ export default function Files() {
const filterControls = (
<>
<div className="relative flex-1 sm:flex-none sm:w-96">
<div className="relative min-w-0 flex-1 2xl:w-[32rem] 2xl:flex-none">
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
<Input
type="text"
+1 -1
View File
@@ -374,7 +374,7 @@ export default function FindByKey() {
const filterControls = (
<>
<div className="relative w-full">
<div className="relative w-full 2xl:w-[32rem]">
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
<Input
id={FILTER_INPUT_ID}
+1 -1
View File
@@ -623,7 +623,7 @@ export default function Keys() {
}, [loading]);
const filterControls = (
<div className="relative w-full">
<div className="relative w-full 2xl:w-[32rem]">
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
<Input
id={FILTER_INPUT_ID}
+17 -4
View File
@@ -31,7 +31,11 @@ import {
byVersionDesc,
useFigures,
} from "@/components/latest-releases";
import { ReleaseTimeline, buildKey } from "@/components/release-timeline";
import {
ReleaseTimeline,
buildKey,
widestRow,
} from "@/components/release-timeline";
import {
changesHref,
compact,
@@ -135,6 +139,7 @@ export function DirectoryTabs({ lines }: { lines: DirectoryLine[] }) {
);
if (!line) return null;
const widest = widestRow(lines.map((l) => l.sources));
const head = line.sources[0];
const latest = head ? [...head.list].sort(byVersionDesc)[0] : undefined;
// The whole line, oldest first (OS X, then macOS), for the growth chart.
@@ -156,7 +161,7 @@ export function DirectoryTabs({ lines }: { lines: DirectoryLine[] }) {
<div
role="tablist"
aria-label="Platform"
className="order-first hidden shrink-0 rounded-lg border border-border bg-muted/30 p-1 min-[1800px]:inline-flex"
className="order-first hidden h-9 shrink-0 items-stretch rounded-lg border border-border bg-muted/30 p-[3px] min-[1800px]:inline-flex"
>
{lines.map((l, n) => {
const active = l === line;
@@ -172,7 +177,7 @@ export function DirectoryTabs({ lines }: { lines: DirectoryLine[] }) {
title={`${count} builds (${n + 1})`}
onClick={() => choose(l.id)}
className={cn(
"rounded-md px-3 py-1 text-sm transition-colors",
"flex items-center rounded-md px-3 text-sm transition-colors",
active
? "bg-background font-medium text-foreground shadow-sm"
: "text-muted-foreground hover:text-foreground",
@@ -184,11 +189,19 @@ export function DirectoryTabs({ lines }: { lines: DirectoryLine[] }) {
})}
</div>
</HeaderPortal>
<div className="grid grid-cols-[minmax(0,1fr)_26rem] items-start gap-x-8 min-[2400px]:grid-cols-[minmax(0,1fr)_minmax(0,0.6fr)]">
{/* Timeline and panel centred together, each its own width: the
timeline as wide as the widest row of either line (switching
lines moves nothing; no empty stretch where a line's rows are
short), the panel fixed. Widths are the timeline's own
(release-timeline.tsx): a build 6.5rem + 0.25rem gap, the axis
6.5rem + 1.5rem gap; a size up from 2400px. */}
<div className="grid grid-cols-[auto_26rem] items-start justify-center gap-x-10 min-[2400px]:grid-cols-[auto_40rem] min-[2400px]:gap-x-16">
<section
id={`timeline-${line.id}`}
role="tabpanel"
aria-label={line.title}
className="[--axis:8rem] [--leaf:6.75rem] min-[2400px]:[--axis:9.5rem] min-[2400px]:[--leaf:8.875rem]"
style={{ width: `calc(${widest} * var(--leaf) + var(--axis))` }}
>
<ReleaseTimeline
key={line.id}
+12 -35
View File
@@ -2,9 +2,9 @@
* The home page while its lists load, shaped like each layout it becomes
* (oslist.tsx), so nothing jumps when they arrive:
*
* - Phones: the platform buttons, the one-line Time Machine, the grid.
* - Up to very wide: the latest-release cards and the Time Machine card,
* then a grid per platform.
* - Phones: the one-line Time Machine, the grid (the platform filter is
* in the header).
* - Up to very wide: the Time Machine line, then a grid per platform.
* - Very wide screens: rows of builds set against the axis, the version
* labels, and the panel beside (the tabs are in the header).
*
@@ -41,36 +41,8 @@ export function HomeSkeleton({
<div aria-busy="true" aria-label="Loading builds">
{/* Up to very wide screens. */}
<div className="min-[1800px]:hidden">
{/* Phones: the platform buttons. */}
<div className="mb-4 flex items-center gap-1 sm:hidden">
{[8, 12, 10].map((w) => (
<Skeleton
key={w}
className="h-7 rounded-md"
style={{ width: `${w * 4}px` }}
/>
))}
</div>
<div className="mx-auto mb-6 grid max-w-[80rem] gap-3 sm:mb-8 md:grid-cols-2 xl:grid-cols-3">
{[0, 1].map((i) => (
<div
key={i}
className="hidden flex-col rounded-xl border border-border/50 p-5 sm:flex"
>
<Skeleton className="h-3 w-20" />
<Skeleton className="mt-2 h-8 w-24" />
<Skeleton className="mt-1.5 h-4 w-40" />
<div className="mt-4 grid grid-cols-3 gap-2">
{[0, 1, 2].map((j) => (
<div key={j}>
<Skeleton className="h-3 w-10" />
<Skeleton className="mt-1.5 h-5 w-14" />
</div>
))}
</div>
<Skeleton className="mt-4 h-4 w-24" />
</div>
))}
{/* The way into the Time Machine (static: the real one). */}
<div className="mx-auto mb-6 max-w-[80rem] sm:mb-8">
<TimeMachineCard />
</div>
{SECTIONS.map(({ cards, codenames }, s) => (
@@ -103,8 +75,13 @@ export function HomeSkeleton({
{/* Very wide screens: as directory-tabs.tsx and release-timeline.tsx. */}
<div className="hidden min-[1800px]:block">
<div className="grid grid-cols-[minmax(0,1fr)_26rem] items-start gap-x-8 min-[2400px]:grid-cols-[minmax(0,1fr)_minmax(0,0.6fr)]">
<ol>
<div className="grid grid-cols-[auto_26rem] items-start justify-center gap-x-10 min-[2400px]:grid-cols-[auto_40rem] min-[2400px]:gap-x-16">
<ol
className="[--axis:8rem] [--leaf:6.75rem] min-[2400px]:[--axis:9.5rem] min-[2400px]:[--leaf:8.875rem]"
style={{
width: `calc(${Math.max(...ROWS)} * var(--leaf) + var(--axis))`,
}}
>
{ROWS.map((count, i) => (
<li
// biome-ignore lint/suspicious/noArrayIndexKey: static placeholder rows
+21 -182
View File
@@ -1,44 +1,24 @@
"use client";
/**
* The top of the home page: each live platform's latest release, the way
* most visits go, with its figures and the ways into it; and the Time
* Machine. Not OS X: it ended at 10.15.7, its latest will never change.
*
* Three across on wide screens, two below. Phones: no latest cards (the
* grid right below opens on those very releases) and the Time Machine a
* single line, so the directory starts on the first screen.
*
* The cards render from the release lists the page already has. The
* figures (keys, files, change since the previous release) come from each
* platform's stats.json, hundreds of KB: fetched after the page is up, and
* faded in.
* Latest releases' figures (keys, files, change since the previous build),
* from each platform's stats.json (hundreds of KB: fetched once the page is
* up), for the very wide directory (directory-tabs.tsx); and the line into
* the Time Machine shown above the grid on smaller screens.
*/
import { createEngine } from "@/lib/engine";
import type { BuildStats } from "@/lib/engine/types";
import type { OS } from "@/lib/types";
import { ArrowRight, History } from "lucide-react";
import Link from "next/link";
import { useEffect, useState } from "react";
import { BetaBadge } from "@/components/beta-badge";
import { compact, keysHref } from "@/components/time-machine/data";
import { Skeleton } from "@/components/ui/skeleton";
import { createEngine } from "@/lib/engine";
import type { BuildStats } from "@/lib/engine/types";
import { versionTag } from "@/lib/os-version";
import type { Group, OS } from "@/lib/types";
import { cn } from "@/lib/utils";
export interface Figures {
stats: BuildStats;
previous: OS | null;
}
const PLATFORM_NAMES: Record<string, string> = {
iOS: "iOS",
mac: "macOS",
osx: "OS X",
};
/** Newest first, by version number. */
export function byVersionDesc(a: OS, b: OS) {
const x = a.version.split(".").map(Number);
@@ -87,172 +67,31 @@ export function useFigures(groups: string[]) {
return figures;
}
/** Platforms that are over: no "latest" for them. */
const RETIRED = new Set(["osx"]);
export function LatestReleases({ groups }: { groups: Group[] }) {
const live = groups.filter((g) => !RETIRED.has(g.name));
const figures = useFigures(live.map((g) => g.name));
/**
* Up to very wide screens, above the grid: just the way into the Time
* Machine. The latest releases need no line of their own: the grid opens
* on them. (Very wide screens: directory-tabs.tsx.)
*/
export function LatestReleases() {
return (
<div className="mx-auto mb-6 grid max-w-[80rem] gap-3 sm:mb-8 md:grid-cols-2 xl:grid-cols-3">
{live.map((group) => {
const newest = [...group.list].sort(byVersionDesc);
const latest = newest[0];
if (!latest) return null;
const stable = latest.beta ? newest.find((os) => !os.beta) : undefined;
return (
<LatestCard
key={group.name}
group={group.name}
os={latest}
stable={stable}
figures={figures[`${group.name}/${latest.build}`]}
/>
);
})}
<div className="mx-auto mb-6 max-w-[80rem] sm:mb-8">
<TimeMachineCard />
</div>
);
}
export function LatestCard({
group,
os,
stable,
figures,
}: {
group: string;
os: OS;
stable?: OS;
figures?: Figures;
}) {
const platform = PLATFORM_NAMES[group] ?? group;
const codename = os.name.endsWith(os.version) ? null : os.name;
const tag = encodeURIComponent(`${group}/${versionTag(os)}`);
return (
<article
className={cn(
// Phones: not shown (see above).
"group relative hidden flex-col rounded-xl border p-5 transition-colors hover:bg-accent/40 sm:flex",
os.beta
? "border-amber-400/50 hover:border-amber-500/70 dark:border-amber-500/40"
: "hover:border-foreground/20",
)}
>
<div className="text-xs font-medium uppercase tracking-wide text-muted-foreground">
Latest {platform}
</div>
<h2 className="mt-1 flex items-center gap-2">
{/* The whole card opens its keys; the links below sit above it. */}
<Link
data-nav-item
href={keysHref(group, os)}
className="text-3xl font-semibold tabular-nums after:absolute after:inset-0 after:rounded-xl focus-visible:outline-none"
>
{os.version}
</Link>
{os.beta && <BetaBadge />}
</h2>
<div className="mt-0.5 flex min-w-0 items-baseline gap-2 text-sm text-muted-foreground">
{codename && (
<span className="truncate text-foreground/80">{codename}</span>
)}
<span className="shrink-0 font-mono text-xs">{os.build}</span>
</div>
<dl className="mt-4 hidden grid-cols-3 gap-2 text-sm sm:grid">
<Figure label="Keys" value={figures && compact(figures.stats.keys)} />
<Figure
label="Files"
value={figures && compact(figures.stats.binaries)}
/>
<Figure
label={
figures?.previous ? `Since ${figures.previous.version}` : "Change"
}
value={
figures &&
(figures.previous ? (
<span>
<span className="text-emerald-600 dark:text-emerald-400">
+{figures.stats.added.length}
</span>{" "}
<span className="text-red-600 dark:text-red-400">
−{figures.stats.removed.length}
</span>
</span>
) : (
"—"
))
}
/>
</dl>
<div className="relative z-10 mt-4 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm">
<Link
href={keysHref(group, os)}
className="font-medium text-primary hover:underline"
>
Keys
</Link>
<Link
href={`/os/files?os=${tag}`}
className="text-muted-foreground hover:text-foreground hover:underline"
>
Files
</Link>
{stable && (
<Link
href={keysHref(group, stable)}
className="ml-auto text-muted-foreground hover:text-foreground hover:underline"
>
Stable: {stable.version}
</Link>
)}
</div>
</article>
);
}
function Figure({ label, value }: { label: string; value?: React.ReactNode }) {
return (
<div className="min-w-0">
<dt className="truncate text-xs text-muted-foreground">{label}</dt>
<dd className="text-lg font-semibold tabular-nums">
{value === undefined ? (
<Skeleton className="mt-1 h-5 w-14" />
) : (
<span className="animate-in fade-in duration-300">{value}</span>
)}
</dd>
</div>
);
}
/** The way into the Time Machine (a full-screen journey), in its starfield. */
export function TimeMachineCard({ className }: { className?: string } = {}) {
/** The way into the Time Machine, one line in its starfield (about a grid
* card wide; phones: the full width). */
export function TimeMachineCard() {
return (
<Link
href="/time-machine"
className={cn(
// Phones: one line (icon, name, arrow); larger: a card.
"depth-banner group relative flex items-center gap-3 overflow-hidden rounded-xl border px-4 py-3 transition-colors hover:border-primary/50 sm:flex-col sm:items-start sm:gap-0 sm:p-5",
className ?? "md:col-span-2 xl:col-span-1",
)}
className="depth-banner group relative flex items-center gap-2.5 overflow-hidden rounded-xl border px-4 py-2.5 text-sm font-medium transition-colors hover:border-primary/50 sm:max-w-xs"
>
<span className="depth-stars" aria-hidden="true" />
<History className="relative h-5 w-5 shrink-0 text-primary sm:h-6 sm:w-6" />
<span className="relative block flex-1 font-semibold sm:mt-3 sm:flex-none sm:text-lg">
Time Machine
</span>
<span className="relative mt-1 hidden flex-1 text-sm text-muted-foreground sm:block">
Travel through every release in 3D: what each one added and removed, and
how the platforms grew.
</span>
<span className="relative inline-flex items-center gap-1 text-sm font-medium text-primary sm:mt-4">
<span className="hidden sm:inline">Start</span>
<ArrowRight className="h-4 w-4 transition-transform group-hover:translate-x-1" />
</span>
<History className="relative h-4 w-4 shrink-0 text-primary" />
<span className="relative flex-1">Time Machine</span>
<ArrowRight className="relative h-4 w-4 text-muted-foreground transition-transform group-hover:translate-x-0.5" />
</Link>
);
}
+72 -70
View File
@@ -1,7 +1,8 @@
"use client";
import { goHome } from "@/lib/navigate";
import { Folder, Key, Moon, Sun } from "lucide-react";
import { cn } from "@/lib/utils";
import { Folder, Key, Layers, Moon, Sun } from "lucide-react";
import { useTheme } from "next-themes";
import Link from "next/link";
import { usePathname, useSearchParams } from "next/navigation";
@@ -53,12 +54,12 @@ function OSBreadcrumb({
<VersionSwitcher currentOs={os} />
</div>
<div className="inline-flex rounded-lg border border-border p-1 bg-muted/30 shrink-0">
<div className="inline-flex h-9 shrink-0 items-stretch rounded-lg border border-border bg-muted/30 p-[3px]">
<Link
href={`/os/keys?os=${os}`}
aria-label="Keys"
title="Entitlement keys"
className={`flex items-center gap-1 px-2 py-1 text-sm rounded-md transition-colors whitespace-nowrap ${
className={`flex items-center gap-1 px-2 text-sm rounded-md transition-colors whitespace-nowrap ${
currentPage === "keys"
? "bg-background text-foreground shadow-sm font-medium"
: "text-muted-foreground hover:text-foreground"
@@ -71,7 +72,7 @@ function OSBreadcrumb({
href={`/os/files?os=${os}`}
aria-label="Files"
title="Binaries by path"
className={`flex items-center gap-1 px-2 py-1 text-sm rounded-md transition-colors whitespace-nowrap ${
className={`flex items-center gap-1 px-2 text-sm rounded-md transition-colors whitespace-nowrap ${
currentPage === "files"
? "bg-background text-foreground shadow-sm font-medium"
: "text-muted-foreground hover:text-foreground"
@@ -85,41 +86,38 @@ function OSBreadcrumb({
);
}
function HomeControls() {
/**
* Every build, or only each major's releases (the default): one toggle,
* "All builds", on or off; a link (?view=all), so it can be opened or
* copied. Like the keys page's "Changed only". Very wide screens: the home
* page is a timeline with every build either way, so it's hidden there.
*/
function AllBuildsToggle() {
const searchParams = useSearchParams();
const view = searchParams.get("view");
const options = [
{ href: "/", label: "Major Releases", active: !view },
{ href: "/?view=all", label: "All Builds", active: view === "all" },
];
const on = searchParams.get("view") === "all";
return (
// Very wide screens: the home page is a timeline with every build
// either way (directory-tabs.tsx), so there's nothing to toggle.
<div className="inline-flex rounded-lg border border-border p-1 bg-muted/30 min-[1800px]:hidden">
{options.map(({ href, label, active }) => (
<Link
key={href}
href={href}
// "/" after a directly loaded /?view=…: see goHome().
onClick={
href === "/"
? (event) => {
if (goHome()) event.preventDefault();
}
: undefined
}
aria-current={active ? "page" : undefined}
className={`px-3 py-1 text-sm rounded-md transition-colors ${
active
? "bg-background text-foreground shadow-sm font-medium"
: "text-muted-foreground hover:text-foreground"
}`}
>
{label}
</Link>
))}
</div>
<Link
href={on ? "/" : "/?view=all"}
// "/" after a directly loaded /?view=…: see goHome().
onClick={
on
? (event) => {
if (goHome()) event.preventDefault();
}
: undefined
}
aria-current={on ? "page" : undefined}
title={on ? "Showing every build" : "Show every build"}
className={cn(
"inline-flex h-9 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-lg border px-3 text-sm transition-colors min-[1800px]:hidden",
on
? "border-primary/40 bg-primary/15 font-medium text-foreground"
: "border-border text-muted-foreground hover:bg-accent/50 hover:text-foreground",
)}
>
<Layers className="h-3.5 w-3.5" />
All builds
</Link>
);
}
@@ -150,47 +148,51 @@ export function NavTop() {
// Glass, no border: content scrolling under it shows through, blurred,
// which marks the edge; nearly opaque where blur isn't supported.
<header className="sticky top-0 z-50 shrink-0 bg-background/95 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-xl supports-[backdrop-filter]:backdrop-saturate-150">
{/* Large screens: three columns, the filter centred between the page
controls (left) and the icons (right). */}
<div className="flex flex-wrap items-center gap-x-4 gap-y-2 px-4 md:px-6 py-3 2xl:grid 2xl:grid-cols-[minmax(0,1fr)_minmax(0,36rem)_minmax(0,1fr)]">
{/* Left group: logo + breadcrumb + left portal */}
<div className="flex items-center gap-4 min-w-0 flex-wrap">
<h1 className="text-xl font-bold shrink-0">
{/*
Four pieces: the logo, the page's controls (All builds and the
platform; a release's version and Keys/Files), the filter, the icons.
- Below lg: row 1 is the logo, the filter across, the icons (the
theme toggle in the corner); row 2, the page's controls.
- lg: one row, logo and page controls, the filter, the icons.
- 2xl: three columns, the filter centred.
The logo and page controls share a wrapper that is only a box from
lg ("contents" below, so each takes its own place in the rows).
Controls share one height (h-9) so everything lines up.
*/}
<div className="flex flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3 md:px-6 lg:flex-nowrap 2xl:grid 2xl:grid-cols-[minmax(0,1fr)_minmax(0,40rem)_minmax(0,1fr)]">
<div className="contents lg:flex lg:min-w-0 lg:items-center lg:gap-4 2xl:col-start-1">
<h1 className="order-1 shrink-0 text-xl font-bold lg:order-none">
<Link
href="/"
className="hover:text-muted-foreground transition-colors"
className="transition-colors hover:text-muted-foreground"
>
entdb
</Link>
</h1>
{isHome && <HomeControls />}
{isHome && (
<div
id={HEADER_PORTAL_LEFT_ID}
className="hidden sm:flex items-center"
/>
)}
{isOSPage && os && <OSBreadcrumb os={os} currentPage={currentPage} />}
<div className="order-4 flex w-full min-w-0 items-center gap-2 lg:order-none lg:w-auto">
{isHome && <AllBuildsToggle />}
{isHome && (
<div
id={HEADER_PORTAL_LEFT_ID}
className="flex shrink-0 items-center"
/>
)}
{isOSPage && os && (
<OSBreadcrumb os={os} currentPage={currentPage} />
)}
</div>
</div>
{/* Filter sits next to the page controls (not pushed to the far edge,
which left a wide gap on large screens); the theme toggle takes
the far right. Wraps to its own row when there's no room. */}
{/* With a filter it needs room to be usable, so it takes its own
row rather than shrinking to a few letters. */}
<div
className={`flex flex-1 items-center gap-2 2xl:contents ${showHeaderControls ? "min-w-[18rem]" : ""}`}
>
{showHeaderControls && (
<div
id={HEADER_PORTAL_ID}
className="flex min-w-0 max-w-xl flex-1 items-center gap-2 2xl:col-start-2 2xl:max-w-none 2xl:justify-center"
/>
)}
<div className="ml-auto flex items-center 2xl:col-start-3 2xl:justify-self-end">
<KeyboardShortcuts os={os} />
<ThemeToggle />
</div>
{showHeaderControls && (
<div
id={HEADER_PORTAL_ID}
className="order-2 flex min-w-0 flex-1 items-center gap-2 lg:max-w-xl 2xl:col-start-2 2xl:max-w-none 2xl:flex-none 2xl:justify-self-center"
/>
)}
<div className="order-3 ml-auto flex shrink-0 items-center 2xl:col-start-3 2xl:justify-self-end">
<KeyboardShortcuts os={os} />
<ThemeToggle />
</div>
</div>
</header>
+58 -40
View File
@@ -262,7 +262,7 @@ export default function OSList() {
>
{/* The filter is usable before the list loads (no header shift). */}
<HeaderPortal>
<div className="relative min-w-0 flex-1 sm:max-w-80">
<div className="relative min-w-0 flex-1 2xl:w-80 2xl:flex-none">
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
<Input
type="text"
@@ -309,47 +309,18 @@ export default function OSList() {
{!loading && groups.length > 0 && (
<>
{/* Platform buttons - in header on desktop, inline on mobile */}
{/* Platform filter: in the header beside the filter (a segmented
control, like its neighbours), at every width. Very wide
screens: the directory's tabs choose instead. */}
<HeaderPortal position="left">
{/* Very wide screens: the directory's tabs choose instead. */}
<div className="flex items-center gap-1 min-[1800px]:hidden">
{groups.map((group) => (
<button
type="button"
key={group.name}
onClick={() => togglePlatform(group.name)}
aria-pressed={selectedPlatform === group.name}
className={`px-2 py-1 text-sm rounded-md transition-colors ${
selectedPlatform === group.name
? "bg-foreground text-background font-medium"
: "text-muted-foreground hover:text-foreground hover:bg-accent/50"
}`}
>
{getPlatformName(group.name)}
</button>
))}
</div>
<PlatformFilter
className="min-[1800px]:hidden"
groups={groups}
selected={selectedPlatform}
onToggle={togglePlatform}
/>
</HeaderPortal>
{/* Mobile platform buttons - shown inline in content */}
<div className="flex sm:hidden items-center gap-1 mb-4">
{groups.map((group) => (
<button
type="button"
key={group.name}
onClick={() => togglePlatform(group.name)}
aria-pressed={selectedPlatform === group.name}
className={`px-2 py-1 text-sm rounded-md transition-colors ${
selectedPlatform === group.name
? "bg-foreground text-background font-medium"
: "text-muted-foreground hover:text-foreground hover:bg-accent/50"
}`}
>
{getPlatformName(group.name)}
</button>
))}
</div>
{isFiltering ? (
<div className="mb-3 text-sm text-muted-foreground">
{filteredCount} of {totalCount} builds
@@ -359,7 +330,7 @@ export default function OSList() {
// the Time Machine.
// (Very wide screens: under the directory's tabs instead.)
<div className="min-[1800px]:hidden">
<LatestReleases groups={groups} />
<LatestReleases />
</div>
)}
@@ -481,3 +452,50 @@ export default function OSList() {
</div>
);
}
/**
* Show one platform (or all: pressing the shown one again). A segmented
* control styled like the header's others (Major Releases / All Builds,
* Keys / Files), so they line up: same track, padding and height.
*/
function PlatformFilter({
groups,
selected,
onToggle,
className,
}: {
groups: Group[];
selected: string | null;
onToggle: (name: string) => void;
className?: string;
}) {
return (
<fieldset
className={cn(
"m-0 min-w-0 inline-flex h-9 shrink-0 items-stretch rounded-lg border border-border bg-muted/30 p-[3px]",
className,
)}
>
<legend className="sr-only">Platform</legend>
{groups.map((group) => {
const active = selected === group.name;
return (
<button
type="button"
key={group.name}
onClick={() => onToggle(group.name)}
aria-pressed={active}
className={cn(
"flex items-center rounded-md px-2.5 text-sm transition-colors sm:px-3",
active
? "bg-background font-medium text-foreground shadow-sm"
: "text-muted-foreground hover:text-foreground",
)}
>
{getPlatformName(group.name)}
</button>
);
})}
</fieldset>
);
}
+12
View File
@@ -71,6 +71,18 @@ function stopsOf(group: string, list: OS[]): Stop[] {
return stops.reverse();
}
/** The most builds any version of these lines has (the widest row). */
export function widestRow(lines: { group: string; list: OS[] }[][]) {
return Math.max(
1,
...lines.flatMap((sources) =>
sources.flatMap(({ group, list }) =>
stopsOf(group, list).map((stop) => stop.builds.length),
),
),
);
}
/**
* How long the pointer must rest on a build before its card opens: longer
* than crossing a build on the way somewhere (tens of ms), short enough to