mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-12-18 20:04:17 +01:00
same
This commit is contained in:
parent
0eefc734f5
commit
f19832d47e
@ -100,6 +100,7 @@ const FileManager: React.FC<FileManagerProps> = ({ selectedTool }) => {
|
||||
radius="md"
|
||||
className="overflow-hidden p-0"
|
||||
withCloseButton={false}
|
||||
zIndex={1300}
|
||||
styles={{
|
||||
content: {
|
||||
position: 'relative',
|
||||
|
||||
@ -24,7 +24,7 @@ const QuickAccessBar = forwardRef<HTMLDivElement>((_, ref) => {
|
||||
const { t } = useTranslation();
|
||||
const { isRainbowMode } = useRainbowThemeContext();
|
||||
const { openFilesModal, isFilesModalOpen } = useFilesModalContext();
|
||||
const { handleReaderToggle, handleBackToTools, handleToolSelect, selectedToolKey, leftPanelView, toolRegistry, readerMode, resetTool } = useToolWorkflow();
|
||||
const { handleReaderToggle, handleBackToTools, handleToolSelect, selectedToolKey, leftPanelView, toolRegistry, readerMode, resetTool, setToolPanelMode } = useToolWorkflow();
|
||||
const { getToolNavigation } = useSidebarNavigation();
|
||||
const { config } = useAppConfig();
|
||||
const [configModalOpen, setConfigModalOpen] = useState(false);
|
||||
@ -100,6 +100,7 @@ const QuickAccessBar = forwardRef<HTMLDivElement>((_, ref) => {
|
||||
setActiveButton('read');
|
||||
handleBackToTools();
|
||||
handleReaderToggle();
|
||||
setToolPanelMode('sidebar');
|
||||
}
|
||||
},
|
||||
// TODO: Add sign
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useEffect, useState, useRef } from 'react';
|
||||
import { ActionIcon, ScrollArea, Switch, Text, Tooltip } from '@mantine/core';
|
||||
import { ActionIcon, ScrollArea, Switch, Text, Tooltip, useMantineColorScheme } from '@mantine/core';
|
||||
import ViewSidebarRoundedIcon from '@mui/icons-material/ViewSidebarRounded';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import ToolSearch from './toolPicker/ToolSearch';
|
||||
@ -7,6 +7,7 @@ import LegacyToolList from './LegacyToolList';
|
||||
import { ToolRegistryEntry } from '../../data/toolsTaxonomy';
|
||||
import { ToolId } from '../../types/toolId';
|
||||
import { useFocusTrap } from '../../hooks/tools/useFocusTrap';
|
||||
import { BASE_PATH } from '../../constants/app';
|
||||
import './ToolPanel.css';
|
||||
|
||||
interface LegacyToolSurfaceProps {
|
||||
@ -44,12 +45,21 @@ const LegacyToolSurface = ({
|
||||
geometry,
|
||||
}: LegacyToolSurfaceProps) => {
|
||||
const { t } = useTranslation();
|
||||
const { colorScheme } = useMantineColorScheme();
|
||||
const [isExiting, setIsExiting] = useState(false);
|
||||
const surfaceRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// Enable focus trap when surface is active
|
||||
useFocusTrap(surfaceRef, !isExiting);
|
||||
|
||||
const brandAltText = t("home.mobile.brandAlt", "Stirling PDF logo");
|
||||
const brandIconSrc = `${BASE_PATH}/branding/StirlingPDFLogoNoText${
|
||||
colorScheme === "dark" ? "Dark" : "Light"
|
||||
}.svg`;
|
||||
const brandTextSrc = `${BASE_PATH}/branding/StirlingPDFLogo${
|
||||
colorScheme === "dark" ? "White" : "Black"
|
||||
}Text.svg`;
|
||||
|
||||
const handleExit = () => {
|
||||
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
|
||||
@ -96,19 +106,15 @@ const LegacyToolSurface = ({
|
||||
className={`tool-panel__legacy-surface-inner ${isExiting ? 'tool-panel__legacy-surface-inner--exiting' : ''}`}
|
||||
>
|
||||
<header className="tool-panel__legacy-header">
|
||||
<div className="tool-panel__legacy-heading">
|
||||
<Text fw={700} size="lg">
|
||||
{t('toolPanel.legacy.heading', 'All tools (legacy view)')}
|
||||
</Text>
|
||||
<Text size="sm" c="dimmed">
|
||||
{t('toolPanel.legacy.tagline', 'Browse and launch tools while keeping the classic full-width gallery.')}
|
||||
</Text>
|
||||
<div className="tool-panel__legacy-brand">
|
||||
<img src={brandIconSrc} alt="" className="tool-panel__legacy-brand-icon" />
|
||||
<img src={brandTextSrc} alt={brandAltText} className="tool-panel__legacy-brand-text" />
|
||||
</div>
|
||||
<Tooltip label={toggleLabel} position="bottom" withArrow>
|
||||
<ActionIcon
|
||||
variant="subtle"
|
||||
radius="xl"
|
||||
size="lg"
|
||||
size="md"
|
||||
onClick={handleExit}
|
||||
aria-label={toggleLabel}
|
||||
>
|
||||
|
||||
@ -18,6 +18,11 @@ const ToolRenderer = ({
|
||||
const { toolRegistry } = useToolWorkflow();
|
||||
const selectedTool = toolRegistry[selectedToolKey];
|
||||
|
||||
// Handle tools that only work in workbenches (read, multiTool)
|
||||
if (selectedTool && !selectedTool.component && selectedTool.workbench) {
|
||||
return null; // These tools render in their workbench, not in the sidebar
|
||||
}
|
||||
|
||||
if (!selectedTool || !selectedTool.component) {
|
||||
return <div>Tool not found: {selectedToolKey}</div>;
|
||||
}
|
||||
|
||||
@ -36,6 +36,9 @@ export default function HomePage() {
|
||||
selectedToolKey,
|
||||
handleToolSelect,
|
||||
handleBackToTools,
|
||||
readerMode,
|
||||
leftPanelView,
|
||||
setLeftPanelView,
|
||||
} = useToolWorkflow();
|
||||
|
||||
const { openFilesModal } = useFilesModalContext();
|
||||
@ -116,6 +119,23 @@ export default function HomePage() {
|
||||
};
|
||||
}, [isMobile]);
|
||||
|
||||
// Automatically switch to workbench when read mode or multiTool is activated in mobile
|
||||
useEffect(() => {
|
||||
if (isMobile && (readerMode || selectedToolKey === 'multiTool')) {
|
||||
setActiveMobileView('workbench');
|
||||
}
|
||||
}, [isMobile, readerMode, selectedToolKey]);
|
||||
|
||||
// When navigating back to tools view in mobile with a workbench-only tool, show tool picker
|
||||
useEffect(() => {
|
||||
if (isMobile && activeMobileView === 'tools' && selectedTool) {
|
||||
// Check if this is a workbench-only tool (has workbench but no component)
|
||||
if (selectedTool.workbench && !selectedTool.component) {
|
||||
setLeftPanelView('toolPicker');
|
||||
}
|
||||
}
|
||||
}, [isMobile, activeMobileView, selectedTool, setLeftPanelView]);
|
||||
|
||||
const baseUrl = getBaseUrl();
|
||||
|
||||
// Update document meta when tool changes
|
||||
|
||||
Loading…
Reference in New Issue
Block a user