From e7337210b48ed7893602f7c6da82564646c405f6 Mon Sep 17 00:00:00 2001 From: Badcuban <108198679+badcuban@users.noreply.github.com> Date: Tue, 24 Nov 2026 01:15:07 -0500 Subject: [PATCH] feat(web): group nightly What's new changes by type Nightly release notes in What's new listed every change in merge order under each build with repeated left badges, and expanded every earlier build back to the last stable release. Combine fresh nightly changes across builds by type (New, Faster, Security, Fixed, Changed, hiding empty groups) with section headings and counts. Collapse earlier builds by default behind a full-row disclosure header, grouping each earlier build's changes by type when opened. --- .../src/components/WhatsNewDialog.browser.tsx | 21 ++- .../src/components/WhatsNewDialogContent.tsx | 139 ++++++++++++------ apps/web/src/lib/whatsNew.logic.test.ts | 65 ++++++++ apps/web/src/lib/whatsNew.logic.ts | 63 +++++++- 4 files changed, 236 insertions(+), 52 deletions(-) diff --git a/apps/web/src/components/WhatsNewDialog.browser.tsx b/apps/web/src/components/WhatsNewDialog.browser.tsx index 296bcfbde..c2d5ad8a3 100644 --- a/apps/web/src/components/WhatsNewDialog.browser.tsx +++ b/apps/web/src/components/WhatsNewDialog.browser.tsx @@ -83,7 +83,7 @@ describe("What's new", () => { await resetTestPage(); }); - it("lists a nightly's changes since the build you had, then the earlier nightlies", async () => { + it("groups a nightly's changes by type across builds and keeps earlier nightlies closed until opened", async () => { window.desktopBridge = { getPreviousAppVersion: () => "0.8.0-nightly.20261028.352", } as unknown as DesktopBridge; @@ -96,16 +96,23 @@ describe("What's new", () => { await expect .element(list) .toMatchTextContent(/3 changes since build 352, the one you had before/); - await expect.element(list).toMatchTextContent(/FixedA computer on 0\.7\.1 keeps working/); - await expect.element(list).toMatchTextContent(/NewRename computers from the Fleet list/); + // New, then Security, then Fixed across builds 354 and 353 combined. await expect .element(list) - .toMatchTextContent(/SecurityBump hono for the serveStatic path bypass/); + .toMatchTextContent( + /New1Rename computers from the Fleet listSecurity1Bump hono for the serveStatic path bypassFixed1A computer on 0\.7\.1 keeps working/, + ); await expect.element(list).not.toMatchTextContent(/Fleet video/); - // The menu's newest stable release before this nightly is 0.7.1. + // Earlier builds start closed and open on click. const earlier = page.getByTestId("whats-new-nightly-earlier"); - await expect.element(earlier).toMatchTextContent(/Earlier builds since v0\.7\.1/); - await expect.element(earlier).toMatchTextContent(/Build 352.*FixedOlder/); + const earlierTrigger = earlier.getByRole("button", { name: /Earlier builds since v0\.7\.1/ }); + await expect.element(earlierTrigger).toHaveAttribute("aria-expanded", "false"); + await expect.element(earlierTrigger).toMatchTextContent(/Newest build · 1 change/); + await expect.element(earlier.getByText("Build 352")).not.toBeInTheDocument(); + + await earlierTrigger.click(); + await expect.element(earlierTrigger).toHaveAttribute("aria-expanded", "true"); + await expect.element(earlier).toMatchTextContent(/Build 352.*Fixed1Older/); expect(fetchSpy).toHaveBeenCalledTimes(1); }); diff --git a/apps/web/src/components/WhatsNewDialogContent.tsx b/apps/web/src/components/WhatsNewDialogContent.tsx index 8d6129cee..c4836a747 100644 --- a/apps/web/src/components/WhatsNewDialogContent.tsx +++ b/apps/web/src/components/WhatsNewDialogContent.tsx @@ -12,7 +12,7 @@ import { RELEASE_NOTES_SITE_URL, type ReleaseNotesEntry, } from "@threadlines/shared/releaseNotes"; -import { PlayIcon } from "lucide-react"; +import { ChevronRightIcon, PlayIcon } from "lucide-react"; import { useState } from "react"; import releaseNotes from "virtual:release-notes"; @@ -21,14 +21,18 @@ import { openExternalUrl } from "../lib/externalLinks"; import { readPreviousAppVersion, useNightlyBuilds } from "../lib/whatsNew"; import { describeBuild, + describeEarlierBuildsSummary, describeNightlyLead, + groupNightlyChanges, type NightlyBuildChanges, + type NightlyChangeGroup, planNightlyList, releaseChangeTag, releaseNotesUpTo, splitNightlyBuilds, } from "../lib/whatsNew.logic"; import { Button } from "./ui/button"; +import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "./ui/collapsible"; import { DialogFooter, DialogHeader, DialogPanel, DialogPopup, DialogTitle } from "./ui/dialog"; import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "./ui/select"; import { closeWhatsNewDialog } from "./WhatsNewDialog"; @@ -198,8 +202,9 @@ function ReleaseVideo({ video }: { readonly video: NonNullable 0; + const freshGroups = groupNightlyChanges(fresh); const earlierWithChanges = earlier.filter((build) => build.changes.length > 0); return ( -
+

{describeNightlyLead({ fresh, since, freshComplete, appVersion: APP_VERSION })}

- {fresh - .filter((build) => build.changes.length > 0) - .map((build) => ( - - ))} + {freshGroups.length > 0 ? : null} {earlierWithChanges.length > 0 ? ( -
-

- {range.after === null - ? "Earlier builds" - : `Earlier builds since ${describeBuild(range.after)}`} -

- {earlierWithChanges.map((build) => ( - - ))} -
- ) : null} - {!complete && freshComplete ? ( + + + + +
+ {earlierWithChanges.map((build) => ( + + ))} + {!complete && freshComplete ? ( +

Older builds are on GitHub.

+ ) : null} +
+
+
+ ) : !complete && freshComplete ? (

Older builds are on GitHub.

) : null}
); } +function changeKindHeadingClass(kind: NightlyChangeGroup["kind"]): string { + switch (kind) { + case "new": + return "text-primary-readable"; + case "security": + return "text-warning-foreground"; + default: + return "text-foreground"; + } +} + +function NightlyChangeGroups({ + groups, + compact = false, +}: { + readonly groups: ReadonlyArray; + readonly compact?: boolean; +}) { + const Heading = compact ? "h5" : "h3"; + return ( +
+ {groups.map((group) => ( +
+ + + {releaseChangeTag(group.kind)} + + + {group.items.length} + + +
    + {group.items.map(({ build, change }, index) => ( +
  • + {change.text} +
  • + ))} +
+
+ ))} +
+ ); +} + function NightlyBuildSection({ build }: { readonly build: NightlyBuildChanges }) { const day = build.publishedAt?.slice(0, 10); + const groups = groupNightlyChanges([build]); return ( -
+

Build {build.build} {day ? ` · ${formatReleaseDay(day)}` : ""}

-
    - {build.changes.map((change) => { - const tag = releaseChangeTag(change.kind); - return ( -
  • - - {tag} - - {change.text} -
  • - ); - })} -
+
); } diff --git a/apps/web/src/lib/whatsNew.logic.test.ts b/apps/web/src/lib/whatsNew.logic.test.ts index 01cc0504c..e1213b6b1 100644 --- a/apps/web/src/lib/whatsNew.logic.test.ts +++ b/apps/web/src/lib/whatsNew.logic.test.ts @@ -1,9 +1,11 @@ import { describe, expect, it } from "vite-plus/test"; import { + describeEarlierBuildsSummary, describeNightlyLead, describeNightlyUpdate, describeWaitingUpdate, + groupNightlyChanges, type NightlyBuildChanges, nightlyReleasesPageSize, planNightlyList, @@ -153,4 +155,67 @@ describe("a nightly's list", () => { ); expect(notice([build(357, [])])).toBeNull(); }); + + it("groups nightly changes across builds by type in display order and summarizes earlier builds", () => { + const builds: ReadonlyArray = [ + { + version: "0.8.1-nightly.20261030.358", + build: 358, + publishedAt: null, + url: "", + changes: [ + { kind: "fixed", text: "Newest fix" }, + { kind: "changed", text: "Fallback change" }, + { kind: "new", text: "Newest feature" }, + ], + }, + { + version: "0.8.1-nightly.20261029.357", + build: 357, + publishedAt: null, + url: "", + changes: [ + { kind: "security", text: "Patch advisory" }, + { kind: "fixed", text: "Older fix" }, + { kind: "faster", text: "Cut redraw cost" }, + { kind: "new", text: "Older feature" }, + ], + }, + ]; + + expect( + groupNightlyChanges(builds).map((group) => ({ + kind: group.kind, + items: group.items.map((item) => [item.build, item.change.text]), + })), + ).toEqual([ + { + kind: "new", + items: [ + [358, "Newest feature"], + [357, "Older feature"], + ], + }, + { kind: "faster", items: [[357, "Cut redraw cost"]] }, + { kind: "security", items: [[357, "Patch advisory"]] }, + { + kind: "fixed", + items: [ + [358, "Newest fix"], + [357, "Older fix"], + ], + }, + { kind: "changed", items: [[358, "Fallback change"]] }, + ]); + + expect(groupNightlyChanges([build(357, ["Only fix"])]).map((group) => group.kind)).toEqual([ + "fixed", + ]); + expect(describeEarlierBuildsSummary(builds)).toBe("2 builds · 7 changes"); + expect(describeEarlierBuildsSummary([build(357, ["Only fix"])])).toBe("1 build · 1 change"); + expect(describeEarlierBuildsSummary(builds, false)).toBe("Newest 2 builds · 7 changes"); + expect(describeEarlierBuildsSummary([build(357, ["Only fix"])], false)).toBe( + "Newest build · 1 change", + ); + }); }); diff --git a/apps/web/src/lib/whatsNew.logic.ts b/apps/web/src/lib/whatsNew.logic.ts index 7ffa197f4..7db541a36 100644 --- a/apps/web/src/lib/whatsNew.logic.ts +++ b/apps/web/src/lib/whatsNew.logic.ts @@ -214,7 +214,68 @@ export function describeWaitingUpdate(input: { return nightly.complete ? `${changes} since yours` : `${changes} in the newest builds`; } -/** The tag a change wears in the nightly list. */ +/** The order type groups show in the nightly list: shorter sections above Fixed. */ +export const NIGHTLY_CHANGE_KIND_ORDER: ReadonlyArray = [ + "new", + "faster", + "security", + "fixed", + "changed", +]; + +/** One change in a type-grouped nightly list, keeping the build it landed in. */ +export interface NightlyGroupedChange { + readonly build: number; + readonly change: ReleaseChange; +} + +/** Changes of one kind across one or more nightly builds, in build order. */ +export interface NightlyChangeGroup { + readonly kind: ReleaseChange["kind"]; + readonly items: ReadonlyArray; +} + +/** + * Groups changes across nightly builds by kind in display order, omitting + * empty kinds. Preserves the order of builds (newest first) and changes + * within each build. + */ +export function groupNightlyChanges( + builds: ReadonlyArray, +): ReadonlyArray { + const byKind = new Map>(); + for (const build of builds) { + for (const change of build.changes) { + let bucket = byKind.get(change.kind); + if (!bucket) { + bucket = []; + byKind.set(change.kind, bucket); + } + bucket.push({ build: build.build, change }); + } + } + return NIGHTLY_CHANGE_KIND_ORDER.flatMap((kind) => { + const items = byKind.get(kind); + return items && items.length > 0 ? [{ kind, items }] : []; + }); +} + +/** Short summary shown on the collapsed earlier-builds row. */ +export function describeEarlierBuildsSummary( + builds: ReadonlyArray, + complete = true, +): string { + const buildLabel = complete + ? builds.length === 1 + ? "1 build" + : `${builds.length} builds` + : builds.length === 1 + ? "Newest build" + : `Newest ${builds.length} builds`; + return `${buildLabel} · ${changeCount(countChanges(builds))}`; +} + +/** The heading a change kind wears in the nightly list. */ export function releaseChangeTag(kind: ReleaseChange["kind"]): string { switch (kind) { case "new":