Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-9281: feat(whats-new): show unread release highlights as a card deck in the corner (#10633)
Jiayuan Zhangda0d2ac43b3e
diff --git a/apps/desktop/src/renderer/src/components/desktop-layout.test.tsx b/apps/desktop/src/renderer/src/components/desktop-layout.test.tsxindex 47c5b6d94d..fde73ef252 100644--- a/apps/desktop/src/renderer/src/components/desktop-layout.test.tsx+++ b/apps/desktop/src/renderer/src/components/desktop-layout.test.tsx@@ -88,6 +88,7 @@ vi.mock("@multica/views/search", () => ({}));vi.mock("@multica/views/chat", () => ({ FloatingChat: () => null }));vi.mock("@multica/views/star-prompt", () => ({ StarPrompt: () => null }));+vi.mock("@multica/views/whats-new", () => ({ WhatsNewDeck: () => null }));vi.mock("./tab-bar", () => ({ TabBar: () => null }));vi.mock("./window-overlay", () => ({ WindowOverlay: () => null }));diff --git a/apps/desktop/src/renderer/src/components/desktop-layout.tsx b/apps/desktop/src/renderer/src/components/desktop-layout.tsxindex 04ae7f4591..dcfabe5f72 100644--- a/apps/desktop/src/renderer/src/components/desktop-layout.tsx+++ b/apps/desktop/src/renderer/src/components/desktop-layout.tsx@@ -26,6 +26,7 @@ import {import { SearchCommand } from "@multica/views/search";import { FloatingChat } from "@multica/views/chat";import { StarPrompt } from "@multica/views/star-prompt";+import { WhatsNewDeck } from "@multica/views/whats-new";import { WorkspaceSlugProvider, useCurrentWorkspace } from "@multica/core/paths";import { workspaceListOptions } from "@multica/core/workspace";import {@@ -308,6 +309,7 @@ export function DesktopShell() {<TabContent />{slug && <FloatingChat />}{slug && <StarPrompt />}+ {slug && <WhatsNewDeck />}</MainCanvas>{slug && <AppBottomBar />}</div>diff --git a/apps/desktop/src/renderer/src/components/desktop-layout.workspace-gate.test.tsx b/apps/desktop/src/renderer/src/components/desktop-layout.workspace-gate.test.tsxindex cc964f6fa9..4fb9bbcc2f 100644--- a/apps/desktop/src/renderer/src/components/desktop-layout.workspace-gate.test.tsx+++ b/apps/desktop/src/renderer/src/components/desktop-layout.workspace-gate.test.tsx@@ -119,6 +119,7 @@ vi.mock("@multica/views/chat", () => ({vi.mock("@multica/views/star-prompt", () => ({StarPrompt: () => <div data-testid="star-prompt" />,}));+vi.mock("@multica/views/whats-new", () => ({ WhatsNewDeck: () => null }));vi.mock("./tab-bar", () => ({ TabBar: () => null }));vi.mock("./window-overlay", () => ({ WindowOverlay: () => null }));diff --git a/apps/web/app/[workspaceSlug]/(dashboard)/layout.tsx b/apps/web/app/[workspaceSlug]/(dashboard)/layout.tsxindex 5f4cf17c99..2076194a0f 100644--- a/apps/web/app/[workspaceSlug]/(dashboard)/layout.tsx+++ b/apps/web/app/[workspaceSlug]/(dashboard)/layout.tsx@@ -6,6 +6,7 @@ import { MulticaIcon } from "@multica/ui/components/common/multica-icon";import { SearchCommand } from "@multica/views/search";import { FloatingChat } from "@multica/views/chat/floating-chat";import { StarPrompt } from "@multica/views/star-prompt";+import { WhatsNewDeck } from "@multica/views/whats-new";import { WebNotificationBridge } from "@/components/web-notification-bridge";import { WorkspaceDocumentTitle } from "@/platform/workspace-document-title";@@ -26,6 +27,7 @@ export default function Layout({ children }: { children: React.ReactNode }) {<WebNotificationBridge /><FloatingChat /><StarPrompt />+ <WhatsNewDeck /></>}>diff --git a/packages/core/session-prompt/index.ts b/packages/core/session-prompt/index.tsindex a6842a1e96..03fd2e2fe1 100644--- a/packages/core/session-prompt/index.ts+++ b/packages/core/session-prompt/index.ts@@ -9,8 +9,9 @@ interface SessionPromptStore {}/**- * The one interruption an app session allows, shared by the source survey and- * the GitHub star prompt so a user who just dealt with one never meets the other.+ * The one interruption an app session allows, shared by the source survey,+ * the GitHub star prompt and the What's new deck so a user who just dealt with+ * one never meets another.*/export const useSessionPromptStore = create<SessionPromptStore>((set) => ({prompted: false,diff --git a/packages/views/common/quiet-moment.ts b/packages/views/common/quiet-moment.tsnew file mode 100644index 0000000000..d9740a5739--- /dev/null+++ b/packages/views/common/quiet-moment.ts@@ -0,0 +1,17 @@+/**+ * Nothing is open or being typed into. A card that appears mid-sentence or+ * over a dialog reads as an interruption, so callers wait for or skip such+ * moments rather than showing anyway.+ */+export function isQuietMoment(): boolean {+ if (document.visibilityState !== "visible") return false;+ if (document.querySelector("[role='dialog'][aria-modal='true'], [role='alertdialog']")) return false;+ const active = document.activeElement;+ if (+ active instanceof HTMLElement &&+ (active.isContentEditable || active.tagName === "INPUT" || active.tagName === "TEXTAREA")+ ) {+ return false;+ }+ return true;+}diff --git a/packages/views/locales/en/layout.json b/packages/views/locales/en/layout.jsonindex 8f89edd53f..58787a476b 100644--- a/packages/views/locales/en/layout.json+++ b/packages/views/locales/en/layout.json@@ -52,6 +52,12 @@"try": "Try it","open": "Open","learn_more": "Learn more"+ },+ "deck": {+ "tag": "New",+ "next": "Next",+ "done": "Got it",+ "page": "Update {{current}} of {{total}}"}},"star_prompt": {diff --git a/packages/views/locales/es/layout.json b/packages/views/locales/es/layout.jsonindex 426ee0ed84..6f73f1317b 100644--- a/packages/views/locales/es/layout.json+++ b/packages/views/locales/es/layout.json@@ -74,6 +74,12 @@"try": "Probar","open": "Abrir","learn_more": "Más información"+ },+ "deck": {+ "tag": "Nuevo",+ "next": "Siguiente",+ "done": "Entendido",+ "page": "Novedad {{current}} de {{total}}"}},"star_prompt": {diff --git a/packages/views/locales/fr/layout.json b/packages/views/locales/fr/layout.jsonindex a51027e4ed..c350173346 100644--- a/packages/views/locales/fr/layout.json+++ b/packages/views/locales/fr/layout.json@@ -52,6 +52,12 @@"try": "Essayer","open": "Ouvrir","learn_more": "En savoir plus"+ },+ "deck": {+ "tag": "Nouveau",+ "next": "Suivant",+ "done": "Compris",+ "page": "Nouveauté {{current}} sur {{total}}"}},"star_prompt": {diff --git a/packages/views/locales/ja/layout.json b/packages/views/locales/ja/layout.jsonindex d413822fa7..7728642fbb 100644--- a/packages/views/locales/ja/layout.json+++ b/packages/views/locales/ja/layout.json@@ -52,6 +52,12 @@"try": "試してみる","open": "開く","learn_more": "詳しく見る"+ },+ "deck": {+ "tag": "新機能",+ "next": "次へ",+ "done": "了解",+ "page": "{{total}} 件中 {{current}} 件目"}},"star_prompt": {diff --git a/packages/views/locales/ko/layout.json b/packages/views/locales/ko/layout.jsonindex b2ac7caf3e..8a8eab6247 100644--- a/packages/views/locales/ko/layout.json+++ b/packages/views/locales/ko/layout.json@@ -52,6 +52,12 @@"try": "사용해 보기","open": "열기","learn_more": "자세히 알아보기"+ },+ "deck": {+ "tag": "새 기능",+ "next": "다음",+ "done": "확인",+ "page": "{{total}}개 중 {{current}}번째"}},"star_prompt": {diff --git a/packages/views/locales/ru/layout.json b/packages/views/locales/ru/layout.jsonindex 9b3a44f4b8..926474c04e 100644--- a/packages/views/locales/ru/layout.json+++ b/packages/views/locales/ru/layout.json@@ -259,6 +259,12 @@"open": "Открыть","try": "Попробовать"},+ "deck": {+ "tag": "Новое",+ "next": "Далее",+ "done": "Понятно",+ "page": "Новость {{current}} из {{total}}"+ },"panel": {"close": "Закрыть","full_changelog": "Полный список изменений",diff --git a/packages/views/locales/zh-Hans/layout.json b/packages/views/locales/zh-Hans/layout.jsonindex 3020531410..029c04abcf 100644--- a/packages/views/locales/zh-Hans/layout.json+++ b/packages/views/locales/zh-Hans/layout.json@@ -52,6 +52,12 @@"try": "试一下","open": "前往","learn_more": "了解更多"+ },+ "deck": {+ "tag": "新功能",+ "next": "下一条",+ "done": "知道了",+ "page": "第 {{current}} 条,共 {{total}} 条"}},"star_prompt": {diff --git a/packages/views/locales/zh-Hant/layout.json b/packages/views/locales/zh-Hant/layout.jsonindex 9f494570d6..e72847d771 100644--- a/packages/views/locales/zh-Hant/layout.json+++ b/packages/views/locales/zh-Hant/layout.json@@ -52,6 +52,12 @@"try": "試一下","open": "前往","learn_more": "了解更多"+ },+ "deck": {+ "tag": "新功能",+ "next": "下一則",+ "done": "知道了",+ "page": "第 {{current}} 則,共 {{total}} 則"}},"star_prompt": {diff --git a/packages/views/package.json b/packages/views/package.jsonindex 17cb01543e..2c71620bc8 100644--- a/packages/views/package.json+++ b/packages/views/package.json@@ -70,6 +70,7 @@"./invitations": "./invitations/index.ts","./onboarding": "./onboarding/index.ts","./star-prompt": "./star-prompt/index.ts",+ "./whats-new": "./whats-new/index.ts","./platform": "./platform/index.ts","./i18n": "./i18n/index.ts","./attachments": "./attachments/index.ts",diff --git a/packages/views/star-prompt/star-prompt.tsx b/packages/views/star-prompt/star-prompt.tsxindex cd8d894aa6..eb1d46e848 100644--- a/packages/views/star-prompt/star-prompt.tsx+++ b/packages/views/star-prompt/star-prompt.tsx@@ -23,6 +23,7 @@ import {} from "@multica/core/star-prompt";import { agentListOptions } from "@multica/core/workspace/queries";import { isFloatingChatRouteSuppressed } from "../chat/floating-chat-visibility";+import { isQuietMoment } from "../common/quiet-moment";import { useT } from "../i18n";import { useNavigation } from "../navigation";import { GitHubIcon } from "../onboarding/components/brand-icons";@@ -33,24 +34,6 @@ const logger = createLogger("star-prompt");/** Lets the status change settle before the card slides in. */export const STAR_PROMPT_DELAY_MS = 2500;-/**- * Nothing is open or being typed into. A card that appears mid-sentence or- * over a dialog reads as an interruption, so such moments are skipped rather- * than deferred.- */-function isQuietMoment(): boolean {- if (document.visibilityState !== "visible") return false;- if (document.querySelector("[role='dialog'][aria-modal='true'], [role='alertdialog']")) return false;- const active = document.activeElement;- if (- active instanceof HTMLElement &&- (active.isContentEditable || active.tagName === "INPUT" || active.tagName === "TEXTAREA")- ) {- return false;- }- return true;-}-interface Showing {agentName: string;doneCount: number;diff --git a/packages/views/whats-new/heroes.test.tsx b/packages/views/whats-new/heroes.test.tsxnew file mode 100644index 0000000000..1b8a28b48e--- /dev/null+++ b/packages/views/whats-new/heroes.test.tsx@@ -0,0 +1,40 @@+import { render } from "@testing-library/react";+import { describe, expect, it } from "vitest";+import { I18nProvider } from "@multica/core/i18n/react";+import en from "../locales/en";+import zhHans from "../locales/zh-Hans";+import { HeroFrame } from "./heroes";+import { WHATS_NEW_RELEASES } from "./releases";++const withHeroes = WHATS_NEW_RELEASES.flatMap((r) => r.highlights).filter((h) => h.hero);++function renderHero(id: string, locale: "en" | "zh-Hans") {+ const hero = withHeroes.find((h) => h.id === id)!.hero!;+ return render(+ <I18nProvider locale={locale} resources={{ [locale]: locale === "en" ? en : zhHans }}>+ <HeroFrame hero={hero} />+ </I18nProvider>,+ );+}++describe("What's new hero art", () => {+ it.each([+ ["community-themes", ["Themes", "Search themes", "Install", "In use"]],+ ["environment-controls", ["Environments", "2 running", "Running", "Switch to window", "View logs"]],+ ["chat-annotations", ["1 annotation", "Add a comment…", "Add"]],+ ])("draws %s from the product's own strings", (id, texts) => {+ const { container } = renderHero(id, "en");+ for (const text of texts) expect(container).toHaveTextContent(text);+ });++ it("follows the locale", () => {+ const { container } = renderHero("environment-controls", "zh-Hans");+ expect(container).not.toHaveTextContent("Environments");+ expect(container).not.toHaveTextContent("environments.");+ });++ it("stays out of the accessibility tree", () => {+ const { container } = renderHero("community-themes", "en");+ expect(container.firstElementChild).toHaveAttribute("aria-hidden", "true");+ });+});diff --git a/packages/views/whats-new/heroes.tsx b/packages/views/whats-new/heroes.tsxnew file mode 100644index 0000000000..71efc51a64--- /dev/null+++ b/packages/views/whats-new/heroes.tsx@@ -0,0 +1,315 @@+"use client";++import type { CSSProperties, ReactNode } from "react";+import {+ AppWindow,+ Bot,+ Check,+ ChevronDown,+ Ellipsis,+ Laptop,+ Plus,+ Quote,+ RotateCw,+ ScrollText,+ Search,+ Server,+ Square,+} from "@multica/ui/icons";+import { cn } from "@multica/ui/lib/utils";+import { useT } from "../i18n";++/**+ * Hero art for the What's new deck: a small mock of the feature built from+ * the product's own tokens and strings, so it follows the theme and locale.+ * The ground is a fixed color, picked per highlight for variety; each one+ * reads against both the light and the dark card.+ */+export type HeroGround = "brand" | "orange" | "lime" | "ice";++export interface WhatsNewHero {+ ground: HeroGround;+ Art: () => ReactNode;+}++const GROUNDS: Record<HeroGround, { color: string; dots: string }> = {+ brand: { color: "var(--brand)", dots: "rgb(255 255 255 / 0.22)" },+ orange: { color: "#ff6a2b", dots: "rgb(17 18 22 / 0.16)" },+ lime: { color: "#d9f45e", dots: "rgb(17 18 22 / 0.14)" },+ ice: { color: "#c9d7ff", dots: "rgb(17 18 22 / 0.12)" },+};++export function HeroFrame({ hero }: { hero: WhatsNewHero }) {+ const ground = GROUNDS[hero.ground];+ const style: CSSProperties = {+ backgroundColor: ground.color,+ backgroundImage: `radial-gradient(${ground.dots} 1px, transparent 1.4px)`,+ backgroundSize: "14px 14px",+ };+ const { Art } = hero;+ return (+ <div aria-hidden="true" inert className="relative h-44 overflow-hidden select-none" style={style}>+ <Art />+ </div>+ );+}++/** A cropped product surface; it bleeds off the right and bottom edges. */+function Surface({ className, children }: { className?: string; children: ReactNode }) {+ return (+ <div+ className={cn(+ "absolute overflow-hidden rounded-lg bg-surface-raised text-popover-foreground shadow-[var(--floating-shadow)] ring-1 ring-black/5 dark:ring-white/10",+ className,+ )}+ >+ {children}+ </div>+ );+}++function Menu({ className, children }: { className?: string; children: ReactNode }) {+ return (+ <div+ className={cn(+ "absolute z-10 rounded-lg bg-popover p-1 text-popover-foreground shadow-[var(--menu-shadow)] ring-1 ring-black/5 dark:ring-white/10",+ className,+ )}+ >+ {children}+ </div>+ );+}++function MenuItem({ icon, active, children }: { icon: ReactNode; active?: boolean; children: ReactNode }) {+ return (+ <div+ className={cn(+ "flex h-7 items-center gap-2 rounded-md px-2 text-label whitespace-nowrap [&_svg]:size-3.5 [&_svg]:text-muted-foreground",+ active && "bg-accent",+ )}+ >+ {icon}+ {children}+ </div>+ );+}++/** Names in the art: proper nouns that read the same in every locale. */+const SAMPLE = {+ author: "Multica",+ machine: "MacBook Pro",+ webApp: "Web app",+ desktopApp: "Desktop app",+ agent: "Builder",+};++/* ── Community themes: the theme store ─────────────────────────────── */++interface ThemeSample {+ name: string;+ version: string;+ paper: string;+ panel: string;+ ink: string;+ accent: string;+ inUse?: boolean;+}++const THEME_SAMPLES: ThemeSample[] = [+ { name: "Linen", version: "1.1.0", paper: "#f7f1e6", panel: "#ece3d2", ink: "#5a4632", accent: "#a0522d" },+ { name: "Flexoki", version: "1.0.0", paper: "#fffcf0", panel: "#f2f0e5", ink: "#100f0f", accent: "#205ea6", inUse: true },+ { name: "MS-DOS", version: "1.2.0", paper: "#0000aa", panel: "#000080", ink: "#ffffff", accent: "#55ffff" },+];++function ThemeThumb({ theme }: { theme: ThemeSample }) {+ return (+ <div className="flex h-12 gap-1.5 p-2" style={{ backgroundColor: theme.paper }}>+ <div className="flex w-1/4 flex-col gap-1 rounded-xs p-1" style={{ backgroundColor: theme.panel }}>+ {[70, 90, 55].map((w) => (+ <span key={w} className="h-1 rounded-full" style={{ width: `${w}%`, backgroundColor: theme.ink, opacity: 0.35 }} />+ ))}+ </div>+ <div className="flex flex-1 flex-col gap-1 pt-0.5">+ <span className="h-1.5 w-3/5 rounded-full" style={{ backgroundColor: theme.ink, opacity: 0.8 }} />+ {[92, 80, 86].map((w) => (+ <span key={w} className="h-1 rounded-full" style={{ width: `${w}%`, backgroundColor: theme.ink, opacity: 0.25 }} />+ ))}+ <span className="mt-auto h-2.5 w-8 rounded-xs" style={{ backgroundColor: theme.accent }} />+ </div>+ </div>+ );+}++function ThemesArt() {+ const { t } = useT("settings");+ return (+ <Surface className="top-4 left-6 w-[30rem]">+ <div className="flex items-center gap-2 px-4 pt-3">+ <span className="text-body font-semibold">{t(($) => $.appearance.store.title)}</span>+ <span className="rounded-sm bg-muted px-1.5 text-micro font-medium text-muted-foreground">+ {t(($) => $.appearance.import.beta)}+ </span>+ <div className="ml-3 flex h-7 w-44 items-center gap-1.5 rounded-md px-2 text-caption text-muted-foreground ring-1 ring-border">+ <Search className="size-3.5 shrink-0" />+ <span className="truncate">{t(($) => $.appearance.store.search)}</span>+ </div>+ </div>+ <div className="grid grid-cols-3 gap-2.5 p-4 pt-3">+ {THEME_SAMPLES.map((theme) => (+ <div key={theme.name} className="overflow-hidden rounded-lg ring-1 ring-border">+ <ThemeThumb theme={theme} />+ <div className="px-2.5 py-2">+ <div className="flex items-baseline gap-1.5">+ <span className="text-label font-medium">{theme.name}</span>+ <span className="text-micro text-muted-foreground tabular-nums">{theme.version}</span>+ </div>+ <div className="mt-1.5 flex items-center justify-between gap-2">+ <span className="truncate text-micro text-muted-foreground">+ {t(($) => $.appearance.store.by, { author: SAMPLE.author })}+ </span>+ {theme.inUse ? (+ <span className="inline-flex h-5 shrink-0 items-center gap-1 rounded-md bg-muted px-1.5 text-micro font-medium text-muted-foreground">+ <Check className="size-3" />+ {t(($) => $.appearance.store.in_use)}+ </span>+ ) : (+ <span className="inline-flex h-5 shrink-0 items-center rounded-md bg-primary px-1.5 text-micro font-medium text-primary-foreground">+ {t(($) => $.appearance.store.install)}+ </span>+ )}+ </div>+ </div>+ </div>+ ))}+ </div>+ </Surface>+ );+}++/* ── Environment controls: the issue sidebar section ───────────────── */++function EnvRow({ icon, name, meta, active }: { icon: ReactNode; name: string; meta: string; active?: boolean }) {+ const { t } = useT("issues");+ return (+ <div className={cn("relative flex items-start gap-2 rounded-md px-2 py-2", active && "bg-accent/60")}>+ <span className="mt-px text-success [&_svg]:size-3.5">{icon}</span>+ <div className="min-w-0 flex-1">+ <p className="flex items-center gap-2">+ <span className="min-w-0 flex-1 truncate text-label font-medium">{name}</span>+ {active ? (+ <span className="grid size-5 place-items-center rounded-md bg-surface-raised text-muted-foreground shadow-sm ring-1 ring-border">+ <Ellipsis className="size-3.5" />+ </span>+ ) : (+ <span className="inline-flex shrink-0 items-center gap-1 text-caption text-success">+ <span className="size-1.5 rounded-full bg-success" />+ {t(($) => $.environments.state.running)}+ </span>+ )}+ </p>+ <p className="mt-1 truncate text-caption text-muted-foreground tabular-nums">{meta}</p>+ </div>+ </div>+ );+}++function EnvironmentsArt() {+ const { t } = useT("issues");+ const expires = t(($) => $.environments.expires_in_hours, { count: 23 });+ return (+ <>+ <Surface className="top-5 left-6 w-[19rem]">+ <div className="flex h-9 items-center gap-1 px-3">+ <span className="text-label font-medium">{t(($) => $.environments.section_title)}</span>+ <ChevronDown className="size-3 text-muted-foreground" />+ <span className="ml-auto text-caption text-muted-foreground">+ {t(($) => $.environments.running_count, { count: 2 })}+ </span>+ <Plus className="ml-1.5 size-3.5 text-muted-foreground" />+ </div>+ <div className="px-1 pb-2">+ <div className="flex min-h-7 items-center gap-1.5 px-2 text-micro text-muted-foreground">+ <Laptop className="size-3 shrink-0" />+ <span>{SAMPLE.machine}</span>+ <span className="rounded-xs bg-muted px-1 font-medium">{t(($) => $.environments.this_machine)}</span>+ </div>+ <EnvRow icon={<AppWindow />} name={SAMPLE.desktopApp} meta={expires} active />+ <EnvRow icon={<Server />} name={SAMPLE.webApp} meta={`localhost:3000 · ${expires}`} />+ </div>+ </Surface>+ <Menu className="top-[7.25rem] left-[8.75rem] w-44">+ <MenuItem icon={<AppWindow />} active>+ {t(($) => $.environments.focus)}+ </MenuItem>+ <MenuItem icon={<ScrollText />}>{t(($) => $.environments.view_logs)}</MenuItem>+ <MenuItem icon={<RotateCw />}>{t(($) => $.environments.restart)}</MenuItem>+ <MenuItem icon={<Square />}>{t(($) => $.environments.stop_confirm_item)}</MenuItem>+ </Menu>+ </>+ );+}++/* ── Chat annotations: a selected passage and its note ─────────────── */++function TextLine({ words, selected }: { words: number[]; selected?: [number, number] }) {+ return (+ <div className="flex h-5 items-center">+ {words.map((w, i) => {+ const inSelection = selected && i >= selected[0] && i <= selected[1];+ return (+ <span+ key={i}+ className={cn("flex h-5 items-center px-[3px]", inSelection && "bg-brand/20")}+ >+ <span+ className={cn("h-1.5 rounded-full", inSelection ? "bg-foreground/55" : "bg-muted-foreground/30")}+ style={{ width: w }}+ />+ </span>+ );+ })}+ </div>+ );+}++function AnnotationsArt() {+ const { t } = useT("issues");+ return (+ <>+ <Surface className="top-5 left-6 w-[22rem]">+ <div className="px-4 pt-3.5">+ <div className="flex items-center gap-2">+ <span className="grid size-5 place-items-center rounded-full bg-brand/10 text-brand">+ <Bot className="size-3" />+ </span>+ <span className="text-label font-medium">{SAMPLE.agent}</span>+ </div>+ <div className="mt-2 pl-7">+ <TextLine words={[34, 52, 22, 40, 60, 28]} selected={[1, 3]} />+ <TextLine words={[44, 30, 58, 36, 26, 48]} />+ <TextLine words={[50, 38, 24, 46]} />+ </div>+ </div>+ <div className="mx-3 mt-3 mb-3 flex items-center gap-2 rounded-lg px-2 py-1.5 ring-1 ring-border">+ <span className="inline-flex h-5 items-center gap-1 rounded-md bg-muted px-1.5 text-micro font-medium text-muted-foreground">+ <Quote className="size-3" />+ {t(($) => $.reply.annotations.count, { count: 1 })}+ </span>+ </div>+ </Surface>+ <Menu className="top-[5.4rem] left-[6rem] flex w-60 items-center gap-2 py-1 pr-1 pl-3">+ <span className="min-w-0 flex-1 truncate text-label text-muted-foreground">+ {t(($) => $.reply.annotations.note_placeholder)}+ </span>+ <span className="inline-flex h-6 shrink-0 items-center rounded-md bg-primary px-2 text-caption font-medium text-primary-foreground">+ {t(($) => $.reply.annotations.confirm_add_short)}+ </span>+ </Menu>+ </>+ );+}++export const THEMES_HERO: WhatsNewHero = { ground: "orange", Art: ThemesArt };+export const ENVIRONMENTS_HERO: WhatsNewHero = { ground: "ice", Art: EnvironmentsArt };+export const ANNOTATIONS_HERO: WhatsNewHero = { ground: "lime", Art: AnnotationsArt };diff --git a/packages/views/whats-new/index.ts b/packages/views/whats-new/index.tsnew file mode 100644index 0000000000..7ecb19d6dd--- /dev/null+++ b/packages/views/whats-new/index.ts@@ -0,0 +1 @@+export { WhatsNewDeck } from "./whats-new-deck";diff --git a/packages/views/whats-new/releases.ts b/packages/views/whats-new/releases.tsindex f4b8622bbd..cbf541da3e 100644--- a/packages/views/whats-new/releases.ts+++ b/packages/views/whats-new/releases.ts@@ -2,6 +2,7 @@ import { CircleDot, Command, Gauge, Globe, History, Layers, ListPlus, Lock, Paleimport type { SupportedLocale } from "@multica/core/i18n";import type { WorkspacePaths } from "@multica/core/paths";import type { ReleaseStamp } from "@multica/core/whats-new";+import { ANNOTATIONS_HERO, ENVIRONMENTS_HERO, THEMES_HERO, type WhatsNewHero } from "./heroes";export interface HighlightCopy {title: string;@@ -21,6 +22,8 @@ export interface WhatsNewHighlight {/** English is required; a missing locale falls back to it. */copy: { en: HighlightCopy } & Partial<Record<SupportedLocale, HighlightCopy>>;action?: HighlightAction;+ /** Puts the highlight in the What's new deck; highlights without one stay in the panel. */+ hero?: WhatsNewHero;}export interface WhatsNewRelease extends ReleaseStamp {@@ -42,6 +45,7 @@ export const WHATS_NEW_RELEASES: WhatsNewRelease[] = [{id: "community-themes",icon: Palette,+ hero: THEMES_HERO,action: { kind: "route", to: (p) => `${p.settings()}?tab=appearance` },copy: {en: {@@ -73,6 +77,7 @@ export const WHATS_NEW_RELEASES: WhatsNewRelease[] = [{id: "environment-controls",icon: Server,+ hero: ENVIRONMENTS_HERO,copy: {en: {title: "Run an issue's services from its sidebar",@@ -103,6 +108,7 @@ export const WHATS_NEW_RELEASES: WhatsNewRelease[] = [{id: "chat-annotations",icon: Quote,+ hero: ANNOTATIONS_HERO,action: { kind: "route", to: (p) => p.chat() },copy: {en: {diff --git a/packages/views/whats-new/whats-new-deck.test.tsx b/packages/views/whats-new/whats-new-deck.test.tsxnew file mode 100644index 0000000000..1ece68b372--- /dev/null+++ b/packages/views/whats-new/whats-new-deck.test.tsx@@ -0,0 +1,284 @@+import { act, fireEvent, render, screen, within } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { I18nProvider } from "@multica/core/i18n/react";+import { useSessionPromptStore } from "@multica/core/session-prompt";+import type { User } from "@multica/core/types";+import { Command, Globe, Terminal } from "@multica/ui/icons";+import enCommon from "../locales/en/common.json";+import enLayout from "../locales/en/layout.json";+import type { WhatsNewRelease } from "./releases";+import { WHATS_NEW_DECK_DELAY_MS, WHATS_NEW_DECK_RETRY_MS, WhatsNewDeck } from "./whats-new-deck";++const mocks = vi.hoisted(() => ({ push: vi.fn(), markWhatsNewSeen: vi.fn() }));++const stores = vi.hoisted(() => {+ // eslint-disable-next-line @typescript-eslint/no-require-imports+ const { create } = require("zustand") as typeof import("zustand");+ return {+ auth: create<{ user: Partial<User> | null }>(() => ({ user: null })),+ chat: create<{ isOpen: boolean; floatingChatEnabled: boolean }>(() => ({+ isOpen: false,+ floatingChatEnabled: true,+ })),+ };+});++vi.mock("@multica/core/auth", () => ({ useAuthStore: stores.auth }));+vi.mock("@multica/core/chat", () => ({ useChatStore: stores.chat }));+vi.mock("@multica/core/paths", async () => {+ const actual = await vi.importActual<typeof import("@multica/core/paths")>("@multica/core/paths");+ return {+ ...actual,+ useWorkspacePaths: () => ({ chat: () => "/acme/chat", runtimes: () => "/acme/runtimes" }),+ useCurrentWorkspace: () => ({ id: "ws-1", slug: "acme" }),+ };+});+vi.mock("@multica/core/whats-new", async () => {+ const actual = await vi.importActual<typeof import("@multica/core/whats-new")>("@multica/core/whats-new");+ return { ...actual, markWhatsNewSeen: mocks.markWhatsNewSeen };+});+vi.mock("../navigation", () => ({ useNavigation: () => ({ pathname: "/acme/issues", push: mocks.push }) }));++const ART = { ground: "brand" as const, Art: () => <div data-testid="hero-art" /> };++const RELEASES: WhatsNewRelease[] = [+ {+ version: "0.3.0",+ date: "2026-03-01",+ highlights: [+ {+ id: "palette",+ icon: Command,+ hero: ART,+ action: { kind: "command-palette" },+ copy: { en: { title: "Palette title", body: "Palette body" } },+ },+ {+ id: "runtimes",+ icon: Terminal,+ hero: ART,+ action: { kind: "route", to: (p) => p.runtimes() },+ copy: { en: { title: "Runtimes title", body: "Runtimes body" } },+ },+ { id: "plain", icon: Globe, copy: { en: { title: "Plain title", body: "Plain body" } } },+ ],+ },+ {+ version: "0.2.0",+ date: "2026-02-01",+ highlights: [{ id: "language", icon: Globe, hero: ART, copy: { en: { title: "Language title", body: "Language body" } } }],+ },+ {+ version: "0.1.0",+ date: "2026-01-01",+ highlights: [{ id: "old", icon: Globe, copy: { en: { title: "Old title", body: "Old body" } } }],+ },+];++vi.mock("./releases", async () => {+ const actual = await vi.importActual<typeof import("./releases")>("./releases");+ return {+ ...actual,+ get WHATS_NEW_RELEASES() {+ return RELEASES;+ },+ };+});++function signIn(user: Partial<User> = {}) {+ stores.auth.setState({+ user: {+ id: "u1",+ created_at: "2026-01-15T08:00:00Z",+ whats_new_seen_version: null,+ // Already answered the source survey, so it does not claim the session.+ onboarded_at: "2026-01-01T00:00:00Z",+ onboarding_questionnaire: { source: ["friend"] },+ ...user,+ },+ });+}++function renderDeck() {+ return render(+ <I18nProvider locale="en" resources={{ en: { common: enCommon, layout: enLayout } }}>+ <WhatsNewDeck />+ </I18nProvider>,+ );+}++async function wait(ms: number) {+ await act(async () => {+ await vi.advanceTimersByTimeAsync(ms);+ });+}++const title = (name: string) => screen.queryByRole("heading", { name });++beforeEach(() => {+ vi.useFakeTimers({ shouldAdvanceTime: true });+ mocks.markWhatsNewSeen.mockResolvedValue(undefined);+ stores.chat.setState({ isOpen: false });+ useSessionPromptStore.setState({ prompted: false });+ signIn();+});++afterEach(() => {+ window.localStorage.removeItem("multica.source_backfill.dismiss.u1");+ vi.useRealTimers();+ vi.clearAllMocks();+});++describe("WhatsNewDeck", () => {+ it("deals the releases since signup, newest first, a moment after the app opens", async () => {+ renderDeck();+ await wait(WHATS_NEW_DECK_DELAY_MS - 100);+ expect(title("Palette title")).not.toBeInTheDocument();++ await wait(100);+ expect(title("Palette title")).toBeInTheDocument();+ expect(within(screen.getByRole("group", { name: "Palette title" })).getByText("v0.3.0 · Mar 1")).toBeInTheDocument();+ // 0.1.0 shipped before the account existed.+ expect(screen.getAllByRole("button", { name: /^Update \d of 3$/ })).toHaveLength(3);+ expect(useSessionPromptStore.getState().prompted).toBe(true);+ });++ it("walks the deck with Next and marks the newest release seen on Got it", async () => {+ renderDeck();+ await wait(WHATS_NEW_DECK_DELAY_MS);++ fireEvent.click(screen.getByRole("button", { name: "Next" }));+ expect(title("Runtimes title")).toBeInTheDocument();+ expect(title("Palette title")).not.toBeInTheDocument();+ fireEvent.click(screen.getByRole("button", { name: "Next" }));+ expect(title("Language title")).toBeInTheDocument();+ expect(mocks.markWhatsNewSeen).not.toHaveBeenCalled();++ fireEvent.click(screen.getByRole("button", { name: "Got it" }));+ expect(mocks.markWhatsNewSeen).toHaveBeenCalledWith("0.3.0");+ await wait(300);+ expect(title("Language title")).not.toBeInTheDocument();+ });++ it("jumps to a card from its dot", async () => {+ renderDeck();+ await wait(WHATS_NEW_DECK_DELAY_MS);++ fireEvent.click(screen.getByRole("button", { name: "Update 3 of 3" }));+ expect(title("Language title")).toBeInTheDocument();+ expect(screen.getByRole("button", { name: "Got it" })).toBeInTheDocument();+ });++ it("closes every card at once from the close button", async () => {+ renderDeck();+ await wait(WHATS_NEW_DECK_DELAY_MS);++ fireEvent.click(screen.getByRole("button", { name: "Close" }));+ expect(mocks.markWhatsNewSeen).toHaveBeenCalledWith("0.3.0");+ await wait(300);+ expect(screen.queryByRole("region", { name: "What's new" })).not.toBeInTheDocument();+ });++ it("follows a card's action and puts the deck away", async () => {+ renderDeck();+ await wait(WHATS_NEW_DECK_DELAY_MS);++ fireEvent.click(screen.getByRole("button", { name: "Next" }));+ fireEvent.click(screen.getByRole("button", { name: /Open/ }));+ expect(mocks.push).toHaveBeenCalledWith("/acme/runtimes");+ expect(mocks.markWhatsNewSeen).toHaveBeenCalledWith("0.3.0");+ });++ it("answers arrow keys and Escape only while focus is inside", async () => {+ renderDeck();+ await wait(WHATS_NEW_DECK_DELAY_MS);++ fireEvent.keyDown(document.body, { key: "ArrowRight" });+ expect(title("Palette title")).toBeInTheDocument();++ const next = screen.getByRole("button", { name: "Next" });+ fireEvent.keyDown(next, { key: "ArrowRight" });+ expect(title("Runtimes title")).toBeInTheDocument();+ fireEvent.keyDown(screen.getByRole("button", { name: "Next" }), { key: "ArrowLeft" });+ expect(title("Palette title")).toBeInTheDocument();++ fireEvent.keyDown(screen.getByRole("button", { name: "Next" }), { key: "Escape" });+ expect(mocks.markWhatsNewSeen).toHaveBeenCalledWith("0.3.0");+ });++ it("waits for the chat window to close before dealing", async () => {+ stores.chat.setState({ isOpen: true });+ renderDeck();+ await wait(WHATS_NEW_DECK_DELAY_MS);+ expect(title("Palette title")).not.toBeInTheDocument();+ expect(useSessionPromptStore.getState().prompted).toBe(false);++ act(() => stores.chat.setState({ isOpen: false }));+ await wait(WHATS_NEW_DECK_RETRY_MS);+ expect(title("Palette title")).toBeInTheDocument();+ });++ it("steps behind the chat window and comes back on the same card", async () => {+ renderDeck();+ await wait(WHATS_NEW_DECK_DELAY_MS);+ fireEvent.click(screen.getByRole("button", { name: "Next" }));++ act(() => stores.chat.setState({ isOpen: true }));+ expect(title("Runtimes title")).not.toBeInTheDocument();+ act(() => stores.chat.setState({ isOpen: false }));+ expect(title("Runtimes title")).toBeInTheDocument();+ });++ it("stays away once the session has had its interruption", async () => {+ useSessionPromptStore.setState({ prompted: true });+ renderDeck();+ await wait(WHATS_NEW_DECK_DELAY_MS + WHATS_NEW_DECK_RETRY_MS);+ expect(title("Palette title")).not.toBeInTheDocument();+ });++ it("leaves the session to the source survey when it is due", async () => {+ signIn({ onboarding_questionnaire: undefined });+ renderDeck();+ await wait(WHATS_NEW_DECK_DELAY_MS);+ expect(title("Palette title")).not.toBeInTheDocument();+ expect(useSessionPromptStore.getState().prompted).toBe(false);+ });++ it("leaves highlights without hero art to the What's new panel", async () => {+ renderDeck();+ await wait(WHATS_NEW_DECK_DELAY_MS);+ expect(screen.queryByRole("heading", { name: "Plain title", hidden: true })).not.toBeInTheDocument();+ expect(screen.getAllByTestId("hero-art")).toHaveLength(3);+ });++ it("stays away when no unread highlight has hero art", async () => {+ RELEASES[0]!.highlights.forEach((h) => (h.hero = undefined));+ try {+ signIn({ whats_new_seen_version: "0.2.0" });+ renderDeck();+ await wait(WHATS_NEW_DECK_DELAY_MS);+ expect(screen.queryByRole("region", { name: "What's new" })).not.toBeInTheDocument();+ expect(useSessionPromptStore.getState().prompted).toBe(false);+ } finally {+ RELEASES[0]!.highlights[0]!.hero = ART;+ RELEASES[0]!.highlights[1]!.hero = ART;+ }+ });++ it("has nothing to deal once the newest release is seen", async () => {+ signIn({ whats_new_seen_version: "0.3.0" });+ renderDeck();+ await wait(WHATS_NEW_DECK_DELAY_MS);+ expect(screen.queryByRole("region", { name: "What's new" })).not.toBeInTheDocument();+ expect(useSessionPromptStore.getState().prompted).toBe(false);+ });++ it("goes away when the release is marked seen elsewhere", async () => {+ renderDeck();+ await wait(WHATS_NEW_DECK_DELAY_MS);+ expect(title("Palette title")).toBeInTheDocument();++ act(() => signIn({ whats_new_seen_version: "0.3.0" }));+ expect(title("Palette title")).not.toBeInTheDocument();+ });+});diff --git a/packages/views/whats-new/whats-new-deck.tsx b/packages/views/whats-new/whats-new-deck.tsxnew file mode 100644index 0000000000..c9ea9adeb8--- /dev/null+++ b/packages/views/whats-new/whats-new-deck.tsx@@ -0,0 +1,352 @@+"use client";++import {+ useEffect,+ useId,+ useLayoutEffect,+ useMemo,+ useRef,+ useState,+ type CSSProperties,+ type KeyboardEvent,+} from "react";+import { ArrowRight, X } from "@multica/ui/icons";+import { Button } from "@multica/ui/components/ui/button";+import { cn } from "@multica/ui/lib/utils";+import { useAuthStore } from "@multica/core/auth";+import { useChatStore } from "@multica/core/chat";+import { needsSourceBackfill } from "@multica/core/onboarding";+import { useCurrentWorkspace, useWorkspacePaths } from "@multica/core/paths";+import { useSessionPromptStore } from "@multica/core/session-prompt";+import { isFloatingChatRouteSuppressed } from "../chat/floating-chat-visibility";+import { isQuietMoment } from "../common/quiet-moment";+import { useT } from "../i18n";+import { useNavigation } from "../navigation";+import { readSourceBackfillDismissCount } from "../onboarding/source-backfill-dismiss";+import { HighlightActionButton } from "./highlight-action";+import { HeroFrame, type WhatsNewHero } from "./heroes";+import { highlightCopy, type WhatsNewHighlight, type WhatsNewRelease } from "./releases";+import { useWhatsNew } from "./use-whats-new";+import { formatReleaseDate, versionLabel } from "./whats-new-panel";++/** Long enough for the workspace to render and for the source survey (700ms) to claim the session first. */+export const WHATS_NEW_DECK_DELAY_MS = 3000;+/** How often a busy moment (typing, a dialog, the chat window) is checked again. */+export const WHATS_NEW_DECK_RETRY_MS = 5000;+export const WHATS_NEW_DECK_MAX_CARDS = 5;++const LEAVE_MS = 220;+const EASE = "cubic-bezier(0.2, 0.8, 0.2, 1)";+const MOVE = `transform 420ms ${EASE}, opacity 260ms ${EASE}, height 320ms ${EASE}`;+interface DeckCard {+ release: WhatsNewRelease;+ highlight: WhatsNewHighlight;+ hero: WhatsNewHero;+}++/** Only highlights with hero art are dealt; the rest stay in the What's new panel. */+function deckCards(unread: readonly WhatsNewRelease[]): DeckCard[] {+ return unread+ .flatMap((release) =>+ release.highlights.flatMap((highlight) => (highlight.hero ? [{ release, highlight, hero: highlight.hero }] : [])),+ )+ .slice(0, WHATS_NEW_DECK_MAX_CARDS);+}++/**+ * Unread release highlights as a deck of cards in the star prompt's corner.+ * Opens once per app session when nothing else is happening; closing it marks+ * the release seen, and the highlights stay in What's new in the Help menu.+ */+export function WhatsNewDeck() {+ // Shells mount this while the workspace slug is still resolving.+ const wsId = useCurrentWorkspace()?.id ?? null;+ const { unread, markSeen } = useWhatsNew();+ const chatOpen = useChatStore((s) => s.isOpen);+ const floatingChatEnabled = useChatStore((s) => s.floatingChatEnabled);+ const { pathname } = useNavigation();+ const chatPath = useWorkspacePaths().chat();+ const launcherVisible =+ floatingChatEnabled && !chatOpen && !isFloatingChatRouteSuppressed(pathname, chatPath);+ const [cards, setCards] = useState<DeckCard[] | null>(null);+ const [leaving, setLeaving] = useState(false);++ const hasUnread = unread.length > 0;+ const dealable = useMemo(() => deckCards(unread), [unread]);+ const dealableRef = useRef(dealable);+ dealableRef.current = dealable;+ const hasDealable = dealable.length > 0;++ useEffect(() => {+ if (cards || !wsId || !hasDealable) return;+ let timer: number | undefined;+ const consider = () => {+ if (useSessionPromptStore.getState().prompted) return;+ const user = useAuthStore.getState().user;+ // The attribution survey owns this session's one interruption.+ if (needsSourceBackfill(user, readSourceBackfillDismissCount(user?.id))) return;+ if (useChatStore.getState().isOpen || !isQuietMoment()) {+ timer = window.setTimeout(consider, WHATS_NEW_DECK_RETRY_MS);+ return;+ }+ useSessionPromptStore.getState().markPrompted();+ setCards(dealableRef.current);+ };+ timer = window.setTimeout(consider, WHATS_NEW_DECK_DELAY_MS);+ return () => window.clearTimeout(timer);+ }, [cards, wsId, hasDealable]);++ useEffect(() => {+ if (!leaving) return;+ const timer = window.setTimeout(() => {+ setCards(null);+ setLeaving(false);+ }, LEAVE_MS);+ return () => window.clearTimeout(timer);+ }, [leaving]);++ // Opening What's new from the Help menu also marks the release seen.+ if (!cards || (!hasUnread && !leaving)) return null;++ const finish = () => {+ markSeen();+ setLeaving(true);+ };++ return (+ <Deck+ cards={cards}+ leaving={leaving}+ // The chat window covers this corner while it is open; the deck keeps its place behind it.+ hidden={chatOpen}+ onFinish={finish}+ className={launcherVisible ? "above-chat-launcher" : "bottom-[var(--chat-launcher-inset)]"}+ />+ );+}++function deckStyle(offset: number, height: number | undefined): CSSProperties {+ if (offset < 0) {+ return { transform: "translate(-14%, 28px) rotate(-6deg) scale(0.96)", opacity: 0, zIndex: 40, height };+ }+ if (offset === 0) return { transform: "none", opacity: 1, zIndex: 30, height };+ const depth = Math.min(offset, 3);+ return {+ transform: `translateY(${-depth * 10}px) scale(${1 - depth * 0.05})`,+ // Two cards peek out behind the front one; the rest wait out of sight.+ opacity: offset > 2 ? 0 : 1,+ zIndex: 30 - depth,+ height,+ };+}++function useHeights(count: number) {+ const nodes = useRef<(HTMLDivElement | null)[]>([]);+ const [heights, setHeights] = useState<number[]>([]);+ useLayoutEffect(() => {+ const measure = () => setHeights(nodes.current.slice(0, count).map((n) => n?.offsetHeight ?? 0));+ measure();+ const ro = new ResizeObserver(measure);+ nodes.current.slice(0, count).forEach((n) => n && ro.observe(n));+ return () => ro.disconnect();+ }, [count]);+ return { heights, refAt: (i: number) => (n: HTMLDivElement | null) => void (nodes.current[i] = n) };+}++function Deck({+ cards,+ leaving,+ hidden,+ onFinish,+ className,+}: {+ cards: DeckCard[];+ leaving: boolean;+ hidden: boolean;+ onFinish: () => void;+ className: string;+}) {+ const { t } = useT("layout");+ const [index, setIndex] = useState(0);+ const { heights, refAt } = useHeights(cards.length);+ const deckRef = useRef<HTMLElement>(null);+ const primaryRefs = useRef<(HTMLButtonElement | null)[]>([]);+ const refocus = useRef(false);+ const count = cards.length;+ const last = index === count - 1;+ const frontHeight = heights[index] || undefined;++ // The pressed button goes inert with its card; hand focus to the new front card.+ useEffect(() => {+ if (!refocus.current) return;+ refocus.current = false;+ primaryRefs.current[index]?.focus({ preventScroll: true });+ }, [index]);++ const go = (i: number) => {+ const target = Math.max(0, Math.min(count - 1, i));+ if (target === index) return;+ refocus.current = deckRef.current?.contains(document.activeElement) ?? false;+ setIndex(target);+ };+ const next = () => (last ? onFinish() : go(index + 1));++ const onKeyDown = (e: KeyboardEvent) => {+ if (e.key === "ArrowRight") go(index + 1);+ else if (e.key === "ArrowLeft") go(index - 1);+ else if (e.key === "Escape") onFinish();+ else return;+ e.preventDefault();+ };++ return (+ <section+ ref={deckRef}+ aria-label={t(($) => $.whats_new.trigger)}+ data-slot="whats-new-deck"+ hidden={hidden}+ onKeyDown={onKeyDown}+ className={cn(+ "absolute right-[var(--chat-launcher-inset)] z-50 w-[min(23.75rem,calc(100%-2*var(--chat-launcher-inset)))]",+ "animate-in fade-in-0 slide-in-from-bottom-3 duration-300 motion-reduce:animate-none",+ className,+ )}+ style={{+ height: frontHeight,+ transition: MOVE,+ opacity: leaving ? 0 : 1,+ transform: leaving ? "translateY(12px)" : undefined,+ }}+ >+ {cards.map((card, i) => {+ const offset = i - index;+ return (+ <div+ key={`${card.release.version}:${card.highlight.id}`}+ className="absolute right-0 bottom-0 w-full origin-top overflow-hidden rounded-xl bg-surface-raised text-popover-foreground shadow-[var(--floating-shadow)] ring-1 ring-floating-border motion-reduce:!transition-none"+ style={{+ ...deckStyle(offset, offset === 0 ? heights[i] || undefined : frontHeight),+ transition: MOVE,+ pointerEvents: offset < 0 ? "none" : undefined,+ }}+ >+ <UpdateCard+ ref={refAt(i)}+ card={card}+ front={offset === 0}+ count={count}+ index={index}+ primaryRef={(n) => void (primaryRefs.current[i] = n)}+ onNext={next}+ onSelect={go}+ onFinish={onFinish}+ />+ {/* Cards further back read as further away; the first one back advances the deck. */}+ {offset > 0 && (+ <div+ aria-hidden="true"+ onClick={offset === 1 ? () => go(i) : undefined}+ className={cn(+ "absolute inset-0 bg-surface-raised transition-opacity duration-300",+ offset === 1 && "cursor-pointer",+ )}+ style={{ opacity: Math.min(offset, 2) * 0.28 }}+ />+ )}+ </div>+ );+ })}+ </section>+ );+}++function UpdateCard({+ ref,+ card,+ front,+ count,+ index,+ primaryRef,+ onNext,+ onSelect,+ onFinish,+}: {+ ref: (n: HTMLDivElement | null) => void;+ card: DeckCard;+ front: boolean;+ count: number;+ index: number;+ primaryRef: (n: HTMLButtonElement | null) => void;+ onNext: () => void;+ onSelect: (i: number) => void;+ onFinish: () => void;+}) {+ const { t, i18n } = useT("layout");+ const titleId = useId();+ const { release, highlight, hero } = card;+ const copy = highlightCopy(highlight, i18n.language);+ const last = index === count - 1;++ return (+ <div ref={ref} inert={!front} aria-hidden={!front} role="group" aria-labelledby={titleId}>+ <div className="relative">+ <HeroFrame hero={hero} />+ <Button+ variant="ghost"+ size="icon-xs"+ aria-label={t(($) => $.whats_new.panel.close)}+ onClick={onFinish}+ className="absolute top-2.5 right-2.5 bg-surface-raised/90 text-muted-foreground shadow-sm hover:bg-surface-raised"+ >+ <X />+ </Button>+ </div>+ <div className="px-5 pt-4 pb-4">+ <div className="flex items-center gap-2 text-micro">+ <span className="inline-flex h-[18px] items-center rounded-xs bg-brand/10 px-1.5 font-medium text-brand">+ {t(($) => $.whats_new.deck.tag)}+ </span>+ <span className="text-muted-foreground tabular-nums">+ {versionLabel(release.version)} · {formatReleaseDate(release.date, i18n.language)}+ </span>+ </div>+ <h2 id={titleId} className="mt-2 text-body-lg font-semibold [overflow-wrap:anywhere]">+ {copy.title}+ </h2>+ <p className="mt-1 text-label text-muted-foreground">{copy.body}</p>+ <div className="mt-4 flex items-center gap-3">+ {count > 1 && <Dots count={count} index={index} onSelect={onSelect} />}+ <div className="ml-auto flex items-center gap-3">+ {highlight.action && <HighlightActionButton action={highlight.action} onDone={onFinish} />}+ <Button ref={primaryRef} size="sm" onClick={onNext}>+ {last ? t(($) => $.whats_new.deck.done) : t(($) => $.whats_new.deck.next)}+ {!last && <ArrowRight data-icon="inline-end" />}+ </Button>+ </div>+ </div>+ </div>+ </div>+ );+}++function Dots({ count, index, onSelect }: { count: number; index: number; onSelect: (i: number) => void }) {+ const { t } = useT("layout");+ return (+ <div className="flex items-center gap-1">+ {Array.from({ length: count }, (_, i) => (+ <button+ key={i}+ type="button"+ aria-label={t(($) => $.whats_new.deck.page, { current: i + 1, total: count })}+ aria-current={i === index ? "step" : undefined}+ onClick={() => onSelect(i)}+ className={cn(+ // eslint-disable-next-line no-restricted-syntax -- page dots+ "h-1.5 cursor-pointer rounded-full outline-none transition-[width,background-color] duration-200 focus-visible:ring-2 focus-visible:ring-ring/50",+ i === index ? "w-4 bg-foreground" : "w-1.5 bg-muted-foreground/30 hover:bg-muted-foreground/60",+ )}+ />+ ))}+ </div>+ );+}diff --git a/packages/views/whats-new/whats-new-panel.tsx b/packages/views/whats-new/whats-new-panel.tsxindex 3fe111b3b8..422bab1d6a 100644--- a/packages/views/whats-new/whats-new-panel.tsx+++ b/packages/views/whats-new/whats-new-panel.tsx@@ -9,7 +9,7 @@ import { CHANGELOG_URL } from "../layout/help-links";import { HighlightActionButton } from "./highlight-action";import { highlightCopy, type WhatsNewRelease } from "./releases";-function versionLabel(version: string) {+export function versionLabel(version: string) {return `v${version}`;}@@ -17,7 +17,7 @@ function releaseAnchor(version: string) {return `${CHANGELOG_URL}#release-${version.replace(/\./g, "-")}`;}-function formatReleaseDate(date: string, language: string) {+export function formatReleaseDate(date: string, language: string) {const parsed = new Date(`${date}T00:00:00Z`);if (Number.isNaN(parsed.getTime())) return date;return new Intl.DateTimeFormat(language, { month: "short", day: "numeric", timeZone: "UTC" }).format(parsed);