diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/V2WorkspacesList.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/V2WorkspacesList.tsx index c237c351b1b..d0921c11ed4 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/V2WorkspacesList.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/V2WorkspacesList.tsx @@ -226,7 +226,6 @@ export function V2WorkspacesList({ workspaces }: V2WorkspacesListProps) { sortDirection={sortDirection} onSort={handleSort} /> - ); diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/components/V2WorkspaceRow/V2WorkspaceRow.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/components/V2WorkspaceRow/V2WorkspaceRow.tsx index 566c3bc3709..df7d08f6a78 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/components/V2WorkspaceRow/V2WorkspaceRow.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/components/V2WorkspaceRow/V2WorkspaceRow.tsx @@ -66,9 +66,13 @@ export function V2WorkspaceRow({ const handleRemoveFromSidebar = useCallback( (event: React.MouseEvent) => { event.stopPropagation(); + if (isCurrentRoute) { + event.preventDefault(); + return; + } removeWorkspaceFromSidebar(workspace.id); }, - [removeWorkspaceFromSidebar, workspace.id], + [isCurrentRoute, removeWorkspaceFromSidebar, workspace.id], ); const creatorLabel = workspace.isCreatedByCurrentUser @@ -131,16 +135,47 @@ export function V2WorkspaceRow({ isCurrentRoute && "bg-accent/40", )} > - +
{workspace.isInSidebar ? ( - - ) : null} - + + + + + + {isCurrentRoute + ? "Can't remove the current workspace" + : "Remove from sidebar"} + + + ) : ( + + + + + Add to sidebar + + )} +
{timeLabel} ยท {creatorLabel} - -
- {workspace.isInSidebar ? ( - - - - - - {isCurrentRoute - ? "Can't remove the current workspace" - : "Remove from sidebar"} - - - ) : ( - - - - - Add to sidebar - - )} -
); diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/constants.ts b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/constants.ts index 738705ecda4..ed4b034fa9a 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/constants.ts +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/constants.ts @@ -1,5 +1,5 @@ // Shared grid template used by the column header row and every workspace row -// so the Sidebar / Name / Host / Branch / Created / Action columns align -// across the whole view. Columns hide progressively on narrower viewports. +// so the Sidebar action / Name / Host / Branch / Created columns align across +// the whole view. Columns hide progressively on narrower viewports. export const V2_WORKSPACES_ROW_GRID = - "grid grid-cols-[1.25rem_minmax(0,1fr)_2.5rem] gap-4 md:grid-cols-[1.25rem_minmax(0,1fr)_12rem_2.5rem] lg:grid-cols-[1.25rem_minmax(0,1fr)_12rem_14rem_2.5rem] xl:grid-cols-[1.25rem_minmax(0,1fr)_12rem_14rem_11rem_2.5rem] items-center"; + "grid grid-cols-[2.5rem_minmax(0,1fr)] gap-4 md:grid-cols-[2.5rem_minmax(0,1fr)_12rem] lg:grid-cols-[2.5rem_minmax(0,1fr)_12rem_14rem] xl:grid-cols-[2.5rem_minmax(0,1fr)_12rem_14rem_11rem] items-center";