diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx index 058c6d27f02..f268426407f 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx @@ -10,12 +10,25 @@ import { import { 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"; import { RenameInput } from "renderer/screens/main/components/WorkspaceSidebar/RenameInput"; -import type { DashboardSidebarWorkspace } from "../../../../types"; +import type { + DashboardSidebarWorkspace, + DashboardSidebarWorkspacePullRequest, +} from "../../../../types"; import { getCreationStatusText } from "../../utils/getCreationStatusText"; import { DashboardSidebarWorkspaceDiffStats } from "../DashboardSidebarWorkspaceDiffStats"; import { DashboardSidebarWorkspaceIcon } from "../DashboardSidebarWorkspaceIcon"; -import { DashboardSidebarWorkspaceStatusBadge } from "../DashboardSidebarWorkspaceStatusBadge"; + +const PR_STATE_LABEL: Record< + DashboardSidebarWorkspacePullRequest["state"], + string +> = { + open: "Open", + merged: "Merged", + closed: "Closed", + draft: "Draft", +}; interface DashboardSidebarExpandedWorkspaceRowProps extends ComponentPropsWithoutRef<"div"> { @@ -67,6 +80,7 @@ export const DashboardSidebarExpandedWorkspaceRow = forwardRef< } = workspace; const showsStandaloneActiveStripe = accentColor == null; const localRef = useRef(null); + const openUrl = electronTrpc.external.openUrl.useMutation(); useEffect(() => { if (isActive) { @@ -120,36 +134,77 @@ export const DashboardSidebarExpandedWorkspaceRow = forwardRef< -
- -
+ {pullRequest ? ( + + ) : ( +
+ +
+ )}
-

- {hostType === "local-device" - ? "Local workspace" - : hostType === "remote-device" - ? hostIsOnline === false - ? "Remote workspace — device offline" - : "Remote workspace" - : "Cloud workspace"} -

-

- {hostType === "local-device" - ? "Running on this device" - : hostType === "remote-device" - ? hostIsOnline === false - ? "The associated device isn't reachable right now" - : "Running on a paired device" - : "Hosted in the cloud"} -

+ {pullRequest ? ( + <> +

+ PR #{pullRequest.number} — {PR_STATE_LABEL[pullRequest.state]} +

+

+ Click to open on GitHub +

+ + ) : ( + <> +

+ {hostType === "local-device" + ? "Local workspace" + : hostType === "remote-device" + ? hostIsOnline === false + ? "Remote workspace — device offline" + : "Remote workspace" + : "Cloud workspace"} +

+

+ {hostType === "local-device" + ? "Running on this device" + : hostType === "remote-device" + ? hostIsOnline === false + ? "The associated device isn't reachable right now" + : "Running on a paired device" + : "Hosted in the cloud"} +

+ + )}
@@ -233,15 +288,6 @@ export const DashboardSidebarExpandedWorkspaceRow = forwardRef< {branch} - - {pullRequest && ( - - )} diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceDiffStats/DashboardSidebarWorkspaceDiffStats.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceDiffStats/DashboardSidebarWorkspaceDiffStats.tsx index 06d431aa2c9..6d259313f4e 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceDiffStats/DashboardSidebarWorkspaceDiffStats.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceDiffStats/DashboardSidebarWorkspaceDiffStats.tsx @@ -1,5 +1,3 @@ -import { cn } from "@superset/ui/utils"; - interface DashboardSidebarWorkspaceDiffStatsProps { additions: number; deletions: number; @@ -12,15 +10,18 @@ export function DashboardSidebarWorkspaceDiffStats({ isActive, }: DashboardSidebarWorkspaceDiffStatsProps) { return ( -
+
- +{additions} - −{deletions} + + +{additions} + + + −{deletions} +
); diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceIcon/DashboardSidebarWorkspaceIcon.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceIcon/DashboardSidebarWorkspaceIcon.tsx index fb9df6f6d4f..91f64d61b4e 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceIcon/DashboardSidebarWorkspaceIcon.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceIcon/DashboardSidebarWorkspaceIcon.tsx @@ -1,10 +1,20 @@ import { cn } from "@superset/ui/utils"; import { HiExclamationTriangle } from "react-icons/hi2"; -import { LuCloud, LuCloudOff } from "react-icons/lu"; +import { + LuCloud, + LuCloudOff, + LuGitMerge, + LuGitPullRequest, + LuGitPullRequestClosed, + LuGitPullRequestDraft, +} from "react-icons/lu"; import { AsciiSpinner } from "renderer/screens/main/components/AsciiSpinner"; import { StatusIndicator } from "renderer/screens/main/components/StatusIndicator"; import type { ActivePaneStatus } from "shared/tabs-types"; -import type { DashboardSidebarWorkspaceHostType } from "../../../../types"; +import type { + DashboardSidebarWorkspaceHostType, + DashboardSidebarWorkspacePullRequest, +} from "../../../../types"; interface DashboardSidebarWorkspaceIconProps { hostType: DashboardSidebarWorkspaceHostType; @@ -13,6 +23,7 @@ interface DashboardSidebarWorkspaceIconProps { variant: "collapsed" | "expanded"; workspaceStatus?: ActivePaneStatus | null; creationStatus?: "preparing" | "generating-branch" | "creating" | "failed"; + pullRequestState?: DashboardSidebarWorkspacePullRequest["state"] | null; } const OVERLAY_POSITION = { @@ -20,6 +31,20 @@ const OVERLAY_POSITION = { expanded: "-top-0.5 -right-0.5", } as const; +const PR_ICON_BY_STATE = { + open: LuGitPullRequest, + merged: LuGitMerge, + closed: LuGitPullRequestClosed, + draft: LuGitPullRequestDraft, +} as const; + +const PR_COLOR_BY_STATE = { + open: "text-emerald-500", + merged: "text-purple-500", + closed: "text-destructive", + draft: "text-muted-foreground", +} as const; + export function DashboardSidebarWorkspaceIcon({ hostType, hostIsOnline, @@ -27,13 +52,24 @@ export function DashboardSidebarWorkspaceIcon({ variant, workspaceStatus = null, creationStatus, + pullRequestState = null, }: DashboardSidebarWorkspaceIconProps) { const overlayPosition = OVERLAY_POSITION[variant]; const iconColor = isActive ? "text-foreground" : "text-muted-foreground"; const isRemoteDeviceOffline = hostType === "remote-device" && hostIsOnline === false; - const renderHostIcon = () => { + const renderPrimaryIcon = () => { + if (pullRequestState) { + const PrIcon = PR_ICON_BY_STATE[pullRequestState]; + return ( + + ); + } + if (hostType === "local-device") { return ( ) : ( - renderHostIcon() + renderPrimaryIcon() )} {workspaceStatus && workspaceStatus !== "working" && (