From 29b3e8273cc3125fe309a4ac771b048dcddcc4c1 Mon Sep 17 00:00:00 2001 From: Charis Lam <26616127+charislam@users.noreply.github.com> Date: Tue, 28 Oct 2025 13:03:04 -0400 Subject: [PATCH] fix(inline editor button): only show keyboard shortcut if hotkey active --- .../layouts/AppLayout/InlineEditorButton.tsx | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/apps/studio/components/layouts/AppLayout/InlineEditorButton.tsx b/apps/studio/components/layouts/AppLayout/InlineEditorButton.tsx index 03b33b3ceb5..db0a6d6bffa 100644 --- a/apps/studio/components/layouts/AppLayout/InlineEditorButton.tsx +++ b/apps/studio/components/layouts/AppLayout/InlineEditorButton.tsx @@ -1,10 +1,21 @@ -import { ButtonTooltip } from 'components/ui/ButtonTooltip' -import { SqlEditor } from 'icons' -import { sidebarManagerState, useSidebarManagerSnapshot } from 'state/sidebar-manager-state' +import { LOCAL_STORAGE_KEYS } from 'common' import { SIDEBAR_KEYS } from 'components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider' +import { ButtonTooltip } from 'components/ui/ButtonTooltip' +import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage' +import { SqlEditor } from 'icons' +import { useSidebarManagerSnapshot } from 'state/sidebar-manager-state' import { cn, KeyboardShortcut } from 'ui' -export const InlineEditorButton = ({ showShortcut = true }: { showShortcut?: boolean }) => { +const InlineEditorKeyboardTooltip = () => { + const [hotkeyEnabled] = useLocalStorageQuery( + LOCAL_STORAGE_KEYS.HOTKEY_SIDEBAR(SIDEBAR_KEYS.EDITOR_PANEL), + true + ) + + return hotkeyEnabled ? : null +} + +export const InlineEditorButton = () => { const { activeSidebar, toggleSidebar } = useSidebarManagerSnapshot() const isOpen = activeSidebar?.id === SIDEBAR_KEYS.EDITOR_PANEL @@ -27,7 +38,7 @@ export const InlineEditorButton = ({ showShortcut = true }: { showShortcut?: boo text: (
SQL Editor - {showShortcut && } +
), },