diff --git a/manifest.webapp b/manifest.webapp index 37ec6d83..b144af71 100644 --- a/manifest.webapp +++ b/manifest.webapp @@ -125,6 +125,6 @@ "accepted_mime_types": ["application/pdf", "image/jpeg", "image/png"], "max_number_of_files": 1, "max_size_per_file_in_MB": 10, - "route_to_upload": "/#/create?fromFlagshipUpload=true" + "route_to_upload": "/#/paper/create?fromFlagshipUpload=true" } } diff --git a/src/components/Actions/DeleteConfirm.jsx b/src/components/Actions/DeleteConfirm.jsx index 1103ce40..e3a0b7af 100644 --- a/src/components/Actions/DeleteConfirm.jsx +++ b/src/components/Actions/DeleteConfirm.jsx @@ -32,7 +32,7 @@ const DeleteConfirm = ({ files, isLast, onClose, children }) => { } onClose() if (isLast || isMultiSelectionActive) { - navigate('/', { replace: true }) + navigate('/paper', { replace: true }) } }, [ clearQualification, diff --git a/src/components/Actions/Items/open.jsx b/src/components/Actions/Items/open.jsx index c29bfab5..ab371a64 100644 --- a/src/components/Actions/Items/open.jsx +++ b/src/components/Actions/Items/open.jsx @@ -25,7 +25,7 @@ export const open = () => { cozyUrl: client.getStackClient().uri, subDomainType: client.getInstanceOptions().subdomain, pathname: '/', - hash: `/files/${qualificationLabel}/${fileId}` + hash: `/paper/files/${qualificationLabel}/${fileId}` }) return ( diff --git a/src/components/Actions/Items/select.jsx b/src/components/Actions/Items/select.jsx index 3f8f1e98..ab125f66 100644 --- a/src/components/Actions/Items/select.jsx +++ b/src/components/Actions/Items/select.jsx @@ -26,7 +26,7 @@ export const select = ({ hideActionsMenu, addMultiSelectionFile }) => { cozyUrl: client.getStackClient().uri, subDomainType: client.getInstanceOptions().subdomain, pathname: '/', - hash: '/multiselect' + hash: '/paper/multiselect' }) return ( diff --git a/src/components/AppRouter.jsx b/src/components/AppRouter.jsx index 176f7776..68028899 100644 --- a/src/components/AppRouter.jsx +++ b/src/components/AppRouter.jsx @@ -42,28 +42,57 @@ export const AppRouter = props => { }> }> } errorElement={}> - }> - } /> - } - /> - } - /> - } /> - } - /> - } - /> + + } /> + }> + } + /> + } + /> + } + /> + } /> + } + /> + } + /> + } + > + } + /> + } + /> + + } + > + {fileViewerRoutes.map(Component => Component)} + + + } + path="files/:qualificationLabel" + element={ + + } > { /> } /> } + /> + } + /> + } + /> + } /> + } + /> + } > {fileViewerRoutes.map(Component => Component)} + } + /> - } - > - } - /> - } /> - } /> - } - /> - } - /> - } /> - } - /> - } - > - {fileViewerRoutes.map(Component => Component)} - - } - /> - - - } /> + } /> diff --git a/src/components/Contexts/MultiSelectionProvider.spec.jsx b/src/components/Contexts/MultiSelectionProvider.spec.jsx index 17e7f797..6cd6aa9f 100644 --- a/src/components/Contexts/MultiSelectionProvider.spec.jsx +++ b/src/components/Contexts/MultiSelectionProvider.spec.jsx @@ -38,7 +38,7 @@ describe('MultiSelectionProvider', () => { expect(result.current.allMultiSelectionFiles).toEqual([fileMock01]) // isMultiSelectionActive => false - useLocation.mockReturnValue({ pathname: '/' }) + useLocation.mockReturnValue({ pathname: '/paper' }) rerender() diff --git a/src/components/CreatePaperDataBackupRoute.jsx b/src/components/CreatePaperDataBackupRoute.jsx index 167285f4..c21beaa2 100644 --- a/src/components/CreatePaperDataBackupRoute.jsx +++ b/src/components/CreatePaperDataBackupRoute.jsx @@ -15,7 +15,7 @@ const CreatePaperDataBackupRoute = () => { ) if (qualificationLabel) { - navigate(`/create/${qualificationLabel}`) + navigate(`/paper/create/${qualificationLabel}`) } } diff --git a/src/components/ForwardFab/ForwardFab.jsx b/src/components/ForwardFab/ForwardFab.jsx index bb6ca85d..b35f7880 100644 --- a/src/components/ForwardFab/ForwardFab.jsx +++ b/src/components/ForwardFab/ForwardFab.jsx @@ -27,7 +27,7 @@ const ForwardFab = () => { ) const hideForwardFabTooltip = settings?.[0]?.hideForwardFabTooltip - const isHome = pathname === '/' + const isHome = pathname === '/paper' const open = isHome && countPaperCreatedByMesPapiers === 1 && !hideForwardFabTooltip @@ -54,7 +54,7 @@ const ForwardFab = () => { className="u-mr-half" onClick={() => { hideTooltip() - navigate(`/multiselect`) + navigate(`/paper/multiselect`) }} aria-label={t('Home.Fab.forwardPaper')} > diff --git a/src/components/Harvest/CannotConnectModal/ExtraContent.jsx b/src/components/Harvest/CannotConnectModal/ExtraContent.jsx index 181edac0..87ca3fea 100644 --- a/src/components/Harvest/CannotConnectModal/ExtraContent.jsx +++ b/src/components/Harvest/CannotConnectModal/ExtraContent.jsx @@ -21,7 +21,9 @@ const ExtraContent = () => { variant="secondary" label={t('Harvest.cannotConnectModal.button')} onClick={() => - navigate(`/files/${qualificationLabel}/create/${qualificationLabel}`) + navigate( + `/paper/files/${qualificationLabel}/create/${qualificationLabel}` + ) } fullWidth startIcon={} diff --git a/src/components/Multiselect/ForwardModalByRoute.jsx b/src/components/Multiselect/ForwardModalByRoute.jsx index 01e3b4f5..193efd8b 100644 --- a/src/components/Multiselect/ForwardModalByRoute.jsx +++ b/src/components/Multiselect/ForwardModalByRoute.jsx @@ -41,7 +41,7 @@ const ForwardModalByRoute = () => { file={file} onForward={() => isMultiSelectionActive - ? navigate('/', { replace: true }) + ? navigate('/paper', { replace: true }) : navigate('..', { replace: true }) } onClose={() => navigate('..', { replace: true })} diff --git a/src/components/Multiselect/ShareBottomSheet.jsx b/src/components/Multiselect/ShareBottomSheet.jsx index d6bf419d..78f33826 100644 --- a/src/components/Multiselect/ShareBottomSheet.jsx +++ b/src/components/Multiselect/ShareBottomSheet.jsx @@ -39,7 +39,7 @@ const ShareBottomSheet = ({ onClose, fileId, docs }) => { variant: 'filled' }) if (isMultiSelectionActive) { - navigate('/', { replace: true }) + navigate('/paper', { replace: true }) } else { navigate('..', { replace: true }) } diff --git a/src/components/Papers/PaperItem.jsx b/src/components/Papers/PaperItem.jsx index 8abfe385..e438892f 100644 --- a/src/components/Papers/PaperItem.jsx +++ b/src/components/Papers/PaperItem.jsx @@ -87,7 +87,7 @@ const PaperItem = ({ const route = isMultiSelectionActive ? `multiselect/view` : `files/${paperTheme}` - navigate(`/${route}/${paper._id}`, { + navigate(`/paper/${route}/${paper._id}`, { state: { background: `${pathname}${search}` } }) } diff --git a/src/components/PapersFab/PapersFab.jsx b/src/components/PapersFab/PapersFab.jsx index 2f19e667..45932768 100644 --- a/src/components/PapersFab/PapersFab.jsx +++ b/src/components/PapersFab/PapersFab.jsx @@ -62,7 +62,7 @@ const PapersFab = () => { const handleClick = () => { return generalActions.length === 0 - ? navigate('/create') + ? navigate('/paper/create') : setShowGeneralMenu(prev => !prev) } diff --git a/src/components/PapersFab/PapersFab.spec.jsx b/src/components/PapersFab/PapersFab.spec.jsx index 104047df..2025c008 100644 --- a/src/components/PapersFab/PapersFab.spec.jsx +++ b/src/components/PapersFab/PapersFab.spec.jsx @@ -48,7 +48,7 @@ describe('PapersFabWrapper', () => { fireEvent.click(btn) expect(mockNavigate).toBeCalledTimes(1) - expect(mockNavigate).toBeCalledWith('/create') + expect(mockNavigate).toBeCalledWith('/paper/create') }) }) diff --git a/src/components/SearchResult/helpers.js b/src/components/SearchResult/helpers.js index 8fba4a4e..8415fe7a 100644 --- a/src/components/SearchResult/helpers.js +++ b/src/components/SearchResult/helpers.js @@ -32,7 +32,7 @@ export const makeFlexsearchResultLineOnClick = ({ if (isMultiSelectionActive) { changeCurrentMultiSelectionFile(doc) } else { - navigate(`/files/${qualificationLabel}/${doc._id}`, { + navigate(`/paper/files/${qualificationLabel}/${doc._id}`, { state: navigateState }) } diff --git a/src/components/SearchResult/helpers.spec.js b/src/components/SearchResult/helpers.spec.js index 2904c515..c73c8e69 100644 --- a/src/components/SearchResult/helpers.spec.js +++ b/src/components/SearchResult/helpers.spec.js @@ -16,7 +16,7 @@ describe('makeFlexsearchResultLineOnClick', () => { getInstanceOptions: () => ({ subdomain: 'cozy' }) } const navigate = jest.fn() - const navigateState = { background: '/search' } + const navigateState = { background: '/paper/search' } const changeCurrentMultiSelectionFile = jest.fn() beforeEach(() => { @@ -67,9 +67,12 @@ describe('makeFlexsearchResultLineOnClick', () => { }) onClick() - expect(navigate).toHaveBeenCalledWith('/files/qualificationLabel/fileId', { - state: { background: '/search' } - }) + expect(navigate).toHaveBeenCalledWith( + '/paper/files/qualificationLabel/fileId', + { + state: { background: '/paper/search' } + } + ) }) it('should return a function that changes the current multi selection file when the doc is a file and the multi selection is active', () => { diff --git a/src/components/Viewer/SelectFileButton.jsx b/src/components/Viewer/SelectFileButton.jsx index 202bd144..e659f724 100644 --- a/src/components/Viewer/SelectFileButton.jsx +++ b/src/components/Viewer/SelectFileButton.jsx @@ -18,7 +18,7 @@ const SelectFileButton = ({ file }) => { const icon = const handleClick = () => { - navigate(`/multiselect`) + navigate(`/paper/multiselect`) addMultiSelectionFile(file) } diff --git a/src/components/Views/CreatePaperModal.jsx b/src/components/Views/CreatePaperModal.jsx index e7bc73a1..d42c7e58 100644 --- a/src/components/Views/CreatePaperModal.jsx +++ b/src/components/Views/CreatePaperModal.jsx @@ -32,7 +32,7 @@ const CreatePaperModal = () => { }, [fromFlagshipUpload, navigate, webviewIntent]) const onSubmit = () => { - navigate(`/files/${qualificationLabel}`) + navigate(`/paper/files/${qualificationLabel}`) } useEffect(() => { diff --git a/src/components/Views/PapersList.jsx b/src/components/Views/PapersList.jsx index e3973403..59b29b3e 100644 --- a/src/components/Views/PapersList.jsx +++ b/src/components/Views/PapersList.jsx @@ -28,7 +28,7 @@ const ConditionnalPapersList = props => { flag('hide.healthTheme.enabled') && getThemeByItem({ label: params.qualificationLabel })?.label === 'health' ) { - return + return } return diff --git a/src/components/Views/helpers.js b/src/components/Views/helpers.js index ea286152..27dfb2d2 100644 --- a/src/components/Views/helpers.js +++ b/src/components/Views/helpers.js @@ -71,7 +71,7 @@ export const buildURLSearchParamsForInstallKonnectorFromIntent = ( ) => { const paramsObj = { // Useful for redirecting on the route(harvest) opening the login modal - redirectAfterInstall: `/files/${qualificationLabel}/harvest/`, + redirectAfterInstall: `/paper/files/${qualificationLabel}/harvest/`, ...(konnectorCriteria.name && { slug: konnectorCriteria.name }), diff --git a/src/notifications/index.js b/src/notifications/index.js index ccc8b3cb..93440333 100644 --- a/src/notifications/index.js +++ b/src/notifications/index.js @@ -71,12 +71,12 @@ class ExpirationNotification extends NotificationView { } getExtraAttributes() { - let paperLink = '' + let paperLink = 'paper' if (!this.#hasMultipleExpiredFiles) { const file = this.filesInfo[0].file if (file) { - paperLink = `files/${file.metadata.qualification.label}/${file._id}` + paperLink = `paper/files/${file.metadata.qualification.label}/${file._id}` } }