Address artifact grouping review feedback

This commit is contained in:
Dotta committed 2026-06-06 14:46:12 +00:00
1 parent 696edf255d
commit d2c555137c
3 files changed
+13 -4

No files matched your search

@@ -14,7 +14,7 @@ vi.mock("@/context/CompanyContext", () => ({
function sampleArtifact(overrides: Partial<CompanyArtifact> = {}): CompanyArtifact {
return {
id: "artifact-1",
source: "image",
source: "attachment",
mediaKind: "image",
title: "Hero shot",
previewText: null,
+4
View File
@@ -360,6 +360,7 @@ describe("Artifacts page", () => {
expect(card).not.toBeNull();
expect(card.getAttribute("data-count")).toBe("4");
expect(card.getAttribute("data-stacked")).toBe("true");
expect(card.getAttribute("href")).toBe("/artifacts?groupIssueId=issue-1");
expect(card.textContent).toContain("4 artifacts");
});
@@ -389,6 +390,9 @@ describe("Artifacts page", () => {
cursor: undefined,
});
expect(container.querySelector('[data-testid="artifact-stack-back"]')).not.toBeNull();
expect(
(container.querySelector('[data-testid="artifact-stack-back"]') as HTMLAnchorElement).getAttribute("href"),
).toBe("/artifacts");
expect(container.textContent).toContain("Stacked Artifact");
expect(container.querySelector('[data-testid="artifact-card"]')).not.toBeNull();
});
+8 -3
View File
@@ -152,15 +152,20 @@ export function Artifacts() {
const stackTo = useCallback(
(issueId: string): To =>
buildTo((next) => {
if (groupBy !== "none") next.set("groupBy", groupBy);
if (groupBy === "task") next.delete("groupBy");
else if (groupBy !== "none") next.set("groupBy", groupBy);
next.set("groupIssueId", issueId);
}),
[buildTo, groupBy],
);
const backToStacksTo = useMemo<To>(
() => buildTo((next) => next.delete("groupIssueId")),
[buildTo],
() =>
buildTo((next) => {
if (groupBy === "task") next.delete("groupBy");
next.delete("groupIssueId");
}),
[buildTo, groupBy],
);
const {