Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/skills/verify/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ The hub is driven over CDP. Prefer the user path (`click`) over `window.voice.*`

Stable handles:

- **Voice nav:** `Home`, `Style`. The sidebar footer button `Settings` opens the Settings nav: `General`, `Account`, `System`, `Models`, `Shortcuts`, `Data and Privacy`. Its `Back` button returns to the Voice nav.
- **Voice nav:** `Home`, `Style`. The sidebar footer button `Settings` opens the Settings nav: `General`, `System`, `Models`, `Shortcuts`, then below a divider `Account` and `Data and Privacy`. Its `Back` button returns to the Voice nav.
- **Settings rows:** each control's id is `setting-<name>`, for example `#setting-hotkey`, `#setting-microphone`, `#setting-dictation-language`, `#setting-update-channel`, `#setting-mute-while-dictating`, `#setting-show-in-dock`, `#setting-always-show-pill`, `#setting-diagnostics`. Switches are labelled by their row title, such as `Show in Dock`.
- **Selects:** open with `click css:#setting-<name>`, then `click "<option label>"`.
- **Page headline:** `document.querySelector("main h1").textContent`.
Expand Down
81 changes: 52 additions & 29 deletions apps/desktop/src/renderer/HubShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
UserIcon,
type LucideIcon,
} from "lucide-react";
import { useEffect, useRef, useState, type ReactNode } from "react";
import { Fragment, useEffect, useRef, useState, type ReactNode } from "react";

import iconUrl from "../../build/icon.svg";
import type { Snapshot } from "../shared/api.ts";
Expand Down Expand Up @@ -50,23 +50,32 @@
import { color, font, radius, space } from "./tokens.stylex.ts";
import { tooltipPopupClass, tooltipPositionerClass } from "./tooltip.ts";

const appPages = [
{ id: "home", label: "Home", icon: HouseIcon },
{ id: "insights", label: "Insights", icon: ChartColumnIcon },
{ id: "style", label: "Style", icon: PenLineIcon },
{ id: "snippets", label: "Snippets", icon: TextQuoteIcon },
{ id: "dictionary", label: "Dictionary", icon: BookAIcon },
const appPageGroups = [
[
{ id: "home", label: "Home", icon: HouseIcon },
{ id: "insights", label: "Insights", icon: ChartColumnIcon },
{ id: "style", label: "Style", icon: PenLineIcon },
{ id: "snippets", label: "Snippets", icon: TextQuoteIcon },
{ id: "dictionary", label: "Dictionary", icon: BookAIcon },
],
] as const;

const settingsPages = [
{ id: "general", label: "General", icon: SlidersHorizontalIcon },
{ id: "account", label: "Account", icon: UserIcon },
{ id: "system", label: "System", icon: MonitorIcon },
{ id: "models", label: "Models", icon: BoxIcon },
{ id: "shortcuts", label: "Shortcuts", icon: KeyboardIcon },
{ id: "privacy", label: "Data and Privacy", icon: ShieldCheckIcon },
const settingsPageGroups = [
[
{ id: "general", label: "General", icon: SlidersHorizontalIcon },
{ id: "system", label: "System", icon: MonitorIcon },
{ id: "models", label: "Models", icon: BoxIcon },
{ id: "shortcuts", label: "Shortcuts", icon: KeyboardIcon },
],
[
{ id: "account", label: "Account", icon: UserIcon },
{ id: "privacy", label: "Data and Privacy", icon: ShieldCheckIcon },
],
] as const;

const appPages = appPageGroups.flat();
const settingsPages = settingsPageGroups.flat();

type AppPage = (typeof appPages)[number]["id"];
type SettingsPage = (typeof settingsPages)[number]["id"];

Expand Down Expand Up @@ -186,6 +195,14 @@
margin: -(brandIconSize - brandIconVisibleSize) / 2,
},
nav: { display: "flex", flexDirection: "column", gap: 2 },
navDivider: {
flexShrink: 0,
height: 1,
borderWidth: 0,
marginBlock: space.sm,
marginInline: (navItemSize - navIconSize) / 2,
backgroundColor: color.border,
},
navItem: {
display: "flex",
alignItems: "center",
Expand Down Expand Up @@ -362,29 +379,35 @@
}

function NavItems<Id extends string>({
items,
groups,
current,
collapsed,
showShortcut,
onSelect,
}: {
items: readonly { id: Id; label: string; icon: LucideIcon }[];
groups: readonly (readonly { id: Id; label: string; icon: LucideIcon }[])[];
current: Id;
collapsed: boolean;
showShortcut: boolean;
onSelect: (id: Id) => void;
}) {
return items.map(({ id, label, icon }, index) => (
<NavItem
key={id}
label={label}
icon={icon}
shortcut={jumpShortcuts[index]}
current={current === id}
collapsed={collapsed}
showShortcut={showShortcut}
onClick={() => onSelect(id)}
/>
let index = 0;
return groups.map((items, groupIndex) => (
<Fragment key={groupIndex}>

Check warning on line 396 in apps/desktop/src/renderer/HubShell.tsx

View workflow job for this annotation

GitHub Actions / Check

react(no-array-index-key)

apps/desktop/src/renderer/HubShell.tsx:396:15: Usage of Array index in keys is not allowed
{groupIndex > 0 && <hr {...stylex.props(styles.navDivider)} />}
{items.map(({ id, label, icon }) => (
<NavItem
key={id}
label={label}
icon={icon}
shortcut={jumpShortcuts[index++]}
current={current === id}
collapsed={collapsed}
showShortcut={showShortcut}
onClick={() => onSelect(id)}
/>
))}
</Fragment>
));
}

Expand Down Expand Up @@ -492,7 +515,7 @@
{settingsPage === null ? (
<nav aria-label="Voice" {...stylex.props(styles.nav)}>
<NavItems
items={appPages}
groups={appPageGroups}
current={appPage}
collapsed={collapsed}
showShortcut={showShortcut}
Expand All @@ -502,7 +525,7 @@
) : (
<nav aria-label="Settings" {...stylex.props(styles.nav)}>
<NavItems
items={settingsPages}
groups={settingsPageGroups}
current={settingsPage}
collapsed={collapsed}
showShortcut={showShortcut}
Expand Down
Loading