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 @@ -59,7 +59,7 @@ export function V2WorkspacesBoard({

return (
<div className="flex-1 overflow-x-auto overflow-y-hidden">
<div className="flex h-full min-w-max gap-2 px-6 py-4">
<div className="flex h-full min-w-max gap-3 px-6 py-4">
{visibleColumns.map((column) => (
<V2WorkspacesBoardColumn
key={column}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { plural } from "@lingui/core/macro";
import { Trans, useLingui } from "@lingui/react/macro";
import { Badge } from "@superset/ui/badge";
import { Tooltip, TooltipContent, TooltipTrigger } from "@superset/ui/tooltip";
import { cn } from "@superset/ui/utils";
import { LuGitBranch, LuLaptop, LuMonitor } from "react-icons/lu";
import { CgLaptop } from "react-icons/cg";
import { LuGitBranch, LuMonitor } from "react-icons/lu";
import { V2WorkspaceContextMenu } from "renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspaceContextMenu";
import { WorkspaceChecksDot } from "renderer/routes/_authenticated/_dashboard/v2-workspaces/components/WorkspaceChecksDot";
import { WorkspaceStateGlyph } from "renderer/routes/_authenticated/_dashboard/v2-workspaces/components/WorkspaceStateGlyph";
import type { AccessibleV2Workspace } from "renderer/routes/_authenticated/_dashboard/v2-workspaces/hooks/useAccessibleV2Workspaces";
import { workspaceActivityAt } from "renderer/routes/_authenticated/_dashboard/v2-workspaces/utils/sortWorkspaces";
import { PRIcon } from "renderer/screens/main/components/PRIcon/PRIcon";
import { getRelativeTime } from "renderer/screens/main/components/WorkspacesListView/utils";
import { V2WorkspaceProjectIcon } from "../../../V2WorkspaceProjectIcon";
Expand All @@ -30,6 +34,15 @@ export function V2WorkspacesBoardCard({
);
}

/** 181909 → "181.9k" — keeps outlier churn from blowing out the pill. */
function formatCount(count: number): string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The board adds a second formatCount implementation identical to the list row’s helper. Extract this formatter into a shared utility and import it in both surfaces so churn formatting cannot drift.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesBoard/components/V2WorkspacesBoardCard/V2WorkspacesBoardCard.tsx, line 38:

<comment>The board adds a second `formatCount` implementation identical to the list row’s helper. Extract this formatter into a shared utility and import it in both surfaces so churn formatting cannot drift.</comment>

<file context>
@@ -30,6 +34,15 @@ export function V2WorkspacesBoardCard({
 }
 
+/** 181909 → "181.9k" — keeps outlier churn from blowing out the pill. */
+function formatCount(count: number): string {
+	if (count < 10_000) return String(count);
+	return `${(count / 1000).toFixed(1).replace(/\.0$/, "")}k`;
</file context>

if (count < 10_000) return String(count);
return `${(count / 1000).toFixed(1).replace(/\.0$/, "")}k`;
}

const PILL_CLASS =
"inline-flex h-5 shrink-0 items-center gap-1 rounded-md border border-border/60 bg-background/40 px-1.5 text-[11px] tabular-nums leading-none text-muted-foreground";

function BoardCardBody({
workspace,
onOpen,
Expand All @@ -42,9 +55,18 @@ function BoardCardBody({
} & React.ComponentPropsWithRef<"button">) {
const { t } = useLingui();
const isArchived = workspace.archivedAt != null;
const HostIcon = workspace.hostType === "local-device" ? LuLaptop : LuMonitor;
const isDone = isArchived || workspace.pr?.state === "merged";
const isMainWorkspace = workspace.type === "main";
// Same rule as the list row: the branch line only earns its slot when it
// says something the title doesn't.
const showBranch =
workspace.type !== "session" &&
workspace.branch.toLowerCase() !== workspace.name.toLowerCase();
const hasDiff =
workspace.diffStats != null &&
(workspace.diffStats.additions > 0 || workspace.diffStats.deletions > 0);
const timeLabel = getRelativeTime(
workspace.archivedAt ?? workspace.createdAt.getTime(),
workspace.archivedAt ?? workspaceActivityAt(workspace),
{ format: "compact" },
);

Expand All @@ -55,48 +77,75 @@ function BoardCardBody({
onClick={onOpen}
disabled={isArchived}
className={cn(
"w-full rounded-md border border-border/60 bg-card px-3 py-2.5 text-left transition-colors",
"w-full rounded-lg border border-border/50 bg-card px-3.5 py-3 text-left shadow-xs transition-colors",
isArchived
? "cursor-default opacity-60"
: "cursor-pointer hover:bg-accent/30",
: "cursor-pointer hover:border-border hover:bg-accent/30",
)}
>
<div className="mb-1 flex items-center justify-between gap-2">
<span className="flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground">
<V2WorkspaceProjectIcon
projectName={
workspace.projectName ??
t({
message: "Session",
})
}
iconUrl={workspace.projectIconUrl}
size="sm"
/>
<span className="min-w-0 truncate">
{workspace.projectName ?? <Trans>Session</Trans>}
</span>
<div className="mb-1.5 flex items-center gap-1.5 text-[11px] text-muted-foreground">
<V2WorkspaceProjectIcon
projectName={
workspace.projectName ??
t({
message: "Session",
})
}
iconUrl={workspace.projectIconUrl}
size="sm"
className="size-4 rounded-sm text-[9px]"
/>
<span className="min-w-0 truncate">
{workspace.projectName ?? <Trans>Session</Trans>}
</span>
<span className="flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground">
<HostIcon className="size-3" />
{workspace.hostName}
{isMainWorkspace ? (
<Tooltip delayDuration={300}>
<TooltipTrigger asChild>
<span className="flex shrink-0 items-center">
<CgLaptop
className="size-3.5"
aria-label={t({
message: "Main workspace",
})}
/>
</span>
</TooltipTrigger>
<TooltipContent side="top">
<Trans>Main workspace</Trans>
</TooltipContent>
</Tooltip>
) : null}
{workspace.hostType !== "local-device" ? (
<span className="flex min-w-0 shrink items-center gap-1">
<LuMonitor className="size-3 shrink-0" />
<span className="truncate">{workspace.hostName}</span>
</span>
) : null}
<span className="ml-auto whitespace-nowrap tabular-nums">
{timeLabel}
</span>
</div>

<p className="mb-1.5 line-clamp-2 text-sm leading-snug">
<p
className={cn(
"line-clamp-2 min-w-0 text-[13px] font-medium leading-[18px]",
// Done states recede so live work owns the contrast.
isDone ? "text-muted-foreground" : "text-foreground",
)}
>
{workspace.name || workspace.branch}
</p>

<div className="flex items-center gap-1.5 text-xs text-muted-foreground">
<LuGitBranch className="size-3 shrink-0" />
<code className="min-w-0 flex-1 truncate font-mono text-[11px]">
{workspace.branch}
</code>
</div>
{showBranch ? (
<div className="mt-1 flex items-center gap-1 text-[11px] text-muted-foreground">
<LuGitBranch className="size-3 shrink-0" />
<code className="min-w-0 truncate font-mono">{workspace.branch}</code>
</div>
) : null}

<div className="mt-1.5 flex items-center gap-1.5">
<div className="mt-2 flex items-center gap-1.5">
{workspace.pr ? (
<span className="flex items-center gap-1 rounded-md bg-muted/60 px-1.5 py-0.5 text-[11px] tabular-nums text-muted-foreground">
<span className={PILL_CLASS}>
<PRIcon state={workspace.pr.state} className="size-3" />#
{workspace.pr.prNumber}
<WorkspaceChecksDot
Expand All @@ -105,20 +154,35 @@ function BoardCardBody({
/>
</span>
) : null}
{isArchived ? (
<Badge
variant="outline"
className="h-4 px-1.5 py-0 text-[10px] leading-none text-muted-foreground"
{hasDiff && workspace.diffStats ? (
<span
className={cn(PILL_CLASS, "font-mono")}
title={t({
message: plural(workspace.diffStats.fileCount, {
one: "# changed file",
other: "# changed files",
}),
})}
>
<span className="text-emerald-600/80 dark:text-emerald-400/70">
+{formatCount(workspace.diffStats.additions)}
</span>
<span className="text-red-600/80 dark:text-red-400/70">
−{formatCount(workspace.diffStats.deletions)}
</span>
</span>
) : null}
{isArchived ? (
<span className={PILL_CLASS}>
{workspace.archiveReason === "merged" ? (
<Trans>Merged</Trans>
) : (
<Trans>Deleted</Trans>
)}
</Badge>
</span>
) : null}
<span className="ml-auto text-[10px] tabular-nums text-muted-foreground">
{timeLabel}
<span className="ml-auto flex shrink-0 items-center">
<WorkspaceStateGlyph workspace={workspace} />
</span>
</div>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@ export function V2WorkspacesBoardColumn({
workspaces,
}: V2WorkspacesBoardColumnProps) {
return (
<div className="flex w-[280px] min-w-[280px] shrink-0 flex-col">
{/* Column header — matches Linear style */}
<div className="mb-1 flex items-center gap-2 px-2 py-1.5">
// Linear-style lane: a surface one step above the page so the cards
// read as items sitting in a column rather than floating on the canvas.
<div className="flex w-[280px] min-w-[280px] shrink-0 flex-col rounded-lg bg-muted/30">
<div className="flex items-center gap-2 px-3 pt-2.5 pb-2">
<BoardColumnIcon column={column} />
<span className="truncate text-sm font-medium">
<span className="truncate text-[13px] font-medium">
{i18n._(BOARD_COLUMN_LABELS[column])}
</span>
<span className="text-xs tabular-nums text-muted-foreground">
{workspaces.length}
</span>
</div>

<div className="flex min-h-[60px] flex-1 flex-col gap-1 overflow-y-auto rounded-md p-0.5">
<div className="flex min-h-[60px] flex-1 flex-col gap-2 overflow-y-auto px-2 pb-2">
{workspaces.map((workspace) => (
<V2WorkspacesBoardCard key={workspace.id} workspace={workspace} />
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { CgLaptop } from "react-icons/cg";
import { WorkspaceNameMarquee } from "renderer/components/WorkspaceNameMarquee";
import { useFocusVisible } from "renderer/hooks/useFocusVisible";
import { V2WorkspaceContextMenu } from "renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspaceContextMenu";
import { WorkspaceStateGlyph } from "renderer/routes/_authenticated/_dashboard/v2-workspaces/components/WorkspaceStateGlyph";
import type { AccessibleV2Workspace } from "renderer/routes/_authenticated/_dashboard/v2-workspaces/hooks/useAccessibleV2Workspaces";
import { workspaceActivityAt } from "renderer/routes/_authenticated/_dashboard/v2-workspaces/utils/sortWorkspaces";
import { PRIcon } from "renderer/screens/main/components/PRIcon/PRIcon";
import { getRelativeTime } from "renderer/screens/main/components/WorkspacesListView/utils";
import { WorkspaceStateGlyph } from "./components/WorkspaceStateGlyph";

interface V2WorkspaceRowProps {
workspace: AccessibleV2Workspace;
Expand Down
Loading