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 @@ -224,8 +224,7 @@ export function WorkspaceListItem({
const showDiffStats = !!diffStats;

// Determine if we should show the branch subtitle
const showBranchSubtitle =
!isBranchWorkspace && name && name !== branch && !rename.isRenaming;
const showBranchSubtitle = !isBranchWorkspace;

// Collapsed sidebar: show just the icon with hover card (worktree) or tooltip (branch)
if (isCollapsed) {
Expand Down Expand Up @@ -498,6 +497,7 @@ export function WorkspaceListItem({
<WorkspaceStatusBadge
state={pr.state}
prNumber={pr.number}
prUrl={pr.url}
className="ml-auto"
/>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import { cn } from "@superset/ui/utils";
import { LuCircleDot, LuGitMerge, LuGitPullRequest } from "react-icons/lu";
import { electronTrpc } from "renderer/lib/electron-trpc";
import { STROKE_WIDTH } from "../constants";

type PRState = "open" | "merged" | "closed" | "draft";

interface WorkspaceStatusBadgeProps {
state: PRState;
prNumber?: number;
prUrl?: string;
className?: string;
}

export function WorkspaceStatusBadge({
state,
prNumber,
prUrl,
className,
}: WorkspaceStatusBadgeProps) {
const openUrl = electronTrpc.external.openUrl.useMutation();
const iconClass = "w-3 h-3";

const config = {
Expand All @@ -26,6 +30,7 @@ export function WorkspaceStatusBadge({
/>
),
bgColor: "bg-emerald-500/10",
hoverBgColor: "hover:bg-emerald-500/30",
},
merged: {
icon: (
Expand All @@ -35,6 +40,7 @@ export function WorkspaceStatusBadge({
/>
),
bgColor: "bg-purple-500/10",
hoverBgColor: "hover:bg-purple-500/30",
},
closed: {
icon: (
Expand All @@ -44,6 +50,7 @@ export function WorkspaceStatusBadge({
/>
),
bgColor: "bg-destructive/10",
hoverBgColor: "hover:bg-destructive/30",
},
draft: {
icon: (
Expand All @@ -53,25 +60,40 @@ export function WorkspaceStatusBadge({
/>
),
bgColor: "bg-muted",
hoverBgColor: "hover:bg-muted/70",
},
};

const { icon, bgColor } = config[state];
const { icon, bgColor, hoverBgColor } = config[state];

const handleClick = (e: React.MouseEvent) => {
if (prUrl) {
e.stopPropagation();
openUrl.mutate(prUrl);
}
};

const isClickable = !!prUrl;

return (
<div
<button
type="button"
onClick={handleClick}
disabled={!isClickable}
className={cn(
"flex items-center gap-1 px-1.5 py-0.5 rounded-md text-[10px]",
"flex items-center justify-center gap-1 px-1.5 py-0.5 rounded-md text-[10px] leading-none shrink-0 transition-colors",
bgColor,
isClickable && [hoverBgColor, "cursor-pointer"],
!isClickable && "cursor-default",
className,
)}
>
{icon}
{prNumber && (
<span className="text-muted-foreground font-mono tabular-nums">
<span className="text-muted-foreground font-mono tabular-nums leading-none">
#{prNumber}
</span>
)}
</div>
</button>
);
}
Loading