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 @@ -102,6 +102,7 @@ export function DashboardSidebarWorkspaceItem({
)}
<DashboardSidebarCollapsedWorkspaceButton
hostType={hostType}
workspaceType={workspace.type}
hostIsOnline={hostIsOnline}
isActive={isActive}
workspaceStatus={workspaceStatus}
Expand Down Expand Up @@ -190,11 +191,8 @@ export function DashboardSidebarWorkspaceItem({
workspaceStatus={workspaceStatus}
onClick={isPending ? handlePendingClick : handleClick}
onDoubleClick={isPending ? undefined : startRename}
onDeleteClick={
isMainWorkspace
? handleRemoveFromSidebar
: () => setIsDeleteDialogOpen(true)
}
onRemoveFromSidebarClick={handleRemoveFromSidebar}
onCloseWorkspaceClick={() => setIsDeleteDialogOpen(true)}
onRenameValueChange={setRenameValue}
onSubmitRename={submitRename}
onCancelRename={cancelRename}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { cn } from "@superset/ui/utils";
import { type ComponentPropsWithoutRef, forwardRef } from "react";
import type { ActivePaneStatus } from "shared/tabs-types";
import type { DashboardSidebarWorkspaceHostType } from "../../../../types";
import type {
DashboardSidebarWorkspaceHostType,
DashboardSidebarWorkspaceType,
} from "../../../../types";
import { DashboardSidebarWorkspaceIcon } from "../DashboardSidebarWorkspaceIcon";

interface DashboardSidebarCollapsedWorkspaceButtonProps
extends ComponentPropsWithoutRef<"button"> {
hostType: DashboardSidebarWorkspaceHostType;
workspaceType: DashboardSidebarWorkspaceType;
hostIsOnline: boolean | null;
isActive: boolean;
workspaceStatus?: ActivePaneStatus | null;
Expand All @@ -20,6 +24,7 @@ export const DashboardSidebarCollapsedWorkspaceButton = forwardRef<
(
{
hostType,
workspaceType,
hostIsOnline,
isActive,
workspaceStatus = null,
Expand All @@ -43,6 +48,7 @@ export const DashboardSidebarCollapsedWorkspaceButton = forwardRef<
>
<DashboardSidebarWorkspaceIcon
hostType={hostType}
workspaceType={workspaceType}
hostIsOnline={hostIsOnline}
isActive={isActive}
variant="collapsed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
useMemo,
useRef,
} from "react";
import { HiMiniXMark } from "react-icons/hi2";
import { HiMiniMinus, HiMiniXMark } from "react-icons/hi2";
import type { DiffStats } from "renderer/hooks/host-service/useDiffStats";
import { HotkeyLabel } from "renderer/hotkeys";
import { electronTrpc } from "renderer/lib/electron-trpc";
Expand Down Expand Up @@ -42,7 +42,8 @@ interface DashboardSidebarExpandedWorkspaceRowProps
workspaceStatus?: ActivePaneStatus | null;
onClick?: () => void;
onDoubleClick?: () => void;
onDeleteClick: () => void;
onCloseWorkspaceClick: () => void;
onRemoveFromSidebarClick: () => void;
onRenameValueChange: (value: string) => void;
onSubmitRename: () => void;
onCancelRename: () => void;
Expand All @@ -63,7 +64,8 @@ export const DashboardSidebarExpandedWorkspaceRow = forwardRef<
workspaceStatus = null,
onClick,
onDoubleClick,
onDeleteClick,
onCloseWorkspaceClick,
onRemoveFromSidebarClick,
onRenameValueChange,
onSubmitRename,
onCancelRename,
Expand Down Expand Up @@ -105,9 +107,6 @@ export const DashboardSidebarExpandedWorkspaceRow = forwardRef<
const workspaceKindDescription = isMainWorkspace
? "Uses the repository checkout on this host"
: "Isolated copy for parallel development";
const closeLabel = isMainWorkspace
? "Remove from sidebar"
: "Close workspace";

return (
// biome-ignore lint/a11y/noStaticElementInteractions: Mirrors the legacy sidebar row UI, which includes nested action buttons.
Expand Down Expand Up @@ -167,6 +166,7 @@ export const DashboardSidebarExpandedWorkspaceRow = forwardRef<
>
<DashboardSidebarWorkspaceIcon
hostType={hostType}
workspaceType={workspace.type}
hostIsOnline={hostIsOnline}
isActive={isActive}
variant="expanded"
Expand All @@ -179,6 +179,7 @@ export const DashboardSidebarExpandedWorkspaceRow = forwardRef<
<div className="relative mr-2.5 flex size-5 shrink-0 items-center justify-center">
<DashboardSidebarWorkspaceIcon
hostType={hostType}
workspaceType={workspace.type}
hostIsOnline={hostIsOnline}
isActive={isActive}
variant="expanded"
Expand Down Expand Up @@ -278,31 +279,66 @@ export const DashboardSidebarExpandedWorkspaceRow = forwardRef<
{shortcutLabel}
</span>
)}
<Tooltip delayDuration={300}>
<TooltipTrigger asChild>
<button
type="button"
onClick={(event) => {
event.stopPropagation();
onDeleteClick();
}}
className="flex items-center justify-center text-muted-foreground hover:text-foreground"
aria-label={closeLabel}
>
<HiMiniXMark className="size-3.5" />
</button>
</TooltipTrigger>
<TooltipContent side="top" sideOffset={4}>
<HotkeyLabel
label={closeLabel}
id={
isActive && !isMainWorkspace
? "CLOSE_WORKSPACE"
: undefined
}
/>
</TooltipContent>
</Tooltip>
{isMainWorkspace ? (
<Tooltip delayDuration={300}>
<TooltipTrigger asChild>
<button
type="button"
onClick={(event) => {
event.stopPropagation();
onRemoveFromSidebarClick();
}}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
onKeyDown={(event) => {
if (
event.key === "Enter" ||
event.key === " " ||
event.key === "Spacebar"
) {
event.stopPropagation();
}
}}
className="flex items-center justify-center text-muted-foreground hover:text-foreground"
aria-label="Remove from sidebar"
>
<HiMiniMinus className="size-3.5" />
</button>
</TooltipTrigger>
<TooltipContent side="top" sideOffset={4}>
<HotkeyLabel label="Remove from sidebar" />
</TooltipContent>
</Tooltip>
) : (
<Tooltip delayDuration={300}>
<TooltipTrigger asChild>
<button
type="button"
onClick={(event) => {
event.stopPropagation();
onCloseWorkspaceClick();
}}
onKeyDown={(event) => {
if (
event.key === "Enter" ||
event.key === " " ||
event.key === "Spacebar"
) {
event.stopPropagation();
}
}}
className="flex items-center justify-center text-muted-foreground hover:text-foreground"
aria-label="Close workspace"
>
<HiMiniXMark className="size-3.5" />
</button>
</TooltipTrigger>
<TooltipContent side="top" sideOffset={4}>
<HotkeyLabel
label="Close workspace"
id={isActive ? "CLOSE_WORKSPACE" : undefined}
/>
</TooltipContent>
</Tooltip>
)}
</div>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { cn } from "@superset/ui/utils";
import { CgLaptop } from "react-icons/cg";
import { HiExclamationTriangle } from "react-icons/hi2";
import {
LuGitMerge,
Expand All @@ -14,10 +15,12 @@ import type { ActivePaneStatus } from "shared/tabs-types";
import type {
DashboardSidebarWorkspaceHostType,
DashboardSidebarWorkspacePullRequest,
DashboardSidebarWorkspaceType,
} from "../../../../types";

interface DashboardSidebarWorkspaceIconProps {
hostType: DashboardSidebarWorkspaceHostType;
workspaceType: DashboardSidebarWorkspaceType;
hostIsOnline: boolean | null;
isActive: boolean;
variant: "collapsed" | "expanded";
Expand Down Expand Up @@ -47,6 +50,7 @@ const PR_COLOR_BY_STATE = {

export function DashboardSidebarWorkspaceIcon({
hostType,
workspaceType,
hostIsOnline,
isActive,
variant,
Expand All @@ -71,6 +75,12 @@ export function DashboardSidebarWorkspaceIcon({
}

if (hostType === "local-device") {
if (workspaceType === "main") {
return (
<CgLaptop className={cn("size-4 transition-colors", iconColor)} />
);
}

return <RxDot className={cn("size-4 transition-colors", iconColor)} />;
}

Expand Down
Loading