From 24e4998f2d47fbefd0a0abb99b69cbcfef65163b Mon Sep 17 00:00:00 2001 From: NicoTuxx Date: Tue, 19 Nov 2024 04:41:55 +0100 Subject: [PATCH 1/2] Improve FileViewer components structure & code reusability - Create a FileViewerWrapper component to wrap the FileViewer and its action bar - Isolate the FileViewerActionBar as a common component - Update all the viewers component to use the new structure - Improve all viewers UI/UX - Add translation for 'opening file' --- .../viewers/FileViewerActionBar.vue | 39 +++++++ client/src/components/viewers/index.ts | 5 + client/src/locales/en-US.json | 3 +- client/src/locales/fr-FR.json | 3 +- client/src/theme/global.scss | 30 +++-- client/src/views/files/FoldersPage.vue | 2 +- client/src/views/viewers/AudioViewer.vue | 64 ++++++++++- client/src/views/viewers/DocumentViewer.vue | 17 ++- client/src/views/viewers/FileViewer.vue | 84 ++------------ .../src/views/viewers/FileViewerWrapper.vue | 35 ++++++ client/src/views/viewers/ImageViewer.vue | 45 ++++++-- client/src/views/viewers/PdfViewer.vue | 103 +++++++++--------- .../src/views/viewers/SpreadsheetViewer.vue | 43 ++++---- client/src/views/viewers/TextViewer.vue | 2 +- client/src/views/viewers/VideoViewer.vue | 81 ++++++++++++-- client/src/views/viewers/index.ts | 3 +- .../views/workspaces/WorkspaceHistoryPage.vue | 2 +- 17 files changed, 359 insertions(+), 202 deletions(-) create mode 100644 client/src/components/viewers/FileViewerActionBar.vue create mode 100644 client/src/components/viewers/index.ts create mode 100644 client/src/views/viewers/FileViewerWrapper.vue diff --git a/client/src/components/viewers/FileViewerActionBar.vue b/client/src/components/viewers/FileViewerActionBar.vue new file mode 100644 index 00000000000..2518d386f02 --- /dev/null +++ b/client/src/components/viewers/FileViewerActionBar.vue @@ -0,0 +1,39 @@ + + + + + + + diff --git a/client/src/components/viewers/index.ts b/client/src/components/viewers/index.ts new file mode 100644 index 00000000000..abfac964274 --- /dev/null +++ b/client/src/components/viewers/index.ts @@ -0,0 +1,5 @@ +// Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS + +import FileViewerActionBar from '@/components/viewers/FileViewerActionBar.vue'; + +export { FileViewerActionBar }; diff --git a/client/src/locales/en-US.json b/client/src/locales/en-US.json index c94d97cc90c..62461a82d80 100644 --- a/client/src/locales/en-US.json +++ b/client/src/locales/en-US.json @@ -1694,6 +1694,7 @@ "date": "Preview date:" }, "fileViewers": { - "openWithDefault": "Open with default application" + "openWithDefault": "Open with default application", + "openingFile": "Opening file..." } } diff --git a/client/src/locales/fr-FR.json b/client/src/locales/fr-FR.json index 2be683e84d0..c97199fabd9 100644 --- a/client/src/locales/fr-FR.json +++ b/client/src/locales/fr-FR.json @@ -1694,6 +1694,7 @@ "date": "Date de prévisualisation :" }, "fileViewers": { - "openWithDefault": "Ouvrir avec l'application par défaut" + "openWithDefault": "Ouvrir avec l'application par défaut", + "openingFile": "Ouverture du fichier..." } } diff --git a/client/src/theme/global.scss b/client/src/theme/global.scss index 80e52c700d3..69d7930881f 100644 --- a/client/src/theme/global.scss +++ b/client/src/theme/global.scss @@ -135,23 +135,19 @@ ion-title { } // specific style for the file viewers -.file-viewer { - &-bottombar { - .action-bar { - .ms-action-bar-button { - height: 3em; - width: 3em; - border-radius: 100%; - color: var(--parsec-color-light-primary-600); - opacity: 0.6; - scale: 1; - transition: all 0.2s ease-in-out; - - &:hover { - scale: 1.1; - opacity: 1; - } - } +.file-viewer-action-bar { + .ms-action-bar-button { + height: 3em; + width: fit-content; + border-radius: 100%; + color: var(--parsec-color-light-primary-600); + opacity: 0.6; + scale: 1; + transition: all 0.2s ease-in-out; + + &:hover { + scale: 1.1; + opacity: 1; } } } diff --git a/client/src/views/files/FoldersPage.vue b/client/src/views/files/FoldersPage.vue index d00a8d971d8..7b37a656bdb 100644 --- a/client/src/views/files/FoldersPage.vue +++ b/client/src/views/files/FoldersPage.vue @@ -1211,7 +1211,7 @@ async function openEntries(entries: EntryModel[]): Promise { return; } - const modal = await openSpinnerModal('OPENING FILE'); + const modal = await openSpinnerModal('fileViewers.openingFile'); const contentType = await detectFileContentType(workspaceHandle, entry.path); try { diff --git a/client/src/views/viewers/AudioViewer.vue b/client/src/views/viewers/AudioViewer.vue index cd5d922fc51..d05934663ed 100644 --- a/client/src/views/viewers/AudioViewer.vue +++ b/client/src/views/viewers/AudioViewer.vue @@ -1,26 +1,80 @@ diff --git a/client/src/views/viewers/DocumentViewer.vue b/client/src/views/viewers/DocumentViewer.vue index 1be087360b2..894dadc390a 100644 --- a/client/src/views/viewers/DocumentViewer.vue +++ b/client/src/views/viewers/DocumentViewer.vue @@ -1,16 +1,21 @@ diff --git a/client/src/views/viewers/FileViewerWrapper.vue b/client/src/views/viewers/FileViewerWrapper.vue new file mode 100644 index 00000000000..b143750bf74 --- /dev/null +++ b/client/src/views/viewers/FileViewerWrapper.vue @@ -0,0 +1,35 @@ + + + + + + + diff --git a/client/src/views/viewers/ImageViewer.vue b/client/src/views/viewers/ImageViewer.vue index c0170f15f18..171218e636c 100644 --- a/client/src/views/viewers/ImageViewer.vue +++ b/client/src/views/viewers/ImageViewer.vue @@ -1,24 +1,43 @@ diff --git a/client/src/views/viewers/SpreadsheetViewer.vue b/client/src/views/viewers/SpreadsheetViewer.vue index a73e932cad8..98cd88c7814 100644 --- a/client/src/views/viewers/SpreadsheetViewer.vue +++ b/client/src/views/viewers/SpreadsheetViewer.vue @@ -1,29 +1,27 @@ diff --git a/client/src/views/viewers/index.ts b/client/src/views/viewers/index.ts index d7a163deed1..6d6cacb7081 100644 --- a/client/src/views/viewers/index.ts +++ b/client/src/views/viewers/index.ts @@ -3,10 +3,11 @@ import AudioViewer from '@/views/viewers/AudioViewer.vue'; import DocumentViewer from '@/views/viewers/DocumentViewer.vue'; import FileViewer from '@/views/viewers/FileViewer.vue'; +import FileViewerWrapper from '@/views/viewers/FileViewerWrapper.vue'; import ImageViewer from '@/views/viewers/ImageViewer.vue'; import PdfViewer from '@/views/viewers/PdfViewer.vue'; import SpreadsheetViewer from '@/views/viewers/SpreadsheetViewer.vue'; import TextViewer from '@/views/viewers/TextViewer.vue'; import VideoViewer from '@/views/viewers/VideoViewer.vue'; -export { AudioViewer, DocumentViewer, FileViewer, ImageViewer, PdfViewer, SpreadsheetViewer, TextViewer, VideoViewer }; +export { AudioViewer, DocumentViewer, FileViewer, FileViewerWrapper, ImageViewer, PdfViewer, SpreadsheetViewer, TextViewer, VideoViewer }; diff --git a/client/src/views/workspaces/WorkspaceHistoryPage.vue b/client/src/views/workspaces/WorkspaceHistoryPage.vue index 2c42c5b008c..5e70cef2f50 100644 --- a/client/src/views/workspaces/WorkspaceHistoryPage.vue +++ b/client/src/views/workspaces/WorkspaceHistoryPage.vue @@ -361,7 +361,7 @@ async function onEntryClicked(entry: WorkspaceHistoryEntryModel): Promise return; } - const modal = await openSpinnerModal('OPENING FILE'); + const modal = await openSpinnerModal('fileViewers.openingFile'); const contentType = await detectFileContentType(workspaceInfo.value.handle, entry.path, DateTime.fromJSDate(selectedDateTime.value)); try { From 3a0ba88f4becceb632c40ff63575a25b34047b58 Mon Sep 17 00:00:00 2001 From: Maxime GRANDCOLAS Date: Mon, 25 Nov 2024 07:54:16 +0100 Subject: [PATCH 2/2] [MS] Disabled component tests --- client/vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/vite.config.ts b/client/vite.config.ts index 9078a1b3b04..55f1bdef7ca 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -64,7 +64,7 @@ if (process.env.PARSEC_APP_SENTRY_AUTH_TOKEN) { // https://vitejs.dev/config/ const config: UserConfigExport = () => ({ test: { - include: ['tests/component/specs/*.spec.ts', 'tests/unit/specs/*.spec.ts'], + include: ['tests/unit/specs/*.spec.ts'], setupFiles: [path.resolve(__dirname, './tests/component/support/setup.ts')], server: { deps: {