Skip to content

Commit

Permalink
feat: Use new DriveView when flag is activated
Browse files Browse the repository at this point in the history
  • Loading branch information
y-lohse committed Jun 8, 2020
1 parent 94db750 commit 3ff71dc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
27 changes: 15 additions & 12 deletions src/drive/web/modules/navigation/AppRoute.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,27 @@ const AppRoute = (
{__TARGET__ === 'mobile' && (
<Route path="uploadfrommobile" component={UploadFromMobile} />
)}
{flag('v2') && (
<Route path="v2(/:folderId)" component={DriveView}>
<Redirect from="/files/:folderId" to="/folder/:folderId" />
{flag('v2') ? (
<Route path="folder(/:folderId)" component={DriveView}>
<Route path="file/:fileId" component={FilesViewer} />
</Route>
)}
<Redirect from="/files/:folderId" to="/folder/:folderId" />
<Route component={FileExplorer}>
<Redirect from="/" to="folder" />
<Route path="folder" component={Folder}>
<Route path=":folderId">
) : (
<Route component={FileExplorer}>
<Route path="folder" component={Folder}>
<Route path=":folderId">
<Route path="file/:fileId" component={FilesViewer} />
<Route path="file/:fileId/revision" component={FileHistory} />
</Route>
{/* Those 2 following routes are needed for the root directory since the url is only /folder, so
next url will be /folder/file/:fileId/ */}
<Route path="file/:fileId" component={FilesViewer} />
<Route path="file/:fileId/revision" component={FileHistory} />
</Route>
{/* Those 2 following routes are needed for the root directory since the url is only /folder, so
next url will be /folder/file/:fileId/ */}
<Route path="file/:fileId" component={FilesViewer} />
<Route path="file/:fileId/revision" component={FileHistory} />
</Route>
)}
<Route component={FileExplorer}>
<Redirect from="/" to="folder" />
<Route path="recent" component={Recent}>
<Route path="file/:fileId" component={FilesViewer} />
</Route>
Expand Down
4 changes: 2 additions & 2 deletions src/drive/web/modules/views/Drive/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ const DriveView = ({ params, router, children }) => {
const filesResult = useQuery(fileQuery.definition, fileQuery.options)

const navigateToFolder = useCallback(folderId => {
router.push(`/v2/${folderId}`)
router.push(`/folder/${folderId}`)
})

const navigateToFile = useCallback(file => {
router.push(`/v2/${currentFolderId}/file/${file.id}`)
router.push(`/folder/${currentFolderId}/file/${file.id}`)
})

const changeSortOrder = useCallback((folderId_legacy, attribute, order) =>
Expand Down

0 comments on commit 3ff71dc

Please sign in to comment.