Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

MUL-8621 feat(whats-new): drop the rail launcher and update card, keep a quieter What's new in the Help menu (#9952)

Jiayuan Zhang565c9128d763
diff --git a/packages/core/whats-new/index.ts b/packages/core/whats-new/index.ts
index 14e52345d0..b2a29c03b3 100644
--- a/packages/core/whats-new/index.ts
+++ b/packages/core/whats-new/index.ts
@@ -49,8 +49,8 @@ export function visibleReleases<R extends ReleaseStamp>(
* Releases the user hasn't seen. Before the first dismissal, only releases
* after the account's creation day count, so a new user isn't greeted with
* the whole backlog. Returns [] when the server can't persist the marker
- * (`whats_new_seen_version` undefined): an auto-opening card that can never
- * be dismissed would reappear on every launch.
+ * (`whats_new_seen_version` undefined): a release that can never be marked
+ * seen would stay new forever.
*/
export function unreadReleases<R extends ReleaseStamp>(
visible: readonly R[],
@@ -67,8 +67,8 @@ export function unreadReleases<R extends ReleaseStamp>(
}
/**
- * Persists the dismissal. Applied optimistically so the rail dot clears at
- * once, and rolled back on failure so the dot returns and the next open
+ * Persists the dismissal. Applied optimistically so the release stops
+ * counting as new at once, and rolled back on failure so the next open
* retries. The server only advances the marker, so the response may carry a
* newer version than `version`.
*/
diff --git a/packages/views/layout/app-rail.test.tsx b/packages/views/layout/app-rail.test.tsx
index 40d6f64369..d9b44f2927 100644
--- a/packages/views/layout/app-rail.test.tsx
+++ b/packages/views/layout/app-rail.test.tsx
@@ -62,7 +62,6 @@ vi.mock("./panels/team-status", () => ({
}));
vi.mock("./rail-workspaces", () => ({ RailWorkspaces: () => null }));
vi.mock("./help-launcher", () => ({ HelpLauncher: () => null }));
-vi.mock("../whats-new/whats-new-launcher", () => ({ WhatsNewLauncher: () => null }));
vi.mock("./account-menu", () => ({ AccountMenu: () => null }));
vi.mock("@multica/ui/components/common/tooltip-hint", () => ({
TooltipHint: ({ children }: { children: ReactNode }) => <>{children}</>,
diff --git a/packages/views/layout/app-rail.tsx b/packages/views/layout/app-rail.tsx
index 968f296863..cb361c9703 100644
--- a/packages/views/layout/app-rail.tsx
+++ b/packages/views/layout/app-rail.tsx
@@ -20,7 +20,6 @@ import { cn } from "@multica/ui/lib/utils";
import { useAppForeground } from "../common/use-app-foreground";
import { useT } from "../i18n";
import { AppLink, useNavigation } from "../navigation";
-import { WhatsNewLauncher } from "../whats-new/whats-new-launcher";
import { AccountMenu } from "./account-menu";
import { useAppShell } from "./app-shell-context";
import { NewIssueButton, SearchButton } from "./global-actions";
@@ -244,7 +243,6 @@ export function AppRail({
))}
</ul>
<div className="mt-auto flex flex-col items-center gap-1 pt-2">
- <WhatsNewLauncher />
<HelpLauncher />
<TooltipHint label={t(($) => $.nav.settings)} side="right">
<AppLink
diff --git a/packages/views/layout/help-launcher.test.tsx b/packages/views/layout/help-launcher.test.tsx
index 3bdf96f9f5..87a90a02a9 100644
--- a/packages/views/layout/help-launcher.test.tsx
+++ b/packages/views/layout/help-launcher.test.tsx
@@ -13,8 +13,8 @@ vi.mock("../platform/local-directory", () => ({
isDesktopShell: vi.fn(() => false),
}));
-// The What's new entry is covered with the real menu in whats-new-launcher.test.tsx.
-vi.mock("../whats-new/whats-new-launcher", () => ({
+// The What's new entry is covered with the real menu in whats-new-menu-panel.test.tsx.
+vi.mock("../whats-new/whats-new-menu-panel", () => ({
useWhatsNewMenuPanel: () => ({ available: false }),
WhatsNewMenuPanel: () => null,
}));
diff --git a/packages/views/layout/help-launcher.tsx b/packages/views/layout/help-launcher.tsx
index 90c3990991..52ae57c6b5 100644
--- a/packages/views/layout/help-launcher.tsx
+++ b/packages/views/layout/help-launcher.tsx
@@ -28,7 +28,7 @@ import { useT } from "../i18n";
import { docsLocalePrefix } from "../common/docs-locale";
import { RAIL_ICON_BUTTON_CLASS } from "./rail-styles";
import { CHANGELOG_URL, DOCS_URL, DOWNLOAD_URL } from "./help-links";
-import { useWhatsNewMenuPanel, WhatsNewMenuPanel } from "../whats-new/whats-new-launcher";
+import { useWhatsNewMenuPanel, WhatsNewMenuPanel } from "../whats-new/whats-new-menu-panel";
export function HelpLauncher() {
@@ -99,6 +99,14 @@ export function HelpLauncher() {
<DropdownMenuItem onClick={whatsNew.show}>
<Megaphone className="h-3.5 w-3.5" />
{t(($) => $.whats_new.trigger)}
+ {whatsNew.newestUnread && (
+ <span
+ data-slot="whats-new-tag"
+ className="ml-auto text-caption font-medium text-brand tabular-nums"
+ >
+ {`v${whatsNew.newestUnread}`}
+ </span>
+ )}
</DropdownMenuItem>
)}
<DropdownMenuItem
diff --git a/packages/views/locales/en/layout.json b/packages/views/locales/en/layout.json
index 1169bc3126..4bee456459 100644
--- a/packages/views/locales/en/layout.json
+++ b/packages/views/locales/en/layout.json
@@ -40,14 +40,6 @@
},
"whats_new": {
"trigger": "What's new",
- "card": {
- "eyebrow": "Multica updated · {{range}}",
- "title_one": "{{count}} new feature since your last visit",
- "title_other": "{{count}} new features since your last visit",
- "dismiss": "Dismiss",
- "view_details": "View details",
- "got_it": "Got it"
- },
"panel": {
"title": "What's new",
"close": "Close",
diff --git a/packages/views/locales/es/layout.json b/packages/views/locales/es/layout.json
index 5e771ab94f..884cb4b110 100644
--- a/packages/views/locales/es/layout.json
+++ b/packages/views/locales/es/layout.json
@@ -65,14 +65,6 @@
},
"whats_new": {
"trigger": "Novedades",
- "card": {
- "eyebrow": "Multica se ha actualizado · {{range}}",
- "title_one": "{{count}} función nueva desde tu última visita",
- "title_other": "{{count}} funciones nuevas desde tu última visita",
- "dismiss": "Descartar",
- "view_details": "Ver detalles",
- "got_it": "Entendido"
- },
"panel": {
"title": "Novedades",
"close": "Cerrar",
diff --git a/packages/views/locales/fr/layout.json b/packages/views/locales/fr/layout.json
index 2fb9573b12..8cb1da894b 100644
--- a/packages/views/locales/fr/layout.json
+++ b/packages/views/locales/fr/layout.json
@@ -40,14 +40,6 @@
},
"whats_new": {
"trigger": "Nouveautés",
- "card": {
- "eyebrow": "Multica mis à jour · {{range}}",
- "title_one": "{{count}} nouveauté depuis votre dernière visite",
- "title_other": "{{count}} nouveautés depuis votre dernière visite",
- "dismiss": "Fermer",
- "view_details": "Voir le détail",
- "got_it": "Compris"
- },
"panel": {
"title": "Nouveautés",
"close": "Fermer",
diff --git a/packages/views/locales/ja/layout.json b/packages/views/locales/ja/layout.json
index 9bf7625aef..1713b6ad98 100644
--- a/packages/views/locales/ja/layout.json
+++ b/packages/views/locales/ja/layout.json
@@ -40,13 +40,6 @@
},
"whats_new": {
"trigger": "新機能",
- "card": {
- "eyebrow": "Multica が更新されました · {{range}}",
- "title_other": "前回の訪問以降、{{count}} 件の新機能が追加されました",
- "dismiss": "閉じる",
- "view_details": "詳細を見る",
- "got_it": "了解"
- },
"panel": {
"title": "新機能",
"close": "閉じる",
diff --git a/packages/views/locales/ko/layout.json b/packages/views/locales/ko/layout.json
index e21b53caf1..260ca5a2b5 100644
--- a/packages/views/locales/ko/layout.json
+++ b/packages/views/locales/ko/layout.json
@@ -40,13 +40,6 @@
},
"whats_new": {
"trigger": "새 기능",
- "card": {
- "eyebrow": "Multica 업데이트 · {{range}}",
- "title_other": "마지막 방문 이후 새 기능 {{count}}개가 추가되었습니다",
- "dismiss": "닫기",
- "view_details": "자세히 보기",
- "got_it": "확인"
- },
"panel": {
"title": "새 기능",
"close": "닫기",
diff --git a/packages/views/locales/zh-Hans/layout.json b/packages/views/locales/zh-Hans/layout.json
index 50937a8536..7123c53c3e 100644
--- a/packages/views/locales/zh-Hans/layout.json
+++ b/packages/views/locales/zh-Hans/layout.json
@@ -40,13 +40,6 @@
},
"whats_new": {
"trigger": "新功能",
- "card": {
- "eyebrow": "Multica 已更新 · {{range}}",
- "title_other": "自你上次访问以来,新增了 {{count}} 项功能",
- "dismiss": "关闭",
- "view_details": "查看详情",
- "got_it": "知道了"
- },
"panel": {
"title": "新功能",
"close": "关闭",
diff --git a/packages/views/locales/zh-Hant/layout.json b/packages/views/locales/zh-Hant/layout.json
index 859892dec1..c0ea98fe15 100644
--- a/packages/views/locales/zh-Hant/layout.json
+++ b/packages/views/locales/zh-Hant/layout.json
@@ -40,13 +40,6 @@
},
"whats_new": {
"trigger": "新功能",
- "card": {
- "eyebrow": "Multica 已更新 · {{range}}",
- "title_other": "自你上次造訪以來,新增了 {{count}} 項功能",
- "dismiss": "關閉",
- "view_details": "查看詳情",
- "got_it": "知道了"
- },
"panel": {
"title": "新功能",
"close": "關閉",
diff --git a/packages/views/whats-new/highlight-action.tsx b/packages/views/whats-new/highlight-action.tsx
index c8c16c523d..30406f9464 100644
--- a/packages/views/whats-new/highlight-action.tsx
+++ b/packages/views/whats-new/highlight-action.tsx
@@ -1,9 +1,8 @@
"use client";
import { ArrowRight, ArrowUpRight } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
-import { useShortcut } from "@multica/core/shortcuts";
import { useWorkspacePaths } from "@multica/core/paths";
+import { useShortcut } from "@multica/core/shortcuts";
import { ShortcutKeycaps } from "../common/shortcut-keycaps";
import { useT } from "../i18n";
import { useNavigation } from "../navigation";
@@ -12,35 +11,16 @@ import type { HighlightAction } from "./releases";
/**
* The call to action of one highlight. `onDone` runs after the action fires
- * so the surrounding surface can close and record the dismissal.
+ * so the surrounding panel can close.
*/
-export function HighlightActionButton({
- action,
- variant,
- onDone,
-}: {
- action: HighlightAction;
- /** "button" in the update card, "link" in the history panel. */
- variant: "button" | "link";
- onDone: () => void;
-}) {
+export function HighlightActionButton({ action, onDone }: { action: HighlightAction; onDone: () => void }) {
const { t } = useT("layout");
const navigation = useNavigation();
const paths = useWorkspacePaths();
const searchShortcut = useShortcut("openSearch");
if (action.kind === "external") {
- const label = t(($) => $.whats_new.action.learn_more);
- return variant === "button" ? (
- <Button
- variant="outline"
- size="sm"
- render={<a href={action.href} target="_blank" rel="noopener noreferrer" onClick={onDone} />}
- >
- {label}
- <ArrowUpRight className="text-faint-foreground" />
- </Button>
- ) : (
+ return (
<a
href={action.href}
target="_blank"
@@ -48,7 +28,7 @@ export function HighlightActionButton({
onClick={onDone}
className="inline-flex items-center gap-0.5 text-label font-medium text-brand hover:underline"
>
- {label}
+ {t(($) => $.whats_new.action.learn_more)}
<ArrowUpRight className="size-3.5" />
</a>
);
@@ -59,19 +39,16 @@ export function HighlightActionButton({
if (action.kind === "command-palette") useSearchStore.getState().setOpen(true);
else navigation.push(action.to(paths));
};
- const label =
- action.kind === "command-palette"
- ? t(($) => $.whats_new.action.try)
- : t(($) => $.whats_new.action.open);
-
- if (variant === "button") {
+ if (action.kind === "command-palette") {
return (
- <Button variant="outline" size="sm" onClick={run}>
- {label}
- {action.kind === "command-palette" && searchShortcut && (
- <ShortcutKeycaps shortcut={searchShortcut} decorative />
- )}
- </Button>
+ <button
+ type="button"
+ onClick={run}
+ className="inline-flex cursor-pointer items-center gap-1 text-label font-medium text-brand hover:underline"
+ >
+ {t(($) => $.whats_new.action.try)}
+ {searchShortcut && <ShortcutKeycaps shortcut={searchShortcut} decorative />}
+ </button>
);
}
return (
@@ -80,7 +57,7 @@ export function HighlightActionButton({
onClick={run}
className="inline-flex cursor-pointer items-center gap-0.5 text-label font-medium text-brand hover:underline"
>
- {label}
+ {t(($) => $.whats_new.action.open)}
<ArrowRight className="size-3.5" />
</button>
);
diff --git a/packages/views/whats-new/releases.ts b/packages/views/whats-new/releases.ts
index 6021d8126f..e3d109d857 100644
--- a/packages/views/whats-new/releases.ts
+++ b/packages/views/whats-new/releases.ts
@@ -21,8 +21,6 @@ export interface WhatsNewHighlight {
/** English is required; a missing locale falls back to it. */
copy: { en: HighlightCopy } & Partial<Record<SupportedLocale, HighlightCopy>>;
action?: HighlightAction;
- /** Image shown above the expanded highlight in the update card. */
- media?: { src: string };
}
export interface WhatsNewRelease extends ReleaseStamp {
@@ -32,8 +30,8 @@ export interface WhatsNewRelease extends ReleaseStamp {
/**
* In-app highlights per release, newest first. Not the changelog: only
* user-visible changes worth discovering, 0–3 per release, with copy that
- * says how to use the feature. Fix-only releases get no entry, so they
- * neither open the card nor light the rail dot. Versions and dates must
+ * says how to use the feature. Fix-only releases get no entry, so they are
+ * never marked as new in the panel. Versions and dates must
* match the changelog entry the highlights come from.
*/
export const WHATS_NEW_RELEASES: WhatsNewRelease[] = [
diff --git a/packages/views/whats-new/session-store.ts b/packages/views/whats-new/session-store.ts
deleted file mode 100644
index e9872c3a9b..0000000000
--- a/packages/views/whats-new/session-store.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-"use client";
-
-import { create } from "zustand";
-
-/**
- * Page-session state shared by every mounted launcher. Narrow layouts mount
- * a hidden rail and the compact nav sheet's rail side by side, and the sheet
- * remounts on every open, so a per-component flag would re-show a card the
- * user already clicked away from.
- */
-interface WhatsNewSessionStore {
- autoShown: boolean;
- markAutoShown: () => void;
-}
-
-export const useWhatsNewSessionStore = create<WhatsNewSessionStore>((set) => ({
- autoShown: false,
- markAutoShown: () => set({ autoShown: true }),
-}));
diff --git a/packages/views/whats-new/whats-new-card.tsx b/packages/views/whats-new/whats-new-card.tsx
deleted file mode 100644
index 676e9acc7d..0000000000
--- a/packages/views/whats-new/whats-new-card.tsx
+++ /dev/null
@@ -1,100 +0,0 @@
-"use client";
-
-import { useState } from "react";
-import { ChevronRight, X } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
-import { IconButton } from "@multica/ui/components/common/icon-button";
-import { useT } from "../i18n";
-import { HighlightActionButton } from "./highlight-action";
-import { highlightCopy, type WhatsNewRelease } from "./releases";
-
-/**
- * The card that opens by itself after an update: every highlight released
- * since the user's last dismissal, one expanded and the rest as rows.
- */
-export function WhatsNewCard({
- releases,
- onDismiss,
- onViewDetails,
-}: {
- /** Unread releases, newest first. */
- releases: WhatsNewRelease[];
- onDismiss: () => void;
- onViewDetails: () => void;
-}) {
- const { t, i18n } = useT("layout");
- const items = releases.flatMap((r) =>
- r.highlights.map((highlight) => ({ key: `${r.version}:${highlight.id}`, highlight })),
- );
- const [selectedKey, setSelectedKey] = useState(items[0]?.key);
- const selected = items.find((item) => item.key === selectedKey) ?? items[0];
- if (!selected) return null;
-
- const newest = releases[0]!.version;
- const oldest = releases[releases.length - 1]!.version;
- const range = newest === oldest ? `v${newest}` : `v${oldest} → v${newest}`;
- const selectedCopy = highlightCopy(selected.highlight, i18n.language);
-
- return (
- <div className="flex flex-col" data-slot="whats-new-card">
- <div className="flex items-start gap-2 pt-3.5 pr-2 pb-2.5 pl-4">
- <div className="min-w-0 flex-1">
- <p className="text-caption font-medium text-brand">
- {t(($) => $.whats_new.card.eyebrow, { range })}
- </p>
- <h2 className="mt-0.5 text-title-sm font-semibold">
- {t(($) => $.whats_new.card.title, { count: items.length })}
- </h2>
- </div>
- <IconButton label={t(($) => $.whats_new.card.dismiss)} onClick={onDismiss}>
- <X />
- </IconButton>
- </div>
-
- <div className="max-h-[min(60vh,440px)] overflow-y-auto px-1.5 pb-1">
- {selected.highlight.media && (
- <div className="mx-1.5 mb-1.5 overflow-hidden rounded-lg bg-muted ring-1 ring-surface-border">
- <img src={selected.highlight.media.src} alt="" className="h-40 w-full object-cover" />
- </div>
- )}
- <div className="rounded-md bg-accent px-3 pt-2.5 pb-3">
- <h3 className="text-body font-semibold">{selectedCopy.title}</h3>
- <p className="mt-0.5 text-label text-muted-foreground">{selectedCopy.body}</p>
- {selected.highlight.action && (
- <div className="mt-2.5">
- <HighlightActionButton action={selected.highlight.action} variant="button" onDone={onDismiss} />
- </div>
- )}
- </div>
- <ul className="mt-1">
- {items
- .filter((item) => item.key !== selected.key)
- .map((item) => (
- <li key={item.key}>
- <button
- type="button"
- onClick={() => setSelectedKey(item.key)}
- className="flex h-[34px] w-full cursor-pointer items-center gap-2.5 rounded-md px-3 text-left outline-none hover:bg-accent focus-visible:bg-accent"
- >
- <span aria-hidden className="size-1.5 shrink-0 rounded-full bg-brand" />
- <span className="min-w-0 flex-1 truncate text-body font-medium">
- {highlightCopy(item.highlight, i18n.language).title}
- </span>
- <ChevronRight className="size-3.5 shrink-0 text-faint-foreground" />
- </button>
- </li>
- ))}
- </ul>
- </div>
-
- <div className="flex items-center justify-end gap-1 border-t border-border py-2.5 pr-3 pl-4">
- <Button variant="ghost" size="sm" onClick={onViewDetails}>
- {t(($) => $.whats_new.card.view_details)}
- </Button>
- <Button size="sm" onClick={onDismiss}>
- {t(($) => $.whats_new.card.got_it)}
- </Button>
- </div>
- </div>
- );
-}
diff --git a/packages/views/whats-new/whats-new-launcher.tsx b/packages/views/whats-new/whats-new-launcher.tsx
deleted file mode 100644
index 96936b62d6..0000000000
--- a/packages/views/whats-new/whats-new-launcher.tsx
+++ /dev/null
@@ -1,155 +0,0 @@
-"use client";
-
-import { useCallback, useEffect, useRef, useState, type RefObject } from "react";
-import { Megaphone } from "@multica/ui/icons";
-import { Popover, PopoverContent, PopoverTrigger } from "@multica/ui/components/ui/popover";
-import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
-import { cn } from "@multica/ui/lib/utils";
-import { useT } from "../i18n";
-import { RAIL_ICON_BUTTON_CLASS } from "../layout/rail-styles";
-import type { WhatsNewRelease } from "./releases";
-import { useWhatsNewSessionStore } from "./session-store";
-import { useWhatsNew } from "./use-whats-new";
-import { WhatsNewCard } from "./whats-new-card";
-import { WhatsNewPanel } from "./whats-new-panel";
-
-/** Lets the workspace settle before the card slides in. */
-export const AUTO_OPEN_DELAY_MS = 1200;
-
-const POPUP_CLASS = "gap-0 overflow-hidden rounded-xl p-0";
-const EMPTY_VERSIONS: ReadonlySet<string> = new Set();
-
-type View =
- | { kind: "card"; releases: WhatsNewRelease[] }
- | { kind: "panel"; unreadVersions: ReadonlySet<string> };
-
-/** A rail can be mounted but hidden (the md:flex rail on narrow screens). */
-function isRendered(el: HTMLElement | null): boolean {
- if (!el) return false;
- return typeof el.checkVisibility === "function" ? el.checkVisibility() : true;
-}
-
-/**
- * Rail entry for unread release highlights. After an update the card opens by
- * itself once per page session, from whichever launcher is on screen;
- * dismissing it (or opening the panel) records the
- * newest release as seen. Clicking away only hides the card, so the dot
- * stays until the user acknowledges it. Once nothing is unread the button
- * leaves the rail; the history stays one click away in the Help menu.
- */
-export function WhatsNewLauncher() {
- const { t } = useT("layout");
- const { visible, unread, markSeen } = useWhatsNew();
- const [open, setOpen] = useState(false);
- // Keeps the trigger in the rail while its popup animates out: marking seen
- // empties `unread` while the popup is still visible.
- const [popupMounted, setPopupMounted] = useState(false);
- // Snapshotted on open, for the same reason.
- const [view, setView] = useState<View>({ kind: "panel", unreadVersions: EMPTY_VERSIONS });
- const triggerRef = useRef<HTMLButtonElement>(null);
- const hasUnread = unread.length > 0;
-
- useEffect(() => {
- if (unread.length === 0 || useWhatsNewSessionStore.getState().autoShown) return;
- const timer = window.setTimeout(() => {
- const session = useWhatsNewSessionStore.getState();
- if (session.autoShown || !isRendered(triggerRef.current)) return;
- session.markAutoShown();
- setView({ kind: "card", releases: unread });
- setPopupMounted(true);
- setOpen(true);
- }, AUTO_OPEN_DELAY_MS);
- return () => window.clearTimeout(timer);
- }, [unread]);
-
- if (visible.length === 0 || (!hasUnread && !popupMounted)) return null;
-
- const openPanel = () => {
- setView({ kind: "panel", unreadVersions: new Set(unread.map((r) => r.version)) });
- setPopupMounted(true);
- setOpen(true);
- markSeen();
- };
- const dismiss = () => {
- setOpen(false);
- markSeen();
- };
- const label = t(($) => $.whats_new.trigger);
-
- return (
- <Popover
- open={open}
- onOpenChange={(next, details) => {
- // Pressing the rail button while the card is up means "show me
- // everything", not "close".
- if (next || (view.kind === "card" && details.reason === "trigger-press")) openPanel();
- else setOpen(false);
- }}
- onOpenChangeComplete={(next) => {
- if (!next) setPopupMounted(false);
- }}
- >
- <TooltipHint label={label} side="right">
- <PopoverTrigger
- ref={triggerRef}
- aria-label={label}
- data-unread={hasUnread || undefined}
- className={RAIL_ICON_BUTTON_CLASS}
- >
- <Megaphone />
- {hasUnread && (
- <span
- aria-hidden
- data-slot="whats-new-dot"
- className="absolute top-1.5 right-1.5 size-2 rounded-full bg-brand ring-2 ring-app-shell"
- />
- )}
- </PopoverTrigger>
- </TooltipHint>
- <PopoverContent
- side="right"
- align="end"
- sideOffset={8}
- // An unprompted card must not pull focus out of whatever the user is typing in.
- initialFocus={view.kind === "panel"}
- className={cn(POPUP_CLASS, view.kind === "card" ? "w-[380px]" : "w-[400px]")}
- >
- {view.kind === "card" ? (
- <WhatsNewCard releases={view.releases} onDismiss={dismiss} onViewDetails={openPanel} />
- ) : (
- <WhatsNewPanel releases={visible} unreadVersions={view.unreadVersions} onClose={() => setOpen(false)} />
- )}
- </PopoverContent>
- </Popover>
- );
-}
-
-/** The release history opened from a menu rather than the rail button. */
-export function useWhatsNewMenuPanel() {
- const { visible, unread, markSeen } = useWhatsNew();
- const [open, setOpen] = useState(false);
- const [unreadVersions, setUnreadVersions] = useState(EMPTY_VERSIONS);
- const show = useCallback(() => {
- setUnreadVersions(new Set(unread.map((r) => r.version)));
- setOpen(true);
- markSeen();
- }, [unread, markSeen]);
- return { available: visible.length > 0, releases: visible, open, setOpen, unreadVersions, show };
-}
-
-export function WhatsNewMenuPanel({
- panel,
- anchor,
-}: {
- panel: ReturnType<typeof useWhatsNewMenuPanel>;
- /** The menu's trigger: the menu itself is gone by the time the panel opens. */
- anchor: RefObject<HTMLElement | null>;
-}) {
- return (
- <Popover open={panel.open} onOpenChange={panel.setOpen}>
- <PopoverContent anchor={anchor} side="right" align="end" sideOffset={8} className={cn(POPUP_CLASS, "w-[400px]")}>
- <WhatsNewPanel releases={panel.releases} unreadVersions={panel.unreadVersions} onClose={() => panel.setOpen(false)} />
- </PopoverContent>
- </Popover>
- );
-}
diff --git a/packages/views/whats-new/whats-new-launcher.test.tsx b/packages/views/whats-new/whats-new-menu-panel.test.tsx
similarity index 52%
rename from packages/views/whats-new/whats-new-launcher.test.tsx
rename to packages/views/whats-new/whats-new-menu-panel.test.tsx
index a8323f419d..a1b2135409 100644
--- a/packages/views/whats-new/whats-new-launcher.test.tsx
+++ b/packages/views/whats-new/whats-new-menu-panel.test.tsx
@@ -1,6 +1,6 @@
import type { ReactNode } from "react";
import { act, fireEvent, render, screen } from "@testing-library/react";
-import { afterEach, beforeEach, describe, expect, it, onTestFinished, vi } from "vitest";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { configStore } from "@multica/core/config";
import { Command, Globe, Terminal } from "@multica/ui/icons";
import type { User } from "@multica/core/types";
@@ -8,8 +8,6 @@ import enLayout from "../locales/en/layout.json";
import { HelpLauncher } from "../layout/help-launcher";
import { useSearchStore } from "../search/search-store";
import type { WhatsNewRelease } from "./releases";
-import { useWhatsNewSessionStore } from "./session-store";
-import { AUTO_OPEN_DELAY_MS, WhatsNewLauncher } from "./whats-new-launcher";
const mocks = vi.hoisted(() => ({
push: vi.fn(),
@@ -17,7 +15,7 @@ const mocks = vi.hoisted(() => ({
}));
const authStore = vi.hoisted(() => {
- // A real zustand store so optimistic updates re-render the launcher.
+ // A real zustand store so optimistic updates re-render the menu.
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { create } = require("zustand") as typeof import("zustand");
return create<{ user: Partial<User> | null }>(() => ({ user: null }));
@@ -117,29 +115,30 @@ function signIn(user: Partial<User>) {
authStore.setState({ user: { id: "u-1", created_at: "2026-01-15T08:00:00Z", ...user } });
}
-function renderLauncher() {
- const view = render(<WhatsNewLauncher />);
+function openHelpMenu() {
+ fireEvent.click(screen.getByRole("button", { name: "Help" }));
act(() => {
- vi.advanceTimersByTime(AUTO_OPEN_DELAY_MS);
+ vi.runAllTimers();
});
- return view;
+ return screen.getByRole("menuitem", { name: /What's new/ });
}
-const trigger = () => screen.getByRole("button", { name: "What's new" });
-const railTrigger = () => screen.queryByRole("button", { name: "What's new" });
-const dot = () => document.querySelector('[data-slot="whats-new-dot"]');
-
function openFromHelpMenu() {
- fireEvent.click(screen.getByRole("button", { name: "Help" }));
+ fireEvent.click(openHelpMenu());
act(() => {
vi.runAllTimers();
});
- fireEvent.click(screen.getByRole("menuitem", { name: "What's new" }));
+}
+
+function closePanel() {
+ fireEvent.click(screen.getByRole("button", { name: "Close" }));
act(() => {
vi.runAllTimers();
});
}
+const release = (version: string) => screen.getByRole("region", { name: `v${version}` });
+
beforeEach(() => {
vi.useFakeTimers();
i18nState.language = "en";
@@ -155,195 +154,133 @@ afterEach(() => {
authStore.setState({ user: null });
configStore.getState().setServerVersion("");
useSearchStore.getState().setOpen(false);
- useWhatsNewSessionStore.setState({ autoShown: false });
});
-describe("WhatsNewLauncher", () => {
- it("opens the update card with every highlight released since the last dismissal", () => {
+describe("What's new from the Help menu", () => {
+ it("opens nothing until the user asks", () => {
signIn({ whats_new_seen_version: "0.1.0" });
- renderLauncher();
+ render(<HelpLauncher />);
+ act(() => {
+ vi.runAllTimers();
+ });
- expect(dot()).toBeInTheDocument();
- expect(screen.getByText("Multica updated · v0.2.0 → v0.3.0")).toBeInTheDocument();
- expect(screen.getByText("3 new features since your last visit")).toBeInTheDocument();
- expect(screen.getByRole("heading", { name: "Palette title" })).toBeInTheDocument();
- expect(screen.getByRole("button", { name: /Language title/ })).toBeInTheDocument();
- expect(screen.queryByText("Old title")).not.toBeInTheDocument();
+ expect(screen.queryByRole("heading", { name: "What's new" })).not.toBeInTheDocument();
+ expect(mocks.markWhatsNewSeen).not.toHaveBeenCalled();
});
- it("expands a row when it is clicked", () => {
- signIn({ whats_new_seen_version: "0.1.0" });
- renderLauncher();
+ it("marks only unread releases as new and records the newest as seen", () => {
+ signIn({ whats_new_seen_version: "0.2.0" });
+ render(<HelpLauncher />);
- fireEvent.click(screen.getByRole("button", { name: /Runtimes title/ }));
- expect(screen.getByRole("heading", { name: "Runtimes title" })).toBeInTheDocument();
- expect(screen.getByText("Runtimes body")).toBeInTheDocument();
- expect(screen.getByRole("button", { name: /Palette title/ })).toBeInTheDocument();
+ openFromHelpMenu();
+ expect(screen.getByRole("heading", { name: "What's new" })).toBeInTheDocument();
+ expect(mocks.markWhatsNewSeen).toHaveBeenCalledWith("0.3.0");
+ expect(release("0.3.0")).toHaveTextContent("New");
+ expect(release("0.2.0")).not.toHaveTextContent("New");
+ expect(screen.getByRole("link", { name: /v0.2.0 release notes/ })).toHaveAttribute(
+ "href",
+ "https://multica.ai/changelog#release-0-2-0",
+ );
});
- it("records the newest release as seen when the card is acknowledged", () => {
+ it("tags the menu entry with the newest unread version until the panel is opened", () => {
signIn({ whats_new_seen_version: "0.1.0" });
- renderLauncher();
+ render(<HelpLauncher />);
- fireEvent.click(screen.getByRole("button", { name: "Got it" }));
- expect(mocks.markWhatsNewSeen).toHaveBeenCalledWith("0.3.0");
- expect(dot()).not.toBeInTheDocument();
+ expect(openHelpMenu()).toHaveTextContent("v0.3.0");
+ fireEvent.click(screen.getByRole("menuitem", { name: /What's new/ }));
+ act(() => {
+ vi.runAllTimers();
+ });
+ closePanel();
+
+ expect(openHelpMenu()).not.toHaveTextContent("v0.3.0");
});
- it("runs the highlight's action and dismisses the card", () => {
- signIn({ whats_new_seen_version: "0.1.0" });
- renderLauncher();
+ it("shows the server version next to the changelog link when it is known", () => {
+ configStore.getState().setServerVersion("v0.3.0");
+ signIn({ whats_new_seen_version: "0.3.0" });
+ render(<HelpLauncher />);
- fireEvent.click(screen.getByRole("button", { name: /Try it/ }));
- expect(useSearchStore.getState().open).toBe(true);
- expect(mocks.markWhatsNewSeen).toHaveBeenCalledWith("0.3.0");
+ openFromHelpMenu();
+ expect(screen.getByText("Server version v0.3.0", { selector: "[data-slot=whats-new-panel] span" })).toBeInTheDocument();
+ });
+
+ it("marks nothing as new once everything is read", () => {
+ signIn({ whats_new_seen_version: "0.3.0" });
+ render(<HelpLauncher />);
+
+ expect(openHelpMenu()).not.toHaveTextContent("v0.3.0");
+ fireEvent.click(screen.getByRole("menuitem", { name: /What's new/ }));
+ act(() => {
+ vi.runAllTimers();
+ });
+ expect(release("0.3.0")).not.toHaveTextContent("New");
+ expect(mocks.markWhatsNewSeen).not.toHaveBeenCalled();
});
it("counts only releases after signup before the first dismissal", () => {
signIn({ whats_new_seen_version: null, created_at: "2026-02-10T08:00:00Z" });
- renderLauncher();
+ render(<HelpLauncher />);
- expect(screen.getByText("Multica updated · v0.3.0")).toBeInTheDocument();
- expect(screen.getByText("2 new features since your last visit")).toBeInTheDocument();
+ openFromHelpMenu();
+ expect(release("0.3.0")).toHaveTextContent("New");
+ expect(release("0.2.0")).not.toHaveTextContent("New");
});
it("does not announce releases newer than the connected server", () => {
configStore.getState().setServerVersion("v0.2.0");
signIn({ whats_new_seen_version: "0.1.0" });
- renderLauncher();
+ render(<HelpLauncher />);
- expect(screen.getByText("1 new feature since your last visit")).toBeInTheDocument();
+ openFromHelpMenu();
expect(screen.queryByText("Palette title")).not.toBeInTheDocument();
+ expect(mocks.markWhatsNewSeen).toHaveBeenCalledWith("0.2.0");
});
- it("stays quiet against a server that cannot record dismissals", () => {
+ it("records nothing against a server that cannot store dismissals", () => {
signIn({});
- render(
- <>
- <WhatsNewLauncher />
- <HelpLauncher />
- </>,
- );
- act(() => {
- vi.advanceTimersByTime(AUTO_OPEN_DELAY_MS);
- });
-
- expect(railTrigger()).not.toBeInTheDocument();
- expect(screen.queryByText(/since your last visit/)).not.toBeInTheDocument();
+ render(<HelpLauncher />);
openFromHelpMenu();
expect(screen.getByRole("heading", { name: "What's new" })).toBeInTheDocument();
+ expect(release("0.3.0")).not.toHaveTextContent("New");
expect(mocks.markWhatsNewSeen).not.toHaveBeenCalled();
});
- it("leaves the rail once the update is acknowledged", () => {
- signIn({ whats_new_seen_version: "0.1.0" });
- renderLauncher();
-
- fireEvent.click(screen.getByRole("button", { name: "Got it" }));
- act(() => {
- vi.runAllTimers();
- });
- expect(railTrigger()).not.toBeInTheDocument();
- });
-
- it("keeps the rail button while the panel opened from it is up", () => {
- signIn({ whats_new_seen_version: "0.2.0" });
- render(<WhatsNewLauncher />);
-
- fireEvent.click(trigger());
- expect(screen.getByRole("heading", { name: "What's new" })).toBeInTheDocument();
- expect(railTrigger()).toBeInTheDocument();
-
- fireEvent.click(screen.getByRole("button", { name: "Close" }));
- act(() => {
- vi.runAllTimers();
- });
- expect(railTrigger()).not.toBeInTheDocument();
- });
-
- it("opens the history from the Help menu once everything is read", () => {
+ it("runs a highlight's action and closes the panel", () => {
signIn({ whats_new_seen_version: "0.3.0" });
- render(
- <>
- <WhatsNewLauncher />
- <HelpLauncher />
- </>,
- );
- expect(railTrigger()).not.toBeInTheDocument();
+ render(<HelpLauncher />);
openFromHelpMenu();
- expect(screen.getByRole("heading", { name: "What's new" })).toBeInTheDocument();
- expect(screen.getByRole("region", { name: "v0.3.0" })).not.toHaveTextContent("New");
- expect(mocks.markWhatsNewSeen).not.toHaveBeenCalled();
- });
-
- it("opens the full history from the rail and marks only unread releases as new", () => {
- signIn({ whats_new_seen_version: "0.2.0" });
- render(<WhatsNewLauncher />);
-
- fireEvent.click(trigger());
- expect(screen.getByRole("heading", { name: "What's new" })).toBeInTheDocument();
- expect(mocks.markWhatsNewSeen).toHaveBeenCalledWith("0.3.0");
-
- const newest = screen.getByRole("region", { name: "v0.3.0" });
- const older = screen.getByRole("region", { name: "v0.2.0" });
- expect(newest).toHaveTextContent("New");
- expect(older).not.toHaveTextContent("New");
- expect(screen.getByRole("link", { name: /v0.2.0 release notes/ })).toHaveAttribute(
- "href",
- "https://multica.ai/changelog#release-0-2-0",
- );
-
fireEvent.click(screen.getByRole("button", { name: /Open/ }));
expect(mocks.push).toHaveBeenCalledWith("/acme/runtimes");
+
+ openFromHelpMenu();
+ fireEvent.click(screen.getByRole("button", { name: /Try it/ }));
+ expect(useSearchStore.getState().open).toBe(true);
});
it("falls back to English copy for a locale without a translation", () => {
i18nState.language = "fr";
signIn({ whats_new_seen_version: "0.1.0" });
- renderLauncher();
+ render(<HelpLauncher />);
+ openFromHelpMenu();
expect(screen.getByRole("heading", { name: "Palette title" })).toBeInTheDocument();
- expect(screen.getByRole("button", { name: /Titre langue/ })).toBeInTheDocument();
+ expect(screen.getByRole("heading", { name: "Titre langue" })).toBeInTheDocument();
});
- it("auto-opens from the visible rail only, once per session", () => {
- signIn({ whats_new_seen_version: "0.1.0" });
- // Narrow layouts keep a display:none rail mounted next to the nav sheet's.
- // jsdom has no checkVisibility, so stand one in for this test.
- const visibility = vi.fn(() => false);
- Object.defineProperty(HTMLElement.prototype, "checkVisibility", { value: visibility, configurable: true });
- onTestFinished(() => {
- delete (HTMLElement.prototype as Partial<HTMLElement>).checkVisibility;
- });
- const hidden = renderLauncher();
- expect(screen.queryByText(/since your last visit/)).not.toBeInTheDocument();
-
- visibility.mockReturnValue(true);
- const sheet = renderLauncher();
- expect(screen.getByText("3 new features since your last visit")).toBeInTheDocument();
-
- // Clicking away and reopening the sheet remounts the launcher.
- sheet.unmount();
- hidden.unmount();
- renderLauncher();
- expect(screen.queryByText(/since your last visit/)).not.toBeInTheDocument();
- expect(dot()).toBeInTheDocument();
- });
-
- it("keeps the dot and retries when recording the dismissal fails", async () => {
+ it("retries recording the dismissal on the next open when it fails", async () => {
signIn({ whats_new_seen_version: "0.1.0" });
mocks.markWhatsNewSeen.mockRejectedValueOnce(new Error("offline"));
- renderLauncher();
+ render(<HelpLauncher />);
- await act(async () => {
- fireEvent.click(screen.getByRole("button", { name: "Got it" }));
- });
- expect(dot()).toBeInTheDocument();
+ openFromHelpMenu();
+ await act(async () => {});
+ closePanel();
- fireEvent.click(trigger());
+ openFromHelpMenu();
expect(mocks.markWhatsNewSeen).toHaveBeenCalledTimes(2);
- expect(dot()).not.toBeInTheDocument();
});
});
diff --git a/packages/views/whats-new/whats-new-menu-panel.tsx b/packages/views/whats-new/whats-new-menu-panel.tsx
new file mode 100644
index 0000000000..53a7457986
--- /dev/null
+++ b/packages/views/whats-new/whats-new-menu-panel.tsx
@@ -0,0 +1,57 @@
+"use client";
+
+import { useCallback, useState, type RefObject } from "react";
+import { Popover, PopoverContent } from "@multica/ui/components/ui/popover";
+import { useWhatsNew } from "./use-whats-new";
+import { WhatsNewPanel } from "./whats-new-panel";
+
+const EMPTY_VERSIONS: ReadonlySet<string> = new Set();
+
+/**
+ * The release history behind the Help menu's What's new entry. Opening it
+ * records the newest release as seen; releases the user hadn't seen yet are
+ * captured first so the panel can still mark them as new.
+ */
+export function useWhatsNewMenuPanel() {
+ const { visible, unread, markSeen } = useWhatsNew();
+ const [open, setOpen] = useState(false);
+ const [unreadVersions, setUnreadVersions] = useState(EMPTY_VERSIONS);
+ const show = useCallback(() => {
+ setUnreadVersions(new Set(unread.map((r) => r.version)));
+ setOpen(true);
+ markSeen();
+ }, [unread, markSeen]);
+ return {
+ available: visible.length > 0,
+ /** The newest release the user hasn't seen, for the menu entry's tag. */
+ newestUnread: unread[0]?.version,
+ releases: visible,
+ open,
+ setOpen,
+ unreadVersions,
+ show,
+ };
+}
+
+export function WhatsNewMenuPanel({
+ panel,
+ anchor,
+}: {
+ panel: ReturnType<typeof useWhatsNewMenuPanel>;
+ /** The menu's trigger: the menu itself is gone by the time the panel opens. */
+ anchor: RefObject<HTMLElement | null>;
+}) {
+ return (
+ <Popover open={panel.open} onOpenChange={panel.setOpen}>
+ <PopoverContent
+ anchor={anchor}
+ side="right"
+ align="end"
+ sideOffset={8}
+ className="w-[400px] gap-0 overflow-hidden rounded-xl p-0"
+ >
+ <WhatsNewPanel releases={panel.releases} unreadVersions={panel.unreadVersions} onClose={() => panel.setOpen(false)} />
+ </PopoverContent>
+ </Popover>
+ );
+}
diff --git a/packages/views/whats-new/whats-new-panel.tsx b/packages/views/whats-new/whats-new-panel.tsx
index 0fa6dd777f..3fe111b3b8 100644
--- a/packages/views/whats-new/whats-new-panel.tsx
+++ b/packages/views/whats-new/whats-new-panel.tsx
@@ -1,6 +1,7 @@
"use client";
import { ArrowUpRight, X } from "@multica/ui/icons";
+import { useConfigStore } from "@multica/core/config";
import { IconButton } from "@multica/ui/components/common/icon-button";
import { cn } from "@multica/ui/lib/utils";
import { useT } from "../i18n";
@@ -22,7 +23,7 @@ function formatReleaseDate(date: string, language: string) {
return new Intl.DateTimeFormat(language, { month: "short", day: "numeric", timeZone: "UTC" }).format(parsed);
}
-/** Every announced release, opened from the rail button. */
+/** Every announced release, opened from the Help menu. */
export function WhatsNewPanel({
releases,
unreadVersions,
@@ -35,6 +36,7 @@ export function WhatsNewPanel({
onClose: () => void;
}) {
const { t, i18n } = useT("layout");
+ const serverVersion = useConfigStore((state) => state.serverVersion);
return (
<div className="flex flex-col" data-slot="whats-new-panel">
@@ -60,8 +62,7 @@ export function WhatsNewPanel({
</span>
<span className="text-muted-foreground">{formatReleaseDate(release.date, i18n.language)}</span>
{unread && (
- <span className="ml-auto inline-flex items-center gap-1.5 text-micro font-medium text-brand">
- <span aria-hidden className="size-1.5 rounded-full bg-brand" />
+ <span className="ml-auto inline-flex h-[18px] items-center rounded-xs bg-brand/10 px-1.5 text-micro font-medium text-brand">
{t(($) => $.whats_new.panel.new)}
</span>
)}
@@ -82,7 +83,7 @@ export function WhatsNewPanel({
<p className="text-label text-muted-foreground">{copy.body}</p>
{highlight.action && (
<div className="mt-0.5">
- <HighlightActionButton action={highlight.action} variant="link" onDone={onClose} />
+ <HighlightActionButton action={highlight.action} onDone={onClose} />
</div>
)}
</div>
@@ -104,12 +105,17 @@ export function WhatsNewPanel({
})}
</div>
- <div className="flex h-11 shrink-0 items-center justify-end border-t border-border px-4">
+ <div className="flex h-11 shrink-0 items-center gap-3 border-t border-border px-4">
+ {serverVersion && (
+ <span className="min-w-0 truncate text-caption text-muted-foreground">
+ {t(($) => $.help.server_version, { version: serverVersion })}
+ </span>
+ )}
<a
href={CHANGELOG_URL}
target="_blank"
rel="noopener noreferrer"
- className="inline-flex items-center gap-0.5 text-label font-medium hover:underline"
+ className="ml-auto inline-flex shrink-0 items-center gap-0.5 text-label font-medium hover:underline"
>
{t(($) => $.whats_new.panel.full_changelog)}
<ArrowUpRight className="size-3.5 text-faint-foreground" />