diff --git a/src/components/directory-tabs.tsx b/src/components/directory-tabs.tsx index 612dfd6..0bdc386 100644 --- a/src/components/directory-tabs.tsx +++ b/src/components/directory-tabs.tsx @@ -1,41 +1,15 @@ "use client"; - -/** - * The directory on very wide screens: one timeline in sight at a time, - * chosen with tabs (iOS; the Mac, OS X running on into macOS), and beside it - * the latest release. - * - * - The tabs say what is behind them (how many builds, as a tooltip), so - * the one not shown is still found, with number keys as in the Time - * Machine. They sit in the header (sticky); the way into the Time - * Machine heads the column on the right. - * - iOS first: the most releases, and what most visits are about (a Mac - * visitor is as likely to be after iOS). The choice is in the URL - * (?platform=mac, shareable) and remembered for the next visit; a URL's - * wins. - * - The column on the right is always the line's latest release: its - * figures (each a link to what it counts; "+N −M" to what changed), how - * the line grew, and its largest topics as a cloud. Any other build: its - * card, opened beside it in the timeline. - */ - -import { ArrowRight, History } from "lucide-react"; import Link from "next/link"; import { usePathname, useRouter, useSearchParams } from "next/navigation"; import { useEffect, useState } from "react"; import { BetaBadge } from "@/components/beta-badge"; -import { HeaderPortal } from "@/components/header-portal"; import { type Figures, byVersionDesc, useFigures, } from "@/components/latest-releases"; -import { - ReleaseTimeline, - buildKey, - widestRow, -} from "@/components/release-timeline"; +import { ReleaseTimeline, buildKey } from "@/components/release-timeline"; import { changesHref, compact, @@ -58,8 +32,6 @@ export interface DirectoryLine { } const STORAGE_KEY = "entdb:directory-line"; -/** Where this layout starts (min-[1800px] in the classes). */ -const WIDE_PX = 1800; /** The URL's record of the chosen line: ?platform=mac. */ const PARAM = "platform"; @@ -75,7 +47,15 @@ function isTyping(target: EventTarget | null) { ); } -export function DirectoryTabs({ lines }: { lines: DirectoryLine[] }) { +export function DirectoryTabs({ + lines, + toolbar, +}: { + lines: DirectoryLine[]; + /** Above the timeline (and panel), as wide as they are together, given + * the platform tabs to hold. */ + toolbar?: (tabs: React.ReactNode) => React.ReactNode; +}) { const params = useSearchParams(); const router = useRouter(); const pathname = usePathname(); @@ -122,8 +102,6 @@ export function DirectoryTabs({ lines }: { lines: DirectoryLine[] }) { const onKey = (event: KeyboardEvent) => { if (event.metaKey || event.ctrlKey || event.altKey) return; if (isTyping(event.target)) return; - // Only where the tabs are shown (mounted at every width, hidden below). - if (!window.matchMedia(`(min-width: ${WIDE_PX}px)`).matches) return; const next = lines[Number(event.key) - 1]; if (!next) return; event.preventDefault(); @@ -139,7 +117,6 @@ 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. @@ -151,57 +128,60 @@ export function DirectoryTabs({ lines }: { lines: DirectoryLine[] }) { // The tabs: in the header (sticky: the timeline is taller than the // window), centred with the filter; compact, // like the header's other toggles, each line's build count its tooltip. + // The tabs, handed to the toolbar (with the other ways of seeing the + // list) rather than taking a row of their own. + const tabs = ( +