Skip to content

Commit

Permalink
[MS] Renamed favorites to pinned
Browse files Browse the repository at this point in the history
  • Loading branch information
Max-7 committed Jan 15, 2025
1 parent 25de035 commit a898df5
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 19 deletions.
6 changes: 3 additions & 3 deletions client/src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -699,7 +699,7 @@
"SideMenu": {
"workspaces": "Workspaces",
"recentWorkspaces": "Recent workspaces",
"favorites": "Favorites",
"favorites": "Pinned",
"noWorkspace": "No workspaces",
"users": "Users",
"storage": "Storage",
Expand Down
6 changes: 3 additions & 3 deletions client/src/locales/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions client/src/services/recentDocuments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
37 changes: 26 additions & 11 deletions client/src/views/sidebar-menu/SidebarMenuPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,6 @@
v-model:is-content-visible="workspacesMenuVisible"
@update:is-content-visible="onWorkspacesMenuVisibilityChanged"
>
<ion-text
class="body list-sidebar__no-workspace"
v-if="workspaces.length === 0"
>
{{ $msTranslate('SideMenu.noWorkspace') }}
</ion-text>
<sidebar-workspace-item
v-for="workspace in recentDocumentManager.getWorkspaces()"
:workspace="workspace"
Expand All @@ -210,6 +204,18 @@
"
/>
</sidebar-menu-list>
<div
class="current-workspace"
v-if="!workspacesMenuVisible && currentWorkspace"
>
<sidebar-workspace-item
:workspace="currentWorkspace"
@workspace-click="goToWorkspace"
@context-menu-requested="
openWorkspaceContextMenu($event, currentWorkspace, favorites, eventDistributor, informationManager, storageManager, true)
"
/>
</div>
</div>

<div
Expand Down Expand Up @@ -341,6 +347,7 @@ import {
currentRouteIs,
currentRouteIsOrganizationManagementRoute,
currentRouteIsUserRoute,
currentRouteIsWorkspaceRoute,
navigateTo,
navigateToWorkspace,
switchOrganization,
Expand Down Expand Up @@ -437,6 +444,15 @@ const watchSidebarWidthCancel = watch(computedWidth, async (value: number) => {

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<void> {
recentDocumentManager.addWorkspace(workspace);
await recentDocumentManager.saveToStorage(storageManager);
Expand Down Expand Up @@ -811,6 +827,10 @@ async function onRecentFilesMenuVisibilityChanged(visible: boolean): Promise<voi
}
}

.current-workspace {
margin-bottom: 1rem;
}

.back-organization {
display: flex;
align-items: center;
Expand Down Expand Up @@ -873,11 +893,6 @@ ion-menu {
gap: 0.5rem;
}

&__no-workspace {
color: var(--parsec-color-light-secondary-inversed-contrast);
opacity: 0.5;
}

&-divider {
background: var(--parsec-color-light-primary-30-opacity15);
display: flex;
Expand Down
4 changes: 3 additions & 1 deletion client/tests/e2e/specs/sidebar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ msTest('Sidebar in workspaces page', async ({ connected }) => {

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();
});
7 changes: 6 additions & 1 deletion client/tests/e2e/specs/workspaces_actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const MENU = [
},
{
title: 'Miscellaneous',
actions: ['Add to favorites'],
actions: ['Pin'],
},
];

Expand Down Expand Up @@ -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();
Expand All @@ -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 }) => {
Expand Down

0 comments on commit a898df5

Please sign in to comment.