Skip to content

Commit 80fb448

Browse files
committed
Add collapsible review card footer
1 parent 8cb4c1d commit 80fb448

2 files changed

Lines changed: 33 additions & 18 deletions

File tree

src/ui/workspace-app.css

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,28 +249,36 @@ body {
249249
}
250250

251251
.review-actions {
252-
justify-content: flex-end;
253-
padding: 10px 14px;
252+
padding: 0;
254253
border-top: 1px solid color-mix(in srgb, var(--color-border-primary, #3a3a40) 72%, transparent);
254+
background: color-mix(in srgb, var(--color-background-secondary, #28282d) 94%, transparent);
255255
}
256256

257257
.review-action {
258-
min-height: 26px;
259-
padding: 0 9px;
260-
border: 1px solid color-mix(in srgb, var(--color-border-primary, #3a3a40) 80%, transparent);
261-
border-radius: 7px;
262-
background: color-mix(in srgb, var(--color-background-primary, #17181c) 36%, transparent);
263-
color: var(--color-text-secondary, #d6d6dc);
258+
display: flex;
259+
align-items: center;
260+
justify-content: space-between;
261+
width: 100%;
262+
min-height: 40px;
263+
padding: 0 14px 0 16px;
264+
border: 0;
265+
background: transparent;
266+
color: var(--color-text-primary, #f5f5f6);
264267
cursor: pointer;
265268
font: inherit;
266-
font-size: var(--font-text-sm-size, 12px);
269+
font-size: var(--font-text-sm-size, 13px);
270+
text-align: left;
267271
}
268272

269273
.review-action:hover {
270-
background: color-mix(in srgb, var(--color-background-tertiary, #333338) 80%, transparent);
274+
background: color-mix(in srgb, var(--color-background-tertiary, #333338) 72%, transparent);
271275
color: var(--color-text-primary, #f5f5f6);
272276
}
273277

278+
.review-action .chevron {
279+
flex: none;
280+
}
281+
274282
.review-diff {
275283
display: grid;
276284
gap: 8px;

src/ui/workspace-app.tsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,7 @@ function renderReviewCard(card: ToolResultCard, display: ToolDisplay): void {
390390
unmountPayload();
391391

392392
const files = card.files ?? [];
393-
const summary = card.summary ?? {};
394-
const visibleFiles = reviewFilesExpanded ? files : files.slice(0, 3);
395-
const hiddenCount = Math.max(0, files.length - visibleFiles.length);
393+
const hiddenCount = Math.max(0, files.length - 3);
396394
const main = element("main", { className: "shell" });
397395
const section = element("section", { className: "tool-card review" });
398396
const header = element("div", { className: "review-header" });
@@ -411,16 +409,25 @@ function renderReviewCard(card: ToolResultCard, display: ToolDisplay): void {
411409

412410
const actions = element("div", { className: "review-actions" });
413411
if (hiddenCount > 0) {
414-
const showMore = element("button", {
412+
const toggleFiles = element("button", {
415413
className: "review-action",
416414
type: "button",
417-
text: `Show ${hiddenCount} more ${hiddenCount === 1 ? "file" : "files"}`,
415+
ariaExpanded: String(reviewFilesExpanded),
418416
});
419-
showMore.addEventListener("click", () => {
420-
reviewFilesExpanded = true;
417+
418+
toggleFiles.append(
419+
element("span", {
420+
text: reviewFilesExpanded
421+
? "Collapse files"
422+
: `Show ${hiddenCount} more ${hiddenCount === 1 ? "file" : "files"}`,
423+
}),
424+
renderChevron(reviewFilesExpanded, true),
425+
);
426+
toggleFiles.addEventListener("click", () => {
427+
reviewFilesExpanded = !reviewFilesExpanded;
421428
render();
422429
});
423-
actions.append(showMore);
430+
actions.append(toggleFiles);
424431
}
425432

426433
section.append(header, body);

0 commit comments

Comments
 (0)