FN-6340: restrict archive action to done tasks

Limits task card archiving UI to completed tasks while preserving coverage for hidden states.

- Render the archive button only when a task is in the done column.
- Update TaskCard tests to assert archive action visibility for done tasks and absence for other live columns.
- Keep the header action placement assertion focused on done task cards.

Files changed:
 packages/dashboard/app/components/TaskCard.tsx     |  2 +-
 .../app/components/__tests__/TaskCard.test.tsx     | 23 +++++++++++++++++-----
 2 files changed, 19 insertions(+), 6 deletions(-)

Fusion-Task-Id: FN-6340

Fusion-Task-Lineage: e1373fd1-5e50-4784-bf04-fa13ef0a08cb
This commit is contained in:
gsxdsm
2026-06-13 00:29:21 -07:00
parent 9c9abc3bd7
commit 7582bddba3
2 changed files with 19 additions and 6 deletions

View File

@@ -2043,7 +2043,7 @@ function TaskCardComponent({
<Trash2 size={12} />
</button>
)}
{task.column !== "archived" && onArchiveTask && (
{task.column === "done" && onArchiveTask && (
<button
className="card-archive-btn"
onClick={handleArchiveClick}

View File

@@ -462,8 +462,8 @@ describe("TaskCard", () => {
expect(screen.getByLabelText("Archive task")).toBeDefined();
});
it.each(["triage", "todo", "in-progress", "in-review", "done"] as const)(
"renders archive action for %s tasks",
it.each(["triage", "todo", "in-progress", "in-review"] as const)(
"hides archive action for %s tasks",
(column) => {
render(
<TaskCard
@@ -474,10 +474,23 @@ describe("TaskCard", () => {
/>,
);
expect(screen.getByLabelText("Archive task")).toBeDefined();
expect(screen.queryByLabelText("Archive task")).toBeNull();
},
);
it("renders archive action for done tasks", () => {
render(
<TaskCard
task={makeTask({ column: "done" })}
onOpenDetail={noop}
addToast={noop}
onArchiveTask={vi.fn(async () => makeTask({ column: "archived" }))}
/>,
);
expect(screen.getByLabelText("Archive task")).toBeDefined();
});
it("does not render archive action for archived tasks", () => {
render(
<TaskCard
@@ -1994,10 +2007,10 @@ describe("TaskCard", () => {
expect(actionsContainer?.contains(editBtn)).toBe(true);
});
it("renders archive button inside card-header-actions for live columns", () => {
it("renders archive button inside card-header-actions for done columns", () => {
const { container } = render(
<TaskCard
task={makeTask({ column: "todo", size: "L" })}
task={makeTask({ column: "done", size: "L" })}
onOpenDetail={noop}
addToast={noop}
onArchiveTask={async () => makeTask()}