|
|
@@ -1,9 +1,14 @@
|
|
|
import ChangeList from './change-list/change-list'
|
|
|
import DiffView from './diff-view/diff-view'
|
|
|
import { useLayoutContext } from '../../../shared/context/layout-context'
|
|
|
-import { useHistoryContext } from '../context/history-context'
|
|
|
+import { HistoryProvider, useHistoryContext } from '../context/history-context'
|
|
|
+import { createPortal } from 'react-dom'
|
|
|
+import HistoryFileTree from './history-file-tree'
|
|
|
+import getMeta from '../../../utils/meta'
|
|
|
|
|
|
-export default function HistoryRoot() {
|
|
|
+const fileTreeContainer = document.getElementById('history-file-tree')
|
|
|
+
|
|
|
+function Main() {
|
|
|
const { view } = useLayoutContext()
|
|
|
const { updates } = useHistoryContext()
|
|
|
|
|
|
@@ -12,9 +17,37 @@ export default function HistoryRoot() {
|
|
|
}
|
|
|
|
|
|
return (
|
|
|
- <div className="history-react">
|
|
|
- <DiffView />
|
|
|
- <ChangeList />
|
|
|
- </div>
|
|
|
+ <>
|
|
|
+ {fileTreeContainer
|
|
|
+ ? createPortal(
|
|
|
+ <HistoryFileTree
|
|
|
+ onSelect={() => {}}
|
|
|
+ refProviders={{}}
|
|
|
+ reindexReferences={() => {}}
|
|
|
+ setRefProviderEnabled={() => {}}
|
|
|
+ setStartedFreeTrial={() => {}}
|
|
|
+ />,
|
|
|
+ fileTreeContainer
|
|
|
+ )
|
|
|
+ : null}
|
|
|
+ <div className="history-react">
|
|
|
+ <DiffView />
|
|
|
+ <ChangeList />
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
+export default function HistoryRoot() {
|
|
|
+ const isReact = getMeta('ol-splitTestVariants')?.['history-view'] === 'react'
|
|
|
+
|
|
|
+ if (!isReact) {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+
|
|
|
+ return (
|
|
|
+ <HistoryProvider>
|
|
|
+ <Main />
|
|
|
+ </HistoryProvider>
|
|
|
)
|
|
|
}
|