From 6c1262cbbae79557cf1457092a8d09ef435c2270 Mon Sep 17 00:00:00 2001 From: EthanHealy01 Date: Mon, 18 Aug 2025 17:08:07 +0100 Subject: [PATCH] change requests --- .../src/components/shared/QuickAccessBar.tsx | 4 ++-- .../shared/quickAccessBar/QuickAccessBar.ts | 21 +------------------ 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/frontend/src/components/shared/QuickAccessBar.tsx b/frontend/src/components/shared/QuickAccessBar.tsx index 35e9480c4..bc041a923 100644 --- a/frontend/src/components/shared/QuickAccessBar.tsx +++ b/frontend/src/components/shared/QuickAccessBar.tsx @@ -24,14 +24,14 @@ const QuickAccessBar = forwardRef(({ const { t } = useTranslation(); const { isRainbowMode } = useRainbowThemeContext(); const { openFilesModal, isFilesModalOpen } = useFilesModalContext(); - const { handleReaderToggle, handleBackToTools, handleToolSelect, selectedTool, selectedToolKey, leftPanelView, toolRegistry, readerMode } = useToolWorkflow(); + const { handleReaderToggle, handleBackToTools, handleToolSelect, selectedToolKey, leftPanelView, toolRegistry, readerMode } = useToolWorkflow(); const [configModalOpen, setConfigModalOpen] = useState(false); const [activeButton, setActiveButton] = useState('tools'); const scrollableRef = useRef(null); const isOverflow = useIsOverflowing(scrollableRef); useEffect(() => { - const next = getActiveNavButton(leftPanelView, selectedToolKey, toolRegistry as any, readerMode); + const next = getActiveNavButton(selectedToolKey, readerMode); setActiveButton(next); }, [leftPanelView, selectedToolKey, toolRegistry, readerMode]); diff --git a/frontend/src/components/shared/quickAccessBar/QuickAccessBar.ts b/frontend/src/components/shared/quickAccessBar/QuickAccessBar.ts index b5ad79b42..efadc4a72 100644 --- a/frontend/src/components/shared/quickAccessBar/QuickAccessBar.ts +++ b/frontend/src/components/shared/quickAccessBar/QuickAccessBar.ts @@ -1,5 +1,4 @@ import { ButtonConfig } from '../../../types/sidebar'; -import { useFlatToolRegistry } from '../../../data/toolRegistry'; // Border radius constants export const ROUND_BORDER_RADIUS = '0.5rem'; @@ -65,26 +64,12 @@ export const getNavButtonStyle = ( }; }; -/** - * Determine which nav button should be highlighted based on the tool registry. - * Uses the tool's `view` property to map to the nav button id. - */ -export const getTargetNavButton = ( - selectedToolKey: string | null, - registry: ReturnType -): string | null => { - if (!selectedToolKey) return null; - - return selectedToolKey; -}; /** * Determine the active nav button based on current tool state and registry */ export const getActiveNavButton = ( - leftPanelView: 'toolPicker' | 'toolContent', selectedToolKey: string | null, - registry: ReturnType, readerMode: boolean ): string => { // Reader mode takes precedence and should highlight the Read nav item @@ -94,9 +79,5 @@ export const getActiveNavButton = ( // If a tool is selected, highlight it immediately even if the panel view // transition to 'toolContent' has not completed yet. This prevents a brief // period of no-highlight during rapid navigation. - if (selectedToolKey) { - return getTargetNavButton(selectedToolKey, registry) || selectedToolKey; - } - // Default to All Tools when no tool is selected - return 'tools'; + return selectedToolKey ? selectedToolKey : 'tools'; };