2020-11-26 09:22:30 -05:00
|
|
|
import FileTreeContext from '../../../../../frontend/js/features/file-tree/components/file-tree-context'
|
2022-01-10 10:46:46 -05:00
|
|
|
import { renderWithEditorContext } from '../../../helpers/render-with-context'
|
2020-11-26 09:22:30 -05:00
|
|
|
|
|
|
|
export default (children, options = {}) => {
|
|
|
|
let { contextProps = {}, ...renderOptions } = options
|
|
|
|
contextProps = {
|
|
|
|
projectId: '123abc',
|
2022-01-10 10:46:46 -05:00
|
|
|
projectRootFolder: [
|
2021-03-18 05:52:36 -04:00
|
|
|
{
|
2022-01-10 10:46:46 -05:00
|
|
|
_id: 'root-folder-id',
|
|
|
|
name: 'rootFolder',
|
2021-03-18 05:52:36 -04:00
|
|
|
docs: [],
|
|
|
|
fileRefs: [],
|
2021-04-27 03:52:58 -04:00
|
|
|
folders: [],
|
|
|
|
},
|
2021-03-18 05:52:36 -04:00
|
|
|
],
|
|
|
|
refProviders: {},
|
|
|
|
reindexReferences: () => {
|
|
|
|
console.log('reindex references')
|
|
|
|
},
|
|
|
|
setRefProviderEnabled: provider => {
|
|
|
|
console.log(`ref provider ${provider} enabled`)
|
|
|
|
},
|
|
|
|
setStartedFreeTrial: () => {
|
|
|
|
console.log('started free trial')
|
|
|
|
},
|
2020-11-26 09:22:30 -05:00
|
|
|
onSelect: () => {},
|
2021-04-27 03:52:58 -04:00
|
|
|
...contextProps,
|
2020-11-26 09:22:30 -05:00
|
|
|
}
|
2022-01-10 10:46:46 -05:00
|
|
|
const {
|
|
|
|
refProviders,
|
|
|
|
reindexReferences,
|
|
|
|
setRefProviderEnabled,
|
|
|
|
setStartedFreeTrial,
|
|
|
|
onSelect,
|
|
|
|
...editorContextProps
|
|
|
|
} = contextProps
|
|
|
|
return renderWithEditorContext(
|
|
|
|
<FileTreeContext
|
|
|
|
refProviders={refProviders}
|
|
|
|
reindexReferences={reindexReferences}
|
|
|
|
setRefProviderEnabled={setRefProviderEnabled}
|
|
|
|
setStartedFreeTrial={setStartedFreeTrial}
|
|
|
|
onSelect={onSelect}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</FileTreeContext>,
|
|
|
|
editorContextProps,
|
2020-11-26 09:22:30 -05:00
|
|
|
renderOptions
|
|
|
|
)
|
|
|
|
}
|