diff --git a/services/web/frontend/js/features/ide-react/components/editor-and-sidebar.tsx b/services/web/frontend/js/features/ide-react/components/editor-and-sidebar.tsx index 103aae86b5..53cb7a05a3 100644 --- a/services/web/frontend/js/features/ide-react/components/editor-and-sidebar.tsx +++ b/services/web/frontend/js/features/ide-react/components/editor-and-sidebar.tsx @@ -3,7 +3,10 @@ import TwoColumnMainContent from '@/features/ide-react/components/layout/two-col import Editor from '@/features/ide-react/components/editor/editor' import EditorSidebar from '@/features/ide-react/components/editor-sidebar' import customLocalStorage from '@/infrastructure/local-storage' +import History from '@/features/ide-react/components/history' +import { HistoryProvider } from '@/features/history/context/history-context' import { useProjectContext } from '@/shared/context/project-context' +import { useLayoutContext } from '@/shared/context/layout-context' import { FileTreeFindResult } from '@/features/ide-react/types/file-tree' type EditorAndSidebarProps = { @@ -19,6 +22,8 @@ export function EditorAndSidebar({ }: EditorAndSidebarProps) { const [leftColumnIsOpen, setLeftColumnIsOpen] = useState(true) const { rootDocId, _id: projectId } = useProjectContext() + const { view } = useLayoutContext() + const historyIsOpen = view === 'history' const [openDocId, setOpenDocId] = useState( () => customLocalStorage.getItem(`doc.open_id.${projectId}`) || rootDocId @@ -46,12 +51,21 @@ export function EditorAndSidebar({ onFileTreeSelect={handleFileTreeSelect} /> ) + const rightColumnContent = ( - + <> + {/* Recreate the history context when the history view is toggled */} + {historyIsOpen && ( + + + + )} + + ) return ( diff --git a/services/web/frontend/js/features/ide-react/components/editor-sidebar.tsx b/services/web/frontend/js/features/ide-react/components/editor-sidebar.tsx index 3dd9d81109..eaf88fcab2 100644 --- a/services/web/frontend/js/features/ide-react/components/editor-sidebar.tsx +++ b/services/web/frontend/js/features/ide-react/components/editor-sidebar.tsx @@ -2,6 +2,8 @@ import React from 'react' import { Panel, PanelGroup } from 'react-resizable-panels' import { VerticalResizeHandle } from '@/features/ide-react/components/resize/vertical-resize-handle' import { FileTree } from '@/features/ide-react/components/file-tree' +import { useLayoutContext } from '@/shared/context/layout-context' +import classnames from 'classnames' import { FileTreeSelectHandler } from '@/features/ide-react/types/file-tree' type EditorSidebarProps = { @@ -15,22 +17,32 @@ export default function EditorSidebar({ onFileTreeInit, onFileTreeSelect, }: EditorSidebarProps) { + const { view } = useLayoutContext() + const historyIsOpen = view === 'history' + return ( - +