Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ export function V2WorkspacesList({ workspaces }: V2WorkspacesListProps) {
sortDirection={sortDirection}
onSort={handleSort}
/>
<span />
</div>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -131,16 +135,47 @@ export function V2WorkspaceRow({
isCurrentRoute && "bg-accent/40",
)}
>
<span className="flex items-center justify-center">
<div className="flex items-center justify-center">
{workspace.isInSidebar ? (
<span
role="img"
aria-label="In your sidebar"
title="In your sidebar"
className="size-1.5 rounded-full bg-primary"
/>
) : null}
</span>
<Tooltip delayDuration={300}>
<TooltipTrigger asChild>
<Button
size="icon"
variant="ghost"
onClick={handleRemoveFromSidebar}
aria-disabled={isCurrentRoute}
aria-label="Remove from sidebar"
className={cn(
"size-7",
isCurrentRoute && "cursor-not-allowed opacity-50",
)}
>
<LuMinus className="size-3.5" />
</Button>
</TooltipTrigger>
<TooltipContent side="right">
{isCurrentRoute
? "Can't remove the current workspace"
: "Remove from sidebar"}
</TooltipContent>
</Tooltip>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
) : (
<Tooltip delayDuration={300}>
<TooltipTrigger asChild>
<Button
size="icon"
variant="ghost"
onClick={handleAddToSidebar}
aria-label="Add to sidebar"
className="size-7"
>
<LuPlus className="size-3.5" />
</Button>
</TooltipTrigger>
<TooltipContent side="right">Add to sidebar</TooltipContent>
</Tooltip>
)}
</div>

<span className="flex min-w-0 items-center">
<span
Expand Down Expand Up @@ -176,45 +211,6 @@ export function V2WorkspaceRow({
>
{timeLabel} · {creatorLabel}
</span>

<div className="flex justify-end">
{workspace.isInSidebar ? (
<Tooltip delayDuration={300}>
<TooltipTrigger asChild>
<Button
size="icon"
variant="ghost"
onClick={handleRemoveFromSidebar}
disabled={isCurrentRoute}
aria-label="Remove from sidebar"
className="size-7 opacity-0 transition-opacity group-hover/row:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100"
>
<LuMinus className="size-3.5" />
</Button>
</TooltipTrigger>
<TooltipContent side="left">
{isCurrentRoute
? "Can't remove the current workspace"
: "Remove from sidebar"}
</TooltipContent>
</Tooltip>
) : (
<Tooltip delayDuration={300}>
<TooltipTrigger asChild>
<Button
size="icon"
variant="ghost"
onClick={handleAddToSidebar}
aria-label="Add to sidebar"
className="size-7 opacity-0 transition-opacity group-hover/row:opacity-100 focus-visible:opacity-100"
>
<LuPlus className="size-3.5" />
</Button>
</TooltipTrigger>
<TooltipContent side="left">Add to sidebar</TooltipContent>
</Tooltip>
)}
</div>
</div>
</li>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Loading