From 1cb519e66ca3cb647d10df9c8e0ff0dce8f0014c Mon Sep 17 00:00:00 2001 From: Frank Noirot Date: Mon, 28 Oct 2024 14:53:56 -0400 Subject: [PATCH] Make the command bar button hotkey label update live --- src/components/CommandBarOpenButton.tsx | 16 ++++++++++++++-- .../ModelingSidebar/ModelingSidebar.tsx | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/components/CommandBarOpenButton.tsx b/src/components/CommandBarOpenButton.tsx index 9bf053515..e510dc4fc 100644 --- a/src/components/CommandBarOpenButton.tsx +++ b/src/components/CommandBarOpenButton.tsx @@ -2,10 +2,22 @@ import { useCommandsContext } from 'hooks/useCommandsContext' import usePlatform from 'hooks/usePlatform' import { hotkeyDisplay } from 'lib/hotkeyWrapper' import { COMMAND_PALETTE_HOTKEY } from './CommandBar/CommandBar' +import { KEYBINDING_CATEGORIES } from 'lib/constants' +import { useMemo } from 'react' +import { useInteractionMapContext } from 'hooks/useInteractionMapContext' export function CommandBarOpenButton() { - const { commandBarSend } = useCommandsContext() const platform = usePlatform() + const { commandBarSend } = useCommandsContext() + const { state: interactionMapState } = useInteractionMapContext() + + const resolvedKeybinding = useMemo( + () => + interactionMapState.context.overrides[ + `${KEYBINDING_CATEGORIES.COMMAND_BAR}.toggle` + ] || COMMAND_PALETTE_HOTKEY, + [interactionMapState.context.overrides] + ) return ( ) diff --git a/src/components/ModelingSidebar/ModelingSidebar.tsx b/src/components/ModelingSidebar/ModelingSidebar.tsx index 8c6ad834d..b48511fd3 100644 --- a/src/components/ModelingSidebar/ModelingSidebar.tsx +++ b/src/components/ModelingSidebar/ModelingSidebar.tsx @@ -65,7 +65,7 @@ export function ModelingSidebar({ paneOpacity }: ModelingSidebarProps) { id: 'export', title: 'Export part', icon: 'floppyDiskArrow', - keybinding: 'Ctrl + Shift + E', + keybinding: 'Ctrl+Shift+E', action: () => commandBarSend({ type: 'Find and select command', @@ -76,7 +76,7 @@ export function ModelingSidebar({ paneOpacity }: ModelingSidebarProps) { id: 'make', title: 'Make part', icon: 'printer3d', - keybinding: 'Ctrl + Shift + M', + keybinding: 'Ctrl+Shift+M', // eslint-disable-next-line @typescript-eslint/no-misused-promises action: async () => { commandBarSend({