feat(web): add usage page keybinding (#9434)
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
6 files changed
+24
No files matched your search
@@ -469,6 +469,7 @@ function overlayModeForCommand(command: string | null): SearchOverlayMode | null
|
||||
}
|
||||
|
||||
export function CommandPalette({ children }: { children: ReactNode }) {
|
||||
const navigate = useNavigate();
|
||||
const [state, dispatch] = useReducer(reduceCommandPaletteUiState, {
|
||||
open: false,
|
||||
mode: "command",
|
||||
@@ -561,6 +562,13 @@ export function CommandPalette({ children }: { children: ReactNode }) {
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (command === "usage.open") {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
setOpen(false);
|
||||
void navigate({ to: "/usage" });
|
||||
return;
|
||||
}
|
||||
const mode = overlayModeForCommand(command);
|
||||
if (mode === null) {
|
||||
return;
|
||||
@@ -574,9 +582,11 @@ export function CommandPalette({ children }: { children: ReactNode }) {
|
||||
}, [
|
||||
appearanceMode,
|
||||
keybindings,
|
||||
navigate,
|
||||
previewOpen,
|
||||
resolvedTheme,
|
||||
setAppearanceMode,
|
||||
setOpen,
|
||||
terminalOpen,
|
||||
theme,
|
||||
themeHalves,
|
||||
@@ -2023,6 +2033,7 @@ function OpenCommandPaletteDialog(props: {
|
||||
searchTerms: ["usage", "use", "tokens", "cost", "spend", "limits", "stats", "analytics"],
|
||||
title: "Open usage",
|
||||
icon: <ChartNoAxesColumnIcon className={ITEM_ICON_CLASS} />,
|
||||
shortcutCommand: "usage.open",
|
||||
run: async () => {
|
||||
await navigate({ to: "/usage" });
|
||||
},
|
||||
|
||||
@@ -243,6 +243,7 @@ describe("KeybindingsSettings.logic", () => {
|
||||
"chat.new",
|
||||
"rightPanel.toggleMaximized",
|
||||
"thread.stop",
|
||||
"usage.open",
|
||||
"script.setup-db.run",
|
||||
]),
|
||||
);
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Usage and limits
|
||||
|
||||
Open **Usage** from the sidebar or the command palette, or press `mod+u` on web and
|
||||
desktop when the terminal is not focused. Customize `usage.open` in
|
||||
**Settings → Keybindings**.
|
||||
|
||||
## Understand your usage
|
||||
|
||||
**Usage** combines Codex, Claude Code, and Grok Build session history from your connected
|
||||
|
||||
@@ -78,6 +78,12 @@ it.effect("parses keybinding rules", () =>
|
||||
});
|
||||
assert.strictEqual(parsedProjectSearch.command, "projectSearch.toggle");
|
||||
|
||||
const parsedUsageOpen = yield* decode(KeybindingRule, {
|
||||
key: "mod+u",
|
||||
command: "usage.open",
|
||||
});
|
||||
assert.strictEqual(parsedUsageOpen.command, "usage.open");
|
||||
|
||||
const parsedThemeEditor = yield* decode(KeybindingRule, {
|
||||
key: "mod+alt+shift+t",
|
||||
command: "themeEditor.toggle",
|
||||
|
||||
@@ -78,6 +78,7 @@ export const STATIC_KEYBINDING_COMMANDS = [
|
||||
"commandPalette.toggle",
|
||||
"filePicker.toggle",
|
||||
"projectSearch.toggle",
|
||||
"usage.open",
|
||||
"theme.select",
|
||||
"appearance.cycle",
|
||||
"themeEditor.toggle",
|
||||
|
||||
@@ -40,6 +40,7 @@ export const DEFAULT_KEYBINDINGS: ReadonlyArray<KeybindingRule> = [
|
||||
{ key: "mod+k", command: "commandPalette.toggle", when: "!terminalFocus" },
|
||||
{ key: "mod+p", command: "filePicker.toggle", when: "!terminalFocus" },
|
||||
{ key: "mod+shift+f", command: "projectSearch.toggle", when: "!terminalFocus" },
|
||||
{ key: "mod+u", command: "usage.open", when: "!terminalFocus" },
|
||||
{ key: "mod+alt+a", command: "theme.select", when: "!terminalFocus" },
|
||||
{ key: "mod+alt+shift+a", command: "appearance.cycle", when: "!terminalFocus" },
|
||||
{ key: "mod+alt+shift+t", command: "themeEditor.toggle" },
|
||||
|
||||
Reference in new issue
Block a user