mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-08-22 20:29:23 +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 { t } = useTranslation();
|
||||||
const { isRainbowMode } = useRainbowThemeContext();
|
const { isRainbowMode } = useRainbowThemeContext();
|
||||||
const { openFilesModal, isFilesModalOpen } = useFilesModalContext();
|
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 [configModalOpen, setConfigModalOpen] = useState(false);
|
||||||
const [activeButton, setActiveButton] = useState<string>('tools');
|
const [activeButton, setActiveButton] = useState<string>('tools');
|
||||||
const scrollableRef = useRef<HTMLDivElement>(null);
|
const scrollableRef = useRef<HTMLDivElement>(null);
|
||||||
const isOverflow = useIsOverflowing(scrollableRef);
|
const isOverflow = useIsOverflowing(scrollableRef);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const next = getActiveNavButton(leftPanelView, selectedToolKey, toolRegistry as any, readerMode);
|
const next = getActiveNavButton(selectedToolKey, readerMode);
|
||||||
setActiveButton(next);
|
setActiveButton(next);
|
||||||
}, [leftPanelView, selectedToolKey, toolRegistry, readerMode]);
|
}, [leftPanelView, selectedToolKey, toolRegistry, readerMode]);
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { ButtonConfig } from '../../../types/sidebar';
|
import { ButtonConfig } from '../../../types/sidebar';
|
||||||
import { useFlatToolRegistry } from '../../../data/toolRegistry';
|
|
||||||
|
|
||||||
// Border radius constants
|
// Border radius constants
|
||||||
export const ROUND_BORDER_RADIUS = '0.5rem';
|
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
|
* Determine the active nav button based on current tool state and registry
|
||||||
*/
|
*/
|
||||||
export const getActiveNavButton = (
|
export const getActiveNavButton = (
|
||||||
leftPanelView: 'toolPicker' | 'toolContent',
|
|
||||||
selectedToolKey: string | null,
|
selectedToolKey: string | null,
|
||||||
registry: ReturnType<typeof useFlatToolRegistry>,
|
|
||||||
readerMode: boolean
|
readerMode: boolean
|
||||||
): string => {
|
): string => {
|
||||||
// Reader mode takes precedence and should highlight the Read nav item
|
// 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
|
// If a tool is selected, highlight it immediately even if the panel view
|
||||||
// transition to 'toolContent' has not completed yet. This prevents a brief
|
// transition to 'toolContent' has not completed yet. This prevents a brief
|
||||||
// period of no-highlight during rapid navigation.
|
// period of no-highlight during rapid navigation.
|
||||||
if (selectedToolKey) {
|
return selectedToolKey ? selectedToolKey : 'tools';
|
||||||
return getTargetNavButton(selectedToolKey, registry) || selectedToolKey;
|
|
||||||
}
|
|
||||||
// Default to All Tools when no tool is selected
|
|
||||||
return 'tools';
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user