mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-08-22 04:09:22 +00:00
change requests
This commit is contained in:
parent
be8ab09b3c
commit
6c1262cbba
@ -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]);
|
||||
|
||||
|
@ -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';
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user