From d6024c982cfc8083e9ae2eb68861ca2feb810072 Mon Sep 17 00:00:00 2001 From: Montassar Ghanmy Date: Wed, 6 Mar 2024 17:13:51 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20preview=20navigation=20(#4?= =?UTF-8?q?17)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/app/features/router/services/router-service.ts | 6 +++--- .../views/client/body/drive/documents/document-row.tsx | 2 +- .../src/app/views/client/viewer/drive-preview.tsx | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tdrive/frontend/src/app/features/router/services/router-service.ts b/tdrive/frontend/src/app/features/router/services/router-service.ts index 5671404b..19d9a7d7 100644 --- a/tdrive/frontend/src/app/features/router/services/router-service.ts +++ b/tdrive/frontend/src/app/features/router/services/router-service.ts @@ -52,9 +52,9 @@ class RouterServices extends Observable { clientSubPathnames: Readonly = [ '/client/:companyId', '/client/:companyId/v/:viewId', - '/client/:companyId/preview/:itemId', - '/client/:companyId/v/:viewId/preview/:itemId', '/client/:companyId/v/:viewId/d/:dirId', + '/client/:companyId/v/:viewId/preview/:itemId', + '/client/:companyId/v/:viewId/d/:dirId/preview/:itemId', '/client/:companyId/w/:workspaceId', '/client/:companyId/w/:workspaceId/c/:channelId', '/client/:companyId/w/:workspaceId/c/:channelId/t/:threadId', @@ -294,8 +294,8 @@ class RouterServices extends Observable { `${this.pathnames.CLIENT}` + (state.companyId ? `/${state.companyId}` : '') + (state.viewId ? `/v/${state.viewId}` : '') + - (state.itemId ? `/preview/${state.itemId}` : '') + (state.dirId ? `/d/${state.dirId}` : '') + + (state.itemId ? `/preview/${state.itemId}` : '') + (state.sharedWithMe ? `/shared-with-me` : '') + (state.workspaceId ? `/w/${state.workspaceId}` : '') + (state.channelId ? `/c/${state.channelId}` : '') + diff --git a/tdrive/frontend/src/app/views/client/body/drive/documents/document-row.tsx b/tdrive/frontend/src/app/views/client/body/drive/documents/document-row.tsx index 099b9ab2..11ecfa9a 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/documents/document-row.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/documents/document-row.tsx @@ -58,7 +58,7 @@ export const DocumentRow = ({ }, [itemId]); const preview = () => { - history.push(RouterServices.generateRouteFromState({companyId: company, itemId: item.id, dirId: ''})); + history.push(RouterServices.generateRouteFromState({companyId: company, itemId: item.id})); }; return ( diff --git a/tdrive/frontend/src/app/views/client/viewer/drive-preview.tsx b/tdrive/frontend/src/app/views/client/viewer/drive-preview.tsx index 19c8aaa5..3ab8bff3 100644 --- a/tdrive/frontend/src/app/views/client/viewer/drive-preview.tsx +++ b/tdrive/frontend/src/app/views/client/viewer/drive-preview.tsx @@ -32,7 +32,6 @@ export const DrivePreview: React.FC = ({ items }) => { const { status, isOpen, open, close, loading } = useDrivePreview(); const [modalLoading, setModalLoading] = useState(true); const { loading: loadingData } = useDrivePreviewLoading(); - const { type = '' } = useDrivePreviewDisplayData(); let animationTimeout: number = setTimeout(() => undefined); const handleSwitchRight = () => { const currentItem = status.item; @@ -83,12 +82,11 @@ export const DrivePreview: React.FC = ({ items }) => { if (device != 'ios' && device != 'android') { close(); history.push( - RouterServices.generateRouteFromState({ companyId: company, viewId: '', itemId: item.id, dirId: '' }), + RouterServices.generateRouteFromState({ companyId: company, itemId: item.id, }), ); open(item); } }; - return ( = ({ items }) => { > close()} + onClick={() => { + close(); + history.push(RouterServices.generateRouteFromState({ companyId: company, itemId: '' })); + }} />