import React, { useEffect } from 'react'; interface HelpDialogProps { open: boolean; onClose: () => void; } const shortcuts = [ { keys: 'F1 / ?', description: 'Open this help and tutorial dialog' }, { keys: 'Ctrl/⌘ + A', description: 'Select all pages in the current workspace', }, { keys: 'Delete / Backspace', description: 'Delete the selected pages after confirmation', }, { keys: 'Esc', description: 'Clear the page selection or close an open dialog', }, { keys: 'Ctrl/⌘ + Z', description: 'Undo the latest workspace command' }, { keys: 'Ctrl/⌘ + Shift + Z', description: 'Redo the next workspace command', }, { keys: 'Ctrl/⌘ + Y', description: 'Redo the next workspace command' }, { keys: '← / → in preview', description: 'Move to the previous or next page in the preview overlay', }, ]; const tutorialSteps = [ { title: '1. Open a PDF or load a workspace', body: 'Start by selecting a local PDF file. If you saved workspaces before, you can restore one from browser storage instead.', }, { title: '2. Arrange pages visually', body: 'Drag page cards to reorder them. Rotate single pages, open the large preview with a click, or remove pages you do not want in the export.', }, { title: '3. Select, copy, and delete pages', body: 'Use the checkbox on a page card to select it. Shift-click extends a range. Dragging a selected page moves the whole selection; the copy controls duplicate selected pages into a chosen slot.', }, { title: '4. Extract selected pages or branch into a new workspace', body: 'Extract selected pages when you only need a download. Open the selection as a new workspace when you want to continue working on that subset.', }, { title: '5. Save your workspace or export a PDF', body: 'Saving a workspace keeps the current working state in this browser. Exporting creates a new PDF file for download.', }, { title: '6. Use history deliberately', body: 'Each workspace operation is stored as a command with label and timestamp. Undo and redo walk through that command history.', }, ]; const HelpDialog: React.FC = ({ open, onClose }) => { useEffect(() => { if (!open) return; const handleKeyDown = (e: KeyboardEvent) => { if (e.key !== 'Escape') return; e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); onClose(); }; window.addEventListener('keydown', handleKeyDown, { capture: true }); return () => { window.removeEventListener('keydown', handleKeyDown, { capture: true }); }; }, [open, onClose]); if (!open) return null; return (
{ if (e.target === e.currentTarget) { onClose(); } }} >

Help & tutorial

PDF Workbench is a browser-only page workspace. Use it to quickly rearrange, split, merge, rotate, duplicate, and export PDFs without uploading documents to a server.

Quick tutorial

{tutorialSteps.map((step) => (

{step.title}

{step.body}

))}

Keyboard shortcuts

{shortcuts.map((shortcut) => ( {shortcut.keys} {shortcut.description} ))}

Shortcuts are ignored while typing in text fields or other editable controls.

Important concepts

Browser-only processing
PDF operations run in your browser. A self-hosted server only delivers the static app files.
Workspace
A named local editing state, including the PDF binary, page order, rotations, selection, and command history.
Export
A generated PDF download. Exported files are separate from saved workspaces.
History
Undoable commands show what changed, when it changed, and where the current point in history is.
); }; export default HelpDialog;