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",
|
||||
]),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user