Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: what's new toast and entry points

ogsamratd4ad01bb23b3
diff --git a/apps/app/src/i18n/locales/en.ts b/apps/app/src/i18n/locales/en.ts
index 0d0a47b7..ad94e7eb 100644
--- a/apps/app/src/i18n/locales/en.ts
+++ b/apps/app/src/i18n/locales/en.ts
@@ -2151,7 +2151,9 @@ export default {
"whats_new.group_fixed": "Fixed",
"whats_new.all_releases": "All releases",
"whats_new.release_count": "{count} releases · newest first",
- "whats_new.updated_toast": "Updated to {version} — see what's new",
+ "whats_new.updated_title": "Updated to {version}",
+ "whats_new.later": "Later",
+ "whats_new.close": "Close",
"whats_new.palette_detail": "Release notes for {version} and earlier",
"whats_new.unseen": "New",
} as const;
diff --git a/apps/app/src/react-app/domains/session/editor/ide-chrome.tsx b/apps/app/src/react-app/domains/session/editor/ide-chrome.tsx
index 34730f83..1e552d3b 100644
--- a/apps/app/src/react-app/domains/session/editor/ide-chrome.tsx
+++ b/apps/app/src/react-app/domains/session/editor/ide-chrome.tsx
@@ -6,7 +6,7 @@
* button, and the app destinations at the foot of the activity rail.
*/
import type { ReactNode } from "react";
-import { Check, ChevronDown, Code2, Folder, MessageSquare, MessageSquareOff, MoreHorizontal, Plus, Settings } from "lucide-react";
+import { Check, ChevronDown, Code2, Folder, MessageSquare, MessageSquareOff, MoreHorizontal, Plus, Settings, Sparkles } from "lucide-react";
import { Button } from "@/components/ui/button";
import {
@@ -20,6 +20,9 @@ import {
} from "@/components/ui/dropdown-menu";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { cn } from "@/lib/utils";
+import { t } from "@/i18n";
+import { isDesktopRuntime } from "@/app/lib/runtime-env";
+import { openWhatsNew, useWhatsNewUnseen } from "../../whats-new/whats-new";
import type { LayoutMode } from "./editor-store";
const isMac = () => typeof navigator !== "undefined" && /Mac/i.test(navigator.platform);
@@ -199,6 +202,8 @@ export type RailDestination = { id: string; label: string; icon: ReactNode; badg
/** The app's destinations the sessions sidebar holds, at the foot of the IDE rail. */
export function RailDestinations(props: { destinations: RailDestination[]; onOpenSettings: () => void }) {
const badge = props.destinations.reduce((sum, item) => sum + (item.badge ?? 0), 0);
+ const whatsNew = isDesktopRuntime();
+ const whatsNewUnseen = useWhatsNewUnseen() && whatsNew;
return (
<>
<DropdownMenu>
@@ -214,6 +219,8 @@ export function RailDestinations(props: { destinations: RailDestination[]; onOpe
<MoreHorizontal />
{badge ? (
<span className="absolute right-0.5 top-0.5 min-w-3.5 rounded-full bg-primary px-1 text-center text-[9px] font-semibold leading-3.5 text-primary-foreground">{badge}</span>
+ ) : whatsNewUnseen ? (
+ <span className="absolute right-1 top-1 size-1.5 rounded-full bg-primary" aria-hidden="true" data-rail-whats-new-dot />
) : null}
</button>
)}
@@ -226,6 +233,19 @@ export function RailDestinations(props: { destinations: RailDestination[]; onOpe
{item.badge ? <span className="rounded bg-muted px-1 text-[10px] text-muted-foreground">{item.badge}</span> : null}
</DropdownMenuItem>
))}
+ {whatsNew ? (
+ <>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem onClick={() => openWhatsNew("menu")} data-rail-destination="whats-new">
+ <Sparkles />
+ <span className="min-w-0 flex-1 truncate">
+ {t("whats_new.title")}
+ {whatsNewUnseen ? <span className="sr-only"> ({t("whats_new.unseen")})</span> : null}
+ </span>
+ {whatsNewUnseen ? <span className="size-1.5 shrink-0 rounded-full bg-primary" aria-hidden="true" /> : null}
+ </DropdownMenuItem>
+ </>
+ ) : null}
</DropdownMenuContent>
</DropdownMenu>
<Tooltip>
diff --git a/apps/app/src/react-app/domains/session/sidebar/account-status-menu.tsx b/apps/app/src/react-app/domains/session/sidebar/account-status-menu.tsx
index f51dc8fb..47eb495e 100644
--- a/apps/app/src/react-app/domains/session/sidebar/account-status-menu.tsx
+++ b/apps/app/src/react-app/domains/session/sidebar/account-status-menu.tsx
@@ -473,8 +473,11 @@ export function AccountStatusMenu(props: AccountStatusMenuProps) {
{isDesktopRuntime() ? (
<DropdownMenuItem onClick={() => openWhatsNew("menu")} data-testid="account-menu-whats-new">
<Sparkles className="size-3.5" />
- <span className="flex-1">{t("whats_new.title")}</span>
- {whatsNewUnseen ? <span className="size-1.5 shrink-0 rounded-full bg-primary" aria-label={t("whats_new.unseen")} /> : null}
+ <span className="flex-1">
+ {t("whats_new.title")}
+ {whatsNewUnseen ? <span className="sr-only"> ({t("whats_new.unseen")})</span> : null}
+ </span>
+ {whatsNewUnseen ? <span className="size-1.5 shrink-0 rounded-full bg-primary" aria-hidden="true" /> : null}
</DropdownMenuItem>
) : null}
{shellConfig.feedbackButton && props.onSendFeedback ? (
diff --git a/apps/app/src/react-app/domains/session/surface/composer/composer.tsx b/apps/app/src/react-app/domains/session/surface/composer/composer.tsx
index fd91c6b9..76a2ff62 100644
--- a/apps/app/src/react-app/domains/session/surface/composer/composer.tsx
+++ b/apps/app/src/react-app/domains/session/surface/composer/composer.tsx
@@ -1333,6 +1333,7 @@ export const ReactSessionComposer = memo(function ReactSessionComposer(props: Co
<div className={props.flush ? "" : "max-w-[800px] mx-auto"}>
{/* Main composer panel */}
<div
+ data-composer-panel
className={`@container/composer relative overflow-visible rounded-[18px] border border-dls-border bg-dls-surface transition-all ${panelRoundedClass}`}
>
{props.topAccessory ? <div className="relative z-10">{props.topAccessory}</div> : null}
diff --git a/apps/app/src/react-app/domains/session/surface/session-surface.tsx b/apps/app/src/react-app/domains/session/surface/session-surface.tsx
index 6c676cc9..7df94f76 100644
--- a/apps/app/src/react-app/domains/session/surface/session-surface.tsx
+++ b/apps/app/src/react-app/domains/session/surface/session-surface.tsx
@@ -3463,7 +3463,7 @@ export function SessionSurface(props: SessionSurfaceProps) {
/>
</div>
- <div ref={composerShellRef} className="shrink-0 px-0 pb-2 pt-2">
+ <div ref={composerShellRef} data-composer-shell className="shrink-0 px-0 pb-2 pt-2">
{(props.providerConnectedCount ?? 0) === 0 ? (
<button
type="button"
diff --git a/apps/app/src/react-app/domains/whats-new/whats-new-sheet.tsx b/apps/app/src/react-app/domains/whats-new/whats-new-sheet.tsx
index b369d574..2969063c 100644
--- a/apps/app/src/react-app/domains/whats-new/whats-new-sheet.tsx
+++ b/apps/app/src/react-app/domains/whats-new/whats-new-sheet.tsx
@@ -1,10 +1,10 @@
/** @jsxImportSource react */
// The "What's new" sheet (right side) and the one-time toast after an update.
-import { useEffect, useRef, useState } from "react";
-import { ExternalLink } from "lucide-react";
+import { useEffect, useState } from "react";
+import { ExternalLink, Sparkles, XIcon } from "lucide-react";
import { Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle } from "@/components/ui/sheet";
-import { Toaster, toast } from "@/components/ui/sonner";
+import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { t } from "@/i18n";
import { usePlatform } from "../../kernel/platform";
@@ -19,17 +19,19 @@ import {
inlineParts,
markUpdateToastShown,
openWhatsNew,
+ releasesFor,
takeUpdateDecision,
+ updateSummary,
useWhatsNewStore,
type WhatsNewRelease,
} from "./whats-new";
-const UPDATE_TOAST_ID = "whats-new-update";
const UPDATE_TOAST_MS = 12_000;
const UPDATE_TOAST_SETTLE_MS = 2_500;
-/** Its own toaster: bottom right but above the chat's composer (the main toaster sits at the window's edge). */
-const UPDATE_TOASTER_ID = "whats-new";
-const UPDATE_TOASTER_OFFSET = { bottom: 168, right: 24 };
+const UPDATE_TOAST_WIDTH = 360;
+/** Below this chat-column width the toast becomes a full-width strip. */
+const UPDATE_TOAST_STRIP_BELOW = 480;
+const UPDATE_TOAST_GAP = 12;
const GROUPS = [
{ key: "new", label: () => t("whats_new.group_new"), dot: "bg-primary" },
@@ -104,10 +106,11 @@ function ReleaseCard({ release, current }: { release: WhatsNewRelease; current:
/** The release cards, newest first; the running version first with a badge. */
export function WhatsNewReleases({ releases = desktopReleases, version }: { releases?: readonly WhatsNewRelease[]; version: string }) {
+ const shown = releasesFor(version, releases);
return (
<div className="flex flex-col gap-2">
- {releases.map((release) => (
- <ReleaseCard key={release.version} release={release} current={release.version === version} />
+ {shown.releases.map((release) => (
+ <ReleaseCard key={release.version} release={release} current={release.version === shown.current} />
))}
</div>
);
@@ -153,7 +156,7 @@ export function WhatsNewSheet() {
{t("whats_new.all_releases")}
<ExternalLink className="size-3.5" aria-hidden="true" />
</button>
- <span className="text-xs text-muted-foreground">{t("whats_new.release_count", { count: desktopReleases.length })}</span>
+ <span className="text-xs text-muted-foreground">{t("whats_new.release_count", { count: releasesFor(version).releases.length })}</span>
</SheetFooter>
</SheetContent>
</Sheet>
@@ -163,9 +166,103 @@ export function WhatsNewSheet() {
let updateDecisionTaken = false;
let updateToastDue = false;
+type ToastPlacement = { left?: number; right: number; bottom: number; width?: number; strip: boolean };
+
+/**
+ * Where the update toast sits: above the chat's composer stack (the composer
+ * plus the run status and session-quality rows over it), right-aligned to the
+ * composer, or as a full-width strip inside a narrow chat column. Without a
+ * composer on screen: the window's bottom-right corner.
+ */
+export function updateToastPlacement(
+ shell: { left: number; right: number; top: number; width: number } | null,
+ panel: { right: number } | null,
+ viewport: { width: number; height: number },
+): ToastPlacement {
+ if (!shell) return { right: 24, bottom: 24, strip: false };
+ const bottom = Math.max(12, viewport.height - shell.top + UPDATE_TOAST_GAP);
+ if (shell.width < UPDATE_TOAST_STRIP_BELOW) {
+ return { left: shell.left + 12, right: Math.max(12, viewport.width - shell.right + 12), bottom, strip: true };
+ }
+ const edge = panel ? Math.min(panel.right, shell.right - 12) : shell.right - 16;
+ return { right: Math.max(12, viewport.width - edge), bottom, width: Math.min(UPDATE_TOAST_WIDTH, shell.width - 24), strip: false };
+}
+
+function composerAnchor(): { shell: DOMRect; panel: DOMRect | null } | null {
+ const visible = (el: Element) => {
+ const rect = el.getBoundingClientRect();
+ return rect.width > 0 && rect.height > 0 ? rect : null;
+ };
+ const shells = [...document.querySelectorAll("[data-composer-shell]")].flatMap((el) => {
+ const rect = visible(el);
+ return rect ? [{ el, rect }] : [];
+ });
+ const shell = shells.at(-1);
+ if (shell) {
+ const panelEl = shell.el.querySelector("[data-composer-panel]");
+ return { shell: shell.rect, panel: panelEl ? visible(panelEl) : null };
+ }
+ // The new-chat screen: the composer alone, high on the page.
+ const panels = [...document.querySelectorAll("[data-composer-panel]")].flatMap((el) => visible(el) ?? []);
+ const panel = panels.at(-1);
+ return panel ? { shell: panel, panel } : null;
+}
+
+function useToastPlacement(active: boolean): ToastPlacement {
+ const [placement, setPlacement] = useState<ToastPlacement>({ right: 24, bottom: 24, strip: false });
+ useEffect(() => {
+ if (!active) return;
+ let frame = 0;
+ const measure = () => {
+ cancelAnimationFrame(frame);
+ frame = requestAnimationFrame(() => {
+ const anchor = composerAnchor();
+ const next = updateToastPlacement(anchor?.shell ?? null, anchor?.panel ?? null, { width: window.innerWidth, height: window.innerHeight });
+ setPlacement((prev) => (JSON.stringify(prev) === JSON.stringify(next) ? prev : next));
+ });
+ };
+ measure();
+ // The composer grows with the draft, panels open and close: follow it while the toast is up.
+ const timer = window.setInterval(measure, 250);
+ window.addEventListener("resize", measure);
+ return () => {
+ cancelAnimationFrame(frame);
+ window.clearInterval(timer);
+ window.removeEventListener("resize", measure);
+ };
+ }, [active]);
+ return placement;
+}
+
+export function UpdateToastCard(props: { version: string; summary: string; onOpen: () => void; onClose: () => void; strip?: boolean }) {
+ return (
+ <div
+ role="status"
+ aria-live="polite"
+ data-testid="whats-new-toast"
+ data-strip={props.strip ? "true" : undefined}
+ className="flex w-full items-start gap-3 rounded-2xl border border-border bg-popover/95 p-4 text-popover-foreground shadow-md ring-1 ring-popover-border/20 backdrop-blur-sm"
+ >
+ <Sparkles className="mt-0.5 size-4 shrink-0 text-foreground" aria-hidden="true" />
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
+ <p className="text-sm font-semibold">{t("whats_new.updated_title", { version: props.version })}</p>
+ {props.summary ? <p className="text-sm text-muted-foreground">{props.summary}</p> : null}
+ <div className="mt-2 flex flex-wrap items-center gap-2">
+ <Button size="sm" onClick={props.onOpen}>{t("whats_new.title")}</Button>
+ <Button size="sm" variant="ghost" onClick={props.onClose}>{t("whats_new.later")}</Button>
+ </div>
+ </div>
+ <Button size="icon-sm" variant="ghost" aria-label={t("whats_new.close")} onClick={props.onClose} className="-me-1 -mt-1 shrink-0">
+ <XIcon className="size-4" />
+ </Button>
+ </div>
+ );
+}
+
/** "Updated to X": once per version, after an upgrade, never while a turn runs or an approval waits. */
export function WhatsNewUpdateToast() {
const turnRunning = useSessionActivityStore((store) => hasLiveSessionActivity(store.statusesByWorkspaceId));
+ const sheetOpen = useWhatsNewStore((state) => state.open);
const [due, setDue] = useState(() => {
if (!updateDecisionTaken) {
updateDecisionTaken = true;
@@ -173,26 +270,55 @@ export function WhatsNewUpdateToast() {
}
return updateToastDue;
});
- const shown = useRef(false);
+ const [visible, setVisible] = useState(false);
+ const [hovered, setHovered] = useState(false);
+ const placement = useToastPlacement(visible);
+ const version = buildAppVersion();
useEffect(() => {
- if (!due || turnRunning || shown.current) return;
+ if (!due || turnRunning) return;
// A short settle so the chats' running state (read from the server after start) can hold it back.
const timer = window.setTimeout(() => {
- shown.current = true;
updateToastDue = false;
- const version = buildAppVersion();
markUpdateToastShown(version);
setDue(false);
- toast(t("whats_new.updated_toast", { version }), {
- id: UPDATE_TOAST_ID,
- duration: UPDATE_TOAST_MS,
- action: { label: t("whats_new.title"), onClick: () => openWhatsNew("toast") },
- toasterId: UPDATE_TOASTER_ID,
- });
+ setVisible(true);
}, UPDATE_TOAST_SETTLE_MS);
return () => window.clearTimeout(timer);
- }, [due, turnRunning]);
+ }, [due, turnRunning, version]);
- return <Toaster id={UPDATE_TOASTER_ID} position="bottom-right" offset={UPDATE_TOASTER_OFFSET} mobileOffset={UPDATE_TOASTER_OFFSET} />;
+ // Hides by itself (not while the pointer is on it); opening the notes from anywhere closes it.
+ useEffect(() => {
+ if (!visible || hovered) return;
+ const timer = window.setTimeout(() => setVisible(false), UPDATE_TOAST_MS);
+ return () => window.clearTimeout(timer);
+ }, [visible, hovered]);
+ useEffect(() => {
+ if (sheetOpen) setVisible(false);
+ }, [sheetOpen]);
+
+ if (!visible) return null;
+ const { current } = releasesFor(version);
+ const release = desktopReleases.find((entry) => entry.version === current);
+ return (
+ <div
+ className="fixed z-40"
+ style={{ left: placement.left, right: placement.right, bottom: placement.bottom, width: placement.strip ? undefined : placement.width ?? UPDATE_TOAST_WIDTH }}
+ onPointerEnter={() => setHovered(true)}
+ onPointerLeave={() => setHovered(false)}
+ onFocusCapture={() => setHovered(true)}
+ onBlurCapture={() => setHovered(false)}
+ >
+ <UpdateToastCard
+ version={version}
+ summary={updateSummary(release)}
+ strip={placement.strip}
+ onOpen={() => {
+ setVisible(false);
+ openWhatsNew("toast");
+ }}
+ onClose={() => setVisible(false)}
+ />
+ </div>
+ );
}
diff --git a/apps/app/src/react-app/domains/whats-new/whats-new.ts b/apps/app/src/react-app/domains/whats-new/whats-new.ts
index 0ac2e72b..6199b6d9 100644
--- a/apps/app/src/react-app/domains/whats-new/whats-new.ts
+++ b/apps/app/src/react-app/domains/whats-new/whats-new.ts
@@ -63,13 +63,71 @@ export function compareVersions(a: string, b: string): number | null {
const diff = Number(left[i]) - Number(right[i]);
if (diff !== 0) return diff;
}
- // A pre-release sorts before its release.
+ // A pre-release sorts before its release; identifiers compare as in semver (numbers numerically).
const lp = left[4] ?? "";
const rp = right[4] ?? "";
if (lp === rp) return 0;
if (!lp) return 1;
if (!rp) return -1;
- return lp < rp ? -1 : 1;
+ const la = lp.split(".");
+ const ra = rp.split(".");
+ for (let i = 0; i < Math.max(la.length, ra.length); i += 1) {
+ const l = la[i];
+ const r = ra[i];
+ if (l === undefined) return -1;
+ if (r === undefined) return 1;
+ if (l === r) continue;
+ const ln = /^\d+$/.test(l);
+ const rn = /^\d+$/.test(r);
+ if (ln && rn) return Number(l) - Number(r);
+ if (ln) return -1;
+ if (rn) return 1;
+ return l < r ? -1 : 1;
+ }
+ return 0;
+}
+
+/**
+ * The releases to show for a build: none newer than it, and the one it runs
+ * (its own entry, else the closest older one) marked current. A dev build or
+ * a build older than every entry shows them all, newest first.
+ */
+export function releasesFor(version: string, releases: readonly WhatsNewRelease[] = desktopReleases): { releases: readonly WhatsNewRelease[]; current: string | null } {
+ if (!version || !isSemver(version)) return { releases, current: releases[0]?.version ?? null };
+ const shown = releases.filter((release) => (compareVersions(release.version, version) ?? 1) <= 0);
+ if (!shown.length) return { releases, current: null };
+ return { releases: shown, current: shown[0]!.version };
+}
+
+function stripCode(text: string): string {
+ return text.replace(/`([^`]+)`/g, "$1");
+}
+
+function headline(item: string): string {
+ const plain = stripCode(item).trim();
+ const colon = plain.indexOf(":");
+ let head = colon > 0 && colon <= 48 ? plain.slice(0, colon) : plain;
+ head = head.replace(/[.;]\s.*$/, "").replace(/[.;]$/, "");
+ if (head.length > 60) head = `${head.slice(0, 57).replace(/\s+\S*$/, "")}…`;
+ return head;
+}
+
+function lowerFirst(text: string): string {
+ // Leave names and acronyms ("IDE", "Git") alone.
+ if (/^[A-Z][A-Z]/.test(text) || /^(Git|GitHub|OmniRush|Windows|macOS|Linux)\b/.test(text)) return text;
+ return text.charAt(0).toLowerCase() + text.slice(1);
+}
+
+/** One line for the update toast: the first one or two New items, shortened. */
+export function updateSummary(release: WhatsNewRelease | undefined): string {
+ if (!release) return "";
+ const items = release.new.length ? release.new : release.improved.length ? release.improved : release.fixed;
+ if (!items.length) return "";
+ const heads = items.slice(0, 2).map(headline).filter(Boolean);
+ if (heads.length === 1 && items.length === 1) return `${heads[0]}.`;
+ const [first, second] = heads;
+ if (!second) return `${first} and more.`;
+ return items.length > 2 ? `${first}, ${lowerFirst(second)} and more.` : `${first} and ${lowerFirst(second)}.`;
}
export type UpdateDecision = {
diff --git a/apps/app/src/react-app/shell/command-palette-search.ts b/apps/app/src/react-app/shell/command-palette-search.ts
index 11e72cf4..4b050127 100644
--- a/apps/app/src/react-app/shell/command-palette-search.ts
+++ b/apps/app/src/react-app/shell/command-palette-search.ts
@@ -1,6 +1,6 @@
import fuzzysort from "fuzzysort";
-export type PaletteGroup = "recent" | "actions" | "settings" | "sessions";
+export type PaletteGroup = "recent" | "actions" | "help" | "settings" | "sessions";
export type PaletteItem = {
id: string;
@@ -13,6 +13,8 @@ export type PaletteItem = {
breadcrumb?: string;
shortcut?: string;
disabled?: boolean;
+ /** A small accent dot after the title (e.g. unread release notes). */
+ dot?: boolean;
action: () => void;
};
@@ -22,10 +24,11 @@ export type PaletteResultGroup = {
items: PaletteItem[];
};
-const GROUP_ORDER: PaletteGroup[] = ["recent", "actions", "settings", "sessions"];
+const GROUP_ORDER: PaletteGroup[] = ["recent", "actions", "help", "settings", "sessions"];
const GROUP_LABELS: Record<PaletteGroup, string> = {
recent: "Recent",
actions: "Actions",
+ help: "Help",
settings: "Settings",
sessions: "Sessions",
};
@@ -71,6 +74,7 @@ export function rankPaletteItems(
const groups = [
resultGroup("recent", recent),
resultGroup("actions", nonRecentItems.filter((item) => itemGroup(item) === "actions")),
+ resultGroup("help", nonRecentItems.filter((item) => itemGroup(item) === "help")),
resultGroup("settings", nonRecentItems.filter((item) => itemGroup(item) === "settings").slice(0, 6)),
resultGroup("sessions", nonRecentItems.filter((item) => itemGroup(item) === "sessions").slice(0, 5)),
];
diff --git a/apps/app/src/react-app/shell/command-palette.tsx b/apps/app/src/react-app/shell/command-palette.tsx
index 459185e7..5a8200c2 100644
--- a/apps/app/src/react-app/shell/command-palette.tsx
+++ b/apps/app/src/react-app/shell/command-palette.tsx
@@ -359,9 +359,9 @@ export function CommandPalette(props: CommandPaletteProps) {
id: "whats-new",
title: t("whats_new.title"),
detail: t("whats_new.palette_detail", { version: displayVersion() }),
- meta: whatsNewUnseen ? t("whats_new.unseen") : undefined,
+ dot: whatsNewUnseen,
keywords: ["what's new", "whats new", "changelog", "release notes", "updates", "version", "help"],
- group: ACTIONS_GROUP,
+ group: "help" as const,
action: () => {
props.onClose();
openWhatsNew("palette");
@@ -693,7 +693,15 @@ export function CommandPalette(props: CommandPaletteProps) {
}}
>
<div className="min-w-0 flex-1">
- <div className="truncate font-medium">{item.title}</div>
+ <div className="flex min-w-0 items-center gap-1.5">
+ <span className="truncate font-medium">{item.title}</span>
+ {item.dot ? (
+ <>
+ <span className="size-1.5 shrink-0 rounded-full bg-primary" aria-hidden="true" data-palette-dot />
+ <span className="sr-only">({t("whats_new.unseen")})</span>
+ </>
+ ) : null}
+ </div>
{item.breadcrumb || item.detail ? (
<div className="truncate text-muted-foreground text-xs">
{item.breadcrumb ? (
diff --git a/apps/app/tests/whats-new.test.tsx b/apps/app/tests/whats-new.test.tsx
index 7d5d956a..88face90 100644
--- a/apps/app/tests/whats-new.test.tsx
+++ b/apps/app/tests/whats-new.test.tsx
@@ -19,7 +19,8 @@ Object.defineProperty(globalThis, "window", {
});
const whatsNew = await import("../src/react-app/domains/whats-new/whats-new");
-const { WhatsNewReleases, WhatsNewText } = await import("../src/react-app/domains/whats-new/whats-new-sheet");
+const { UpdateToastCard, WhatsNewReleases, WhatsNewText, updateToastPlacement } = await import("../src/react-app/domains/whats-new/whats-new-sheet");
+const { rankPaletteItems } = await import("../src/react-app/shell/command-palette-search");
const { ensureInspectorInstalled } = await import("../src/app/lib/app-inspector");
const DIR = path.join(import.meta.dir, "../src/react-app/domains/whats-new");
@@ -85,6 +86,10 @@ describe("versions", () => {
expect(whatsNew.compareVersions("3.6.3", "3.6.3")).toBe(0);
expect(whatsNew.compareVersions("3.6.3-beta.1", "3.6.3")).toBeLessThan(0);
expect(whatsNew.compareVersions("junk", "3.6.3")).toBeNull();
+ expect(whatsNew.compareVersions("3.6.3-beta.10", "3.6.3-beta.9")).toBeGreaterThan(0);
+ expect(whatsNew.compareVersions("3.6.3-beta.2", "3.6.3-beta.10")).toBeLessThan(0);
+ expect(whatsNew.compareVersions("3.6.3-1", "3.6.3-alpha")).toBeLessThan(0);
+ expect(whatsNew.compareVersions("3.6.3-beta", "3.6.3-beta.1")).toBeLessThan(0);
});
test("dev builds count as no version", () => {
@@ -197,3 +202,66 @@ describe("sheet content", () => {
expect(markup.match(/data-current="true"/g)?.length).toBe(1);
});
});
+
+describe("which releases a build shows", () => {
+ const releases = [
+ { version: "3.6.3", date: "2026-10-20", new: ["A"], improved: [], fixed: [] },
+ { version: "3.6.1", date: "2026-10-19", new: ["B"], improved: [], fixed: [] },
+ { version: "3.6.0", date: "2026-10-18", new: ["C"], improved: [], fixed: [] },
+ ];
+ test("own entry is current", () => {
+ expect(whatsNew.releasesFor("3.6.3", releases)).toEqual({ releases, current: "3.6.3" });
+ });
+ test("no own entry: the closest older one is current, newer ones hidden", () => {
+ const shown = whatsNew.releasesFor("3.6.2", releases);
+ expect(shown.current).toBe("3.6.1");
+ expect(shown.releases.map((r) => r.version)).toEqual(["3.6.1", "3.6.0"]);
+ const markup = renderToStaticMarkup(<WhatsNewReleases releases={releases} version="3.6.2" />);
+ expect(markup).not.toContain('data-whats-new-release="3.6.3"');
+ expect(markup).toContain('data-whats-new-release="3.6.1" data-current="true"');
+ });
+ test("dev build or older than every entry: all, newest first", () => {
+ expect(whatsNew.releasesFor("", releases)).toEqual({ releases, current: "3.6.3" });
+ expect(whatsNew.releasesFor("3.5.0", releases)).toEqual({ releases, current: null });
+ });
+});
+
+describe("update toast", () => {
+ test("one-line summary from the first New items", () => {
+ expect(whatsNew.updateSummary(whatsNew.desktopReleases.find((r) => r.version === "3.6.3"))).toBe("Chat and IDE layouts, permission modes and more.");
+ expect(whatsNew.updateSummary({ version: "1.0.0", date: "2026-01-01", new: ["Use `/undo` now."], improved: [], fixed: [] })).toBe("Use /undo now.");
+ expect(whatsNew.updateSummary({ version: "1.0.0", date: "2026-01-01", new: ["One thing: a", "IDE mode: b"], improved: [], fixed: [] })).toBe("One thing and IDE mode.");
+ expect(whatsNew.updateSummary({ version: "1.0.0", date: "2026-01-01", new: [], improved: [], fixed: ["Fixed a crash."] })).toBe("Fixed a crash.");
+ expect(whatsNew.updateSummary(undefined)).toBe("");
+ });
+
+ test("card: icon, title, summary, What's new and Later", () => {
+ const markup = renderToStaticMarkup(<UpdateToastCard version="3.6.3" summary="Chat and IDE layouts and more." onOpen={() => {}} onClose={() => {}} />);
+ expect(markup).toContain("Updated to 3.6.3");
+ expect(markup).toContain("Chat and IDE layouts and more.");
+ expect(markup).toContain("What&#x27;s new");
+ expect(markup).toContain("Later");
+ expect(markup).toContain("<svg");
+ });
+
+ test("placement: above the composer, right-aligned; a strip in a narrow chat; corner without a composer", () => {
+ const viewport = { width: 1440, height: 900 };
+ const wide = updateToastPlacement({ left: 230, right: 1400, top: 640, width: 1170 }, { right: 1213 }, viewport);
+ expect(wide).toEqual({ right: 227, bottom: 272, width: 360, strip: false });
+ const narrow = updateToastPlacement({ left: 760, right: 1090, top: 470, width: 330 }, { right: 1060 }, { width: 1100, height: 800 });
+ expect(narrow).toEqual({ left: 772, right: 22, bottom: 342, strip: true });
+ expect(updateToastPlacement(null, null, viewport)).toEqual({ right: 24, bottom: 24, strip: false });
+ });
+});
+
+describe("command palette", () => {
+ test("the What's new row sits under Help", () => {
+ const groups = rankPaletteItems("what", [
+ { id: "whats-new", title: "What's new", group: "help", keywords: ["changelog"], action: () => {} },
+ { id: "x", title: "Something else", action: () => {} },
+ ], []);
+ expect(groups[0]?.label).toBe("Help");
+ expect(groups[0]?.items[0]?.id).toBe("whats-new");
+ expect(rankPaletteItems("", [{ id: "whats-new", title: "What's new", group: "help", action: () => {} }], [])[0]?.label).toBe("Help");
+ });
+});