Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(ui): run the border beam on the compositor (MUL-7466) (#8681)

Bohan Jiang430a6a2a22b1
diff --git a/packages/ui/components/common/border-beam.tsx b/packages/ui/components/common/border-beam.tsx
new file mode 100644
index 0000000000..70f7757372
--- /dev/null
+++ b/packages/ui/components/common/border-beam.tsx
@@ -0,0 +1,12 @@
+/**
+ * Decorative highlight that sweeps around the host's rounded border. Render it
+ * as a child of a positioned (`relative`), rounded host; the ring inherits the
+ * host's border radius.
+ */
+export function BorderBeam() {
+ return (
+ <span className="border-beam-ring" aria-hidden="true">
+ <span className="border-beam-light" />
+ </span>
+ );
+}
diff --git a/packages/ui/styles/base.css b/packages/ui/styles/base.css
index 97acf4bea2..944c97283b 100644
--- a/packages/ui/styles/base.css
+++ b/packages/ui/styles/base.css
@@ -200,36 +200,44 @@
}
/* Border beam: a brand-tinted highlight sweeps continuously around the
- * element's rounded border, drawing the eye to a CTA that would otherwise
- * blend into the chrome (e.g. the "switch to agent" affordance in manual
- * create). Built with a conic-gradient on a ::before whose mask carves out a
- * 1px ring; an animated @property angle drives the rotation so only the
- * gradient repaints, not layout. The ring respects `border-radius: inherit`,
- * so any rounded host picks up the right curvature for free. Pair with a
- * subtle background tint on the host so the highlight has something to ride
- * on at low contrast. */
-@property --border-beam-angle {
- syntax: "<angle>";
- initial-value: 0deg;
- inherits: false;
-}
-
+ * host's rounded border, drawing the eye to a CTA that would otherwise blend
+ * into the chrome (e.g. the "switch to agent" affordance in manual create).
+ * Rendered by <BorderBeam /> inside a positioned host. The ring is a static
+ * mask that carves a 1px band out of the host's border box and inherits its
+ * radius; inside it, a square conic gradient rotates via transform. Rotating
+ * the gradient about the host's center looks the same as sweeping its start
+ * angle, but the compositor can run it without repainting the ring every
+ * frame. Pair with a subtle background tint on the host so the highlight has
+ * something to ride on at low contrast. */
@keyframes border-beam-rotate {
- to { --border-beam-angle: 360deg; }
+ from { transform: translate(-50%, -50%) rotate(0turn); }
+ to { transform: translate(-50%, -50%) rotate(1turn); }
}
-.border-beam {
- position: relative;
-}
-
-.border-beam::before {
- content: "";
+.border-beam-ring {
position: absolute;
inset: 0;
border-radius: inherit;
padding: 1px;
+ overflow: hidden;
+ pointer-events: none;
+ container-type: size;
+ -webkit-mask:
+ linear-gradient(#000 0 0) content-box,
+ linear-gradient(#000 0 0);
+ -webkit-mask-composite: xor;
+ mask-composite: exclude;
+}
+
+.border-beam-light {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ /* Width + height is at least the diagonal, so the square covers the ring at
+ * every angle. */
+ width: calc(100cqw + 100cqh);
+ aspect-ratio: 1;
background: conic-gradient(
- from var(--border-beam-angle),
transparent 0deg,
transparent 220deg,
#ffbe7b 245deg,
@@ -239,18 +247,11 @@
#5b9dff 345deg,
transparent 360deg
);
- -webkit-mask:
- linear-gradient(#000 0 0) content-box,
- linear-gradient(#000 0 0);
- -webkit-mask-composite: xor;
- mask-composite: exclude;
animation: border-beam-rotate 3.2s linear infinite;
- pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
- .border-beam::before {
- animation: none;
+ .border-beam-ring {
background: linear-gradient(
90deg,
#ffbe7b,
@@ -260,6 +261,10 @@
#5b9dff
);
}
+
+ .border-beam-light {
+ display: none;
+ }
}
/* Sidebar: open triggers (dropdown/popover) get active background */
diff --git a/packages/views/issues/components/issue-agent-header-chip.test.tsx b/packages/views/issues/components/issue-agent-header-chip.test.tsx
index 97cb57f7ca..2716d3d0bd 100644
--- a/packages/views/issues/components/issue-agent-header-chip.test.tsx
+++ b/packages/views/issues/components/issue-agent-header-chip.test.tsx
@@ -215,6 +215,24 @@ describe("IssueAgentHeaderChip", () => {
expect(mockState.taskMessagesOptions).not.toHaveBeenCalled();
});
+ it("wears the decorative border beam only while an agent is running", () => {
+ mockState.tasks = [makeTask({})];
+ const { unmount } = renderWithI18n(<IssueAgentHeaderChip issueId="issue-1" />);
+
+ const running = screen.getByRole("button", { name: "Walt is working" });
+ const ring = running.querySelector(".border-beam-ring");
+ expect(running).toHaveClass("relative");
+ expect(ring).toHaveAttribute("aria-hidden", "true");
+ expect(ring?.querySelector(".border-beam-light")).not.toBeNull();
+ unmount();
+
+ mockState.tasks = [makeTask({ status: "queued" })];
+ renderWithI18n(<IssueAgentHeaderChip issueId="issue-1" />);
+
+ const queued = screen.getByRole("button", { name: "Walt is queued" });
+ expect(queued.querySelector(".border-beam-ring")).toBeNull();
+ });
+
it("keeps the header popover card with active task rows", () => {
mockState.tasks = [makeTask({ id: "task-running" })];
diff --git a/packages/views/issues/components/issue-agent-header-chip.tsx b/packages/views/issues/components/issue-agent-header-chip.tsx
index 6108e21cab..f2398238c2 100644
--- a/packages/views/issues/components/issue-agent-header-chip.tsx
+++ b/packages/views/issues/components/issue-agent-header-chip.tsx
@@ -9,6 +9,7 @@ import {
} from "@multica/ui/components/ui/popover";
import { useActorName } from "@multica/core/workspace/hooks";
import { cn } from "@multica/ui/lib/utils";
+import { BorderBeam } from "@multica/ui/components/common/border-beam";
import { api } from "@multica/core/api";
import { issueKeys } from "@multica/core/issues/queries";
import type { AgentTask } from "@multica/core/types";
@@ -189,7 +190,7 @@ function ActiveChip({
// motion for work that is genuinely in flight.
className={cn(
"flex h-9 min-w-9 max-w-[11rem] items-center justify-center gap-1.5 rounded-md px-2 text-muted-foreground outline-none transition-colors hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring md:h-7 md:min-w-0 md:justify-start md:px-1.5",
- anyRunning && "border-beam bg-brand/5",
+ anyRunning && "relative bg-brand/5",
)}
/>
}
@@ -208,6 +209,7 @@ function ActiveChip({
>
{label}
</span>
+ {anyRunning && <BorderBeam />}
</PopoverTrigger>
<PopoverContent align="end" keepMounted className="w-80">
<div className="text-caption font-medium text-muted-foreground">
diff --git a/packages/views/modals/create-issue.tsx b/packages/views/modals/create-issue.tsx
index b1c3ed6f92..eafcb2d167 100644
--- a/packages/views/modals/create-issue.tsx
+++ b/packages/views/modals/create-issue.tsx
@@ -88,6 +88,7 @@ import {
parseWithFallback,
} from "@multica/core/api";
import { FileUploadButton } from "@multica/ui/components/common/file-upload-button";
+import { BorderBeam } from "@multica/ui/components/common/border-beam";
import { ClearablePillButton, PillButton } from "../common/pill-button";
import { ActorAvatar } from "../common/actor-avatar";
import { PropertyIcon } from "../common/property-icon";
@@ -1384,10 +1385,11 @@ export function ManualCreatePanel({
aria-disabled={gate.uploading || undefined}
aria-busy={gate.uploading || undefined}
title={t(($) => $.create_issue.switch_to_agent_tooltip)}
- className="border-beam group flex shrink-0 items-center gap-1.5 justify-self-end text-caption px-2 py-1 rounded-sm text-muted-foreground bg-brand/5 hover:bg-brand/10 hover:text-foreground transition-colors cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"
+ className="relative group flex shrink-0 items-center gap-1.5 justify-self-end text-caption px-2 py-1 rounded-sm text-muted-foreground bg-brand/5 hover:bg-brand/10 hover:text-foreground transition-colors cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"
>
<ArrowLeftRight className="size-3.5 text-brand transition-transform duration-300 group-hover:rotate-180" />
{t(($) => $.create_issue.switch_to_agent)}
+ <BorderBeam />
</button>
<label className="flex shrink-0 items-center gap-1.5 text-caption text-muted-foreground cursor-pointer select-none">
<Switch