feat(HAI-025): add column-based agent-active glow for in-progress cards

- Add agent-active glow styling to TaskCard based on column status
- Update store to support column-based agent-active state tracking
- Refactor merger logic for improved agent-active handling
- Add comprehensive column-based agent-active test cases for TaskCard
This commit is contained in:
Dustin Byrne
2026-03-25 22:04:07 -04:00
2 changed files with 35 additions and 6 deletions

View File

@@ -51,7 +51,7 @@ export function TaskCard({ task, queued, onOpenDetail, addToast }: TaskCardProps
}
}, [task.id, onOpenDetail, addToast]);
const isAgentActive = !queued && ACTIVE_STATUSES.has(task.status as string);
const isAgentActive = !queued && (task.column === "in-progress" || ACTIVE_STATUSES.has(task.status as string));
const cardClass = `card${dragging ? " dragging" : ""}${queued ? " queued" : ""}${isAgentActive ? " agent-active" : ""}`;
return (

View File

@@ -1,4 +1,5 @@
import { describe, it, expect } from "vitest";
import type { Column } from "@hai/core";
/**
* Tests for the agent-active class logic in TaskCard.
@@ -10,9 +11,9 @@ import { describe, it, expect } from "vitest";
const ACTIVE_STATUSES = new Set(["planning", "researching", "executing", "finalizing", "merging", "specifying"]);
/** Mirrors the cardClass computation from TaskCard.tsx */
function computeCardClass(opts: { dragging?: boolean; queued?: boolean; status?: string }): string {
const { dragging = false, queued = false, status } = opts;
const isAgentActive = !queued && ACTIVE_STATUSES.has(status as string);
function computeCardClass(opts: { dragging?: boolean; queued?: boolean; status?: string; column?: Column }): string {
const { dragging = false, queued = false, status, column = "todo" } = opts;
const isAgentActive = !queued && (column === "in-progress" || ACTIVE_STATUSES.has(status as string));
return `card${dragging ? " dragging" : ""}${queued ? " queued" : ""}${isAgentActive ? " agent-active" : ""}`;
}
@@ -29,12 +30,12 @@ describe("TaskCard agent-active class", () => {
}
});
it("does NOT apply agent-active when status is undefined", () => {
it("does NOT apply agent-active when status is undefined and column is not in-progress", () => {
const cls = computeCardClass({});
expect(cls).not.toContain("agent-active");
});
it("does NOT apply agent-active for non-active status (idle)", () => {
it("does NOT apply agent-active for non-active status (idle) outside in-progress", () => {
const cls = computeCardClass({ status: "idle" });
expect(cls).not.toContain("agent-active");
});
@@ -60,4 +61,32 @@ describe("TaskCard agent-active class", () => {
expect(computeCardClass({})).toBe("card");
expect(computeCardClass({ status: "executing" })).toMatch(/^card /);
});
// Column-based agent-active tests
it("applies agent-active for in-progress column with no status", () => {
const cls = computeCardClass({ column: "in-progress" });
expect(cls).toContain("agent-active");
});
it("applies agent-active for in-progress column with an active status", () => {
const cls = computeCardClass({ column: "in-progress", status: "executing" });
expect(cls).toContain("agent-active");
});
it("does NOT apply agent-active for todo column with no status", () => {
const cls = computeCardClass({ column: "todo" });
expect(cls).not.toContain("agent-active");
});
it("applies agent-active for in-review column with active status (merging)", () => {
const cls = computeCardClass({ column: "in-review", status: "merging" });
expect(cls).toContain("agent-active");
});
it("does NOT apply agent-active for queued card in in-progress column", () => {
const cls = computeCardClass({ column: "in-progress", queued: true });
expect(cls).not.toContain("agent-active");
expect(cls).toContain("queued");
});
});