change requests

This commit is contained in:
EthanHealy01 2025-08-18 17:08:07 +01:00
parent be8ab09b3c
commit 6c1262cbba
2 changed files with 3 additions and 22 deletions

View File

@ -24,14 +24,14 @@ const QuickAccessBar = forwardRef<HTMLDivElement>(({
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<string>('tools');
const scrollableRef = useRef<HTMLDivElement>(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]);

View File

@ -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<typeof useFlatToolRegistry>
): 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<typeof useFlatToolRegistry>,
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';
};