diff --git a/packages/editor/App.tsx b/packages/editor/App.tsx index daa5e9f..acbb0c0 100644 --- a/packages/editor/App.tsx +++ b/packages/editor/App.tsx @@ -25,6 +25,8 @@ import { getAgentSwitchSettings, getEffectiveAgentName } from '@plannotator/ui/u import { getPlanSaveSettings } from '@plannotator/ui/utils/planSave'; import { getUIPreferences, needsUIFeaturesSetup, type UIPreferences } from '@plannotator/ui/utils/uiPreferences'; import { getEditorMode, saveEditorMode } from '@plannotator/ui/utils/editorMode'; +import { useResizablePanel } from '@plannotator/ui/hooks/useResizablePanel'; +import { ResizeHandle } from '@plannotator/ui/components/ResizeHandle'; import { getPermissionModeSettings, needsPermissionModeSetup, @@ -364,6 +366,14 @@ const App: React.FC = () => { const viewerRef = useRef(null); const containerRef = useRef(null); + // Resizable panels + const panelResize = useResizablePanel({ storageKey: 'plannotator-panel-width' }); + const tocResize = useResizablePanel({ + storageKey: 'plannotator-toc-width', + defaultWidth: 240, minWidth: 160, maxWidth: 400, side: 'left', + }); + const isResizing = panelResize.isDragging || tocResize.isDragging; + // Track active section for TOC highlighting const headingCount = useMemo(() => blocks.filter(b => b.type === 'heading').length, [blocks]); const activeSection = useActiveSection(containerRef, headingCount); @@ -1021,20 +1031,24 @@ const App: React.FC = () => { {/* Main Content */} -
+
{/* Table of Contents */} {uiPrefs.tocEnabled && ( - + <> + + + )} {/* Document Area */} -
+
{/* Mode Switcher */}
@@ -1061,6 +1075,9 @@ const App: React.FC = () => {
+ {/* Resize Handle */} + {isPanelOpen && } + {/* Annotation Panel */} { onEdit={handleEditAnnotation} shareUrl={shareUrl} sharingEnabled={sharingEnabled} + width={panelResize.width} />
diff --git a/packages/review-editor/App.tsx b/packages/review-editor/App.tsx index 9d7e847..7ce87fe 100644 --- a/packages/review-editor/App.tsx +++ b/packages/review-editor/App.tsx @@ -8,6 +8,8 @@ import { storage, getAutoClose } from '@plannotator/ui/utils/storage'; import { getIdentity } from '@plannotator/ui/utils/identity'; import { getAgentSwitchSettings, getEffectiveAgentName } from '@plannotator/ui/utils/agentSwitch'; import { CodeAnnotation, CodeAnnotationType, SelectedLineRange, DiffAnnotationMetadata } from '@plannotator/ui/types'; +import { useResizablePanel } from '@plannotator/ui/hooks/useResizablePanel'; +import { ResizeHandle } from '@plannotator/ui/components/ResizeHandle'; import { DiffViewer } from './components/DiffViewer'; import { ReviewPanel } from './components/ReviewPanel'; import { FileTree } from './components/FileTree'; @@ -155,6 +157,14 @@ const ReviewApp: React.FC = () => { const identity = useMemo(() => getIdentity(), []); + // Resizable panels + const panelResize = useResizablePanel({ storageKey: 'plannotator-review-panel-width' }); + const fileTreeResize = useResizablePanel({ + storageKey: 'plannotator-filetree-width', + defaultWidth: 256, minWidth: 160, maxWidth: 400, side: 'left', + }); + const isResizing = panelResize.isDragging || fileTreeResize.isDragging; + // Global keyboard shortcuts useEffect(() => { const handleKeyDown = (e: KeyboardEvent) => { @@ -714,28 +724,32 @@ const ReviewApp: React.FC = () => { {/* Main content */} -
+
{/* File tree sidebar - show when multiple files OR diff options available */} {(files.length > 1 || gitContext?.diffOptions) && ( - setHideViewedFiles(prev => !prev)} - enableKeyboardNav={!showExportModal} - diffOptions={gitContext?.diffOptions} - activeDiffType={diffType} - onSelectDiff={handleDiffSwitch} - isLoadingDiff={isLoadingDiff} - /> + <> + setHideViewedFiles(prev => !prev)} + enableKeyboardNav={!showExportModal} + diffOptions={gitContext?.diffOptions} + activeDiffType={diffType} + onSelectDiff={handleDiffSwitch} + isLoadingDiff={isLoadingDiff} + width={fileTreeResize.width} + /> + + )} {/* Diff viewer */} -
+
{activeFile ? ( { )}
+ {/* Resize Handle */} + {isPanelOpen && } + {/* Annotations panel */} { onSelectAnnotation={handleSelectAnnotation} onDeleteAnnotation={handleDeleteAnnotation} feedbackMarkdown={feedbackMarkdown} + width={panelResize.width} />
diff --git a/packages/review-editor/components/FileTree.tsx b/packages/review-editor/components/FileTree.tsx index f9447d0..e5a971a 100644 --- a/packages/review-editor/components/FileTree.tsx +++ b/packages/review-editor/components/FileTree.tsx @@ -28,6 +28,7 @@ interface FileTreeProps { activeDiffType?: string; onSelectDiff?: (diffType: string) => void; isLoadingDiff?: boolean; + width?: number; } export const FileTree: React.FC = ({ @@ -44,6 +45,7 @@ export const FileTree: React.FC = ({ activeDiffType, onSelectDiff, isLoadingDiff, + width, }) => { // Keyboard navigation: j/k or arrow keys const handleKeyDown = useCallback((e: KeyboardEvent) => { @@ -82,7 +84,7 @@ export const FileTree: React.FC = ({ }; return ( -