From a898df5238fa1fa3eb76905857c0f2825be80a6a Mon Sep 17 00:00:00 2001 From: Maxime GRANDCOLAS Date: Wed, 15 Jan 2025 13:06:50 +0100 Subject: [PATCH] [MS] Renamed favorites to pinned --- client/src/locales/en-US.json | 6 +-- client/src/locales/fr-FR.json | 6 +-- client/src/services/recentDocuments.ts | 1 + .../views/sidebar-menu/SidebarMenuPage.vue | 37 +++++++++++++------ client/tests/e2e/specs/sidebar.spec.ts | 4 +- .../e2e/specs/workspaces_actions.spec.ts | 7 +++- 6 files changed, 42 insertions(+), 19 deletions(-) diff --git a/client/src/locales/en-US.json b/client/src/locales/en-US.json index f704c7144da..a7f994398b7 100644 --- a/client/src/locales/en-US.json +++ b/client/src/locales/en-US.json @@ -417,8 +417,8 @@ "actionShare": "Sharing and roles", "actionDetails": "Details", "actionCopyLink": "Copy link", - "actionAddFavorite": "Add to favorites", - "actionRemoveFavorite": "Remove from favorites" + "actionAddFavorite": "Pin", + "actionRemoveFavorite": "Unpin" }, "CreateWorkspaceModal": { "pageTitle": "Create a new workspace", @@ -699,7 +699,7 @@ "SideMenu": { "workspaces": "Workspaces", "recentWorkspaces": "Recent workspaces", - "favorites": "Favorites", + "favorites": "Pinned", "noWorkspace": "No workspaces", "users": "Users", "storage": "Storage", diff --git a/client/src/locales/fr-FR.json b/client/src/locales/fr-FR.json index d5956ce56d3..1b35c4623de 100644 --- a/client/src/locales/fr-FR.json +++ b/client/src/locales/fr-FR.json @@ -417,8 +417,8 @@ "actionShare": "Partage et rôles", "actionDetails": "Détails", "actionCopyLink": "Copier le lien", - "actionAddFavorite": "Ajouter aux favoris", - "actionRemoveFavorite": "Retirer des favoris" + "actionAddFavorite": "Épingler", + "actionRemoveFavorite": "Désépingler" }, "CreateWorkspaceModal": { "pageTitle": "Créer un nouvel espace de travail", @@ -699,7 +699,7 @@ "SideMenu": { "workspaces": "Espaces de travail", "recentWorkspaces": "Espaces récents", - "favorites": "Favoris", + "favorites": "Épinglés", "noWorkspace": "Aucun espace de travail", "users": "Utilisateurs", "storage": "Stockage", diff --git a/client/src/services/recentDocuments.ts b/client/src/services/recentDocuments.ts index 1f44842819e..cbd50beba58 100644 --- a/client/src/services/recentDocuments.ts +++ b/client/src/services/recentDocuments.ts @@ -99,6 +99,7 @@ class RecentDocumentManager { addWorkspace(workspace: RecentWorkspace): void { const index = this.workspaces.value.findIndex((item) => item.id === workspace.id); if (index !== -1) { + this._arrayMove(this.workspaces.value, index, 0); } else if (this.workspaces.value.unshift(workspace) > WORKSPACE_HISTORY_SIZE) { this.workspaces.value.pop(); } diff --git a/client/src/views/sidebar-menu/SidebarMenuPage.vue b/client/src/views/sidebar-menu/SidebarMenuPage.vue index 85a64eebf5f..2dc2d6ab1a5 100644 --- a/client/src/views/sidebar-menu/SidebarMenuPage.vue +++ b/client/src/views/sidebar-menu/SidebarMenuPage.vue @@ -194,12 +194,6 @@ v-model:is-content-visible="workspacesMenuVisible" @update:is-content-visible="onWorkspacesMenuVisibilityChanged" > - - {{ $msTranslate('SideMenu.noWorkspace') }} - +
+ +
{ const isManagement = currentRouteIsOrganizationManagementRoute; +const currentWorkspace = computed(() => { + for (const wk of recentDocumentManager.getWorkspaces()) { + if (currentRouteIsWorkspaceRoute(wk.handle)) { + return wk; + } + } + return undefined; +}); + async function goToWorkspace(workspace: WorkspaceInfo): Promise { recentDocumentManager.addWorkspace(workspace); await recentDocumentManager.saveToStorage(storageManager); @@ -811,6 +827,10 @@ async function onRecentFilesMenuVisibilityChanged(visible: boolean): Promise { await expect(sidebar.locator('.file-workspaces')).toBeVisible(); await expect(sidebar.locator('.favorites')).toBeHidden(); - await expect(sidebar.locator('.workspaces')).toBeHidden(); + await expect(sidebar.locator('.workspaces')).toBeVisible(); + await expect(sidebar.locator('.workspaces').locator('.list-sidebar-header')).toHaveText('Recent workspaces'); + await expect(sidebar.locator('.workspaces').getByRole('listitem').nth(0)).toHaveText('Trademeet'); await expect(sidebar.locator('.manage-organization')).toBeHidden(); }); diff --git a/client/tests/e2e/specs/workspaces_actions.spec.ts b/client/tests/e2e/specs/workspaces_actions.spec.ts index 9c6d555537c..d9775252ce9 100644 --- a/client/tests/e2e/specs/workspaces_actions.spec.ts +++ b/client/tests/e2e/specs/workspaces_actions.spec.ts @@ -45,7 +45,7 @@ const MENU = [ }, { title: 'Miscellaneous', - actions: ['Add to favorites'], + actions: ['Pin'], }, ]; @@ -146,6 +146,8 @@ for (const mode of ['grid', 'list', 'sidebar']) { }); msTest(`Toggle workspace favorite ${mode}`, async ({ connected }) => { + const favorites = connected.locator('.sidebar').locator('.favorites'); + await expect(favorites).toBeHidden(); await openContextMenu(connected, mode as Mode); const popover = connected.locator('.workspace-context-menu'); await popover.getByRole('listitem').nth(7).click(); @@ -158,6 +160,9 @@ for (const mode of ['grid', 'list', 'sidebar']) { await expect(wk.locator('.workspace-name')).toHaveText('Trademeet'); } await expect(wk.locator('.workspace-favorite-icon')).toHaveTheClass('workspace-favorite-icon__on'); + await expect(favorites).toBeVisible(); + await expect(favorites.locator('.list-sidebar-header')).toHaveText('Pinned'); + await expect(favorites.getByRole('listitem').nth(0)).toHaveText('Trademeet'); }); msTest(`Open workspace sharing ${mode}`, async ({ connected }) => {