diff --git a/apps/desktop/src/features/editor/WorkspacePaneEmptyState.test.tsx b/apps/desktop/src/features/editor/WorkspacePaneEmptyState.test.tsx index c054fcc4..3527aa09 100644 --- a/apps/desktop/src/features/editor/WorkspacePaneEmptyState.test.tsx +++ b/apps/desktop/src/features/editor/WorkspacePaneEmptyState.test.tsx @@ -1,7 +1,9 @@ import "@testing-library/jest-dom/vitest"; import { screen } from "@testing-library/react"; import { beforeEach, describe, expect, it } from "vitest"; +import { formatShortcutAction } from "../../app/shortcuts/format"; import { useEditorStore } from "../../app/store/editorStore"; +import { getDesktopPlatform } from "../../app/utils/platform"; import { renderComponent } from "../../test/test-utils"; import { WorkspacePaneEmptyState } from "./WorkspacePaneEmptyState"; @@ -19,12 +21,33 @@ describe("WorkspacePaneEmptyState", () => { ); }); - it("shows a compact empty state message", () => { - renderComponent(); + it("shows a compact empty state message with shortcut hints", () => { + const { container } = renderComponent( + , + ); + + // The placeholder lists each action with its keyboard shortcut. + // Text nodes are interleaved with elements, so assert on the + // paragraph's combined text content. + const text = container.textContent ?? ""; + expect(text).toContain("Open a file"); + expect(text).toContain("browse commands"); + expect(text).toContain("start a chat"); + expect(text).toContain("launch a terminal"); + + // Shortcuts are resolved from the registry for the current test platform. + const hints = Array.from( + container.querySelectorAll("kbd"), + (kbd) => kbd.textContent, + ); + const platform = getDesktopPlatform(); + expect(hints).toEqual([ + formatShortcutAction("quick_switcher", platform), + formatShortcutAction("command_palette", platform), + formatShortcutAction("new_agent", platform), + formatShortcutAction("new_terminal", platform), + ]); - expect( - screen.getByText("Open a file, start a chat or launch a terminal."), - ).toBeVisible(); expect( screen.queryByRole("button", { name: "New Note" }), ).not.toBeInTheDocument(); diff --git a/apps/desktop/src/features/editor/WorkspacePaneEmptyState.tsx b/apps/desktop/src/features/editor/WorkspacePaneEmptyState.tsx index 0b35935d..d638f754 100644 --- a/apps/desktop/src/features/editor/WorkspacePaneEmptyState.tsx +++ b/apps/desktop/src/features/editor/WorkspacePaneEmptyState.tsx @@ -1,7 +1,33 @@ +import { formatShortcutAction } from "../../app/shortcuts/format"; +import type { ShortcutActionId } from "../../app/shortcuts/registry"; +import { getDesktopPlatform } from "../../app/utils/platform"; + interface WorkspacePaneEmptyStateProps { paneId: string; } +// Resolve the binding from the shortcut registry at render time so the hint +// stays accurate if the user rebinds an action, and so the platform modifier +// (⌘ vs Ctrl) is correct per OS. +function ShortcutHint({ action }: { action: ShortcutActionId }) { + const label = formatShortcutAction(action, getDesktopPlatform()); + if (!label) return null; + return ( + + {label} + + ); +} + export function WorkspacePaneEmptyState({ paneId, }: WorkspacePaneEmptyStateProps) { @@ -11,10 +37,14 @@ export function WorkspacePaneEmptyState({ data-workspace-empty-pane={paneId} >

- Open a file, start a chat or launch a terminal. + Open a file + , browse commands + , start a chat + , or launch a terminal + .

);