diff options
| author | Adam Malczewski <[email protected]> | 2026-10-15 15:01:24 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-10-15 15:01:24 +0900 |
| commit | ab51a8144c3faf1d545e33195f2190492219e861 (patch) | |
| tree | b12ddbf7465db1281022b1b19d34fbc59083a9c7 /src/features/tabs/tab-groups.ts | |
| parent | c23aa41d1ffa71ac905da8ac9488b07322327695 (diff) | |
| download | dispatch-web-ab51a8144c3faf1d545e33195f2190492219e861.tar.gz dispatch-web-ab51a8144c3faf1d545e33195f2190492219e861.zip | |
fix(tabs): 20% black compounding group boxes; trim bottom padding under a last-row nested box so spacing stays even
Diffstat (limited to 'src/features/tabs/tab-groups.ts')
| -rw-r--r-- | src/features/tabs/tab-groups.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/features/tabs/tab-groups.ts b/src/features/tabs/tab-groups.ts index ef16451..12870ee 100644 --- a/src/features/tabs/tab-groups.ts +++ b/src/features/tabs/tab-groups.ts @@ -129,6 +129,30 @@ export function directGroupChildren(tabs: readonly Tab[], conversationId: string } /** + * Whether a group box's LAST grid row is a nested group box (rather than a + * card). Mirrors the grid's `row dense` auto-placement: the group parent's + * double-width card fills row 0; a card takes the first free half-row (or + * opens a new row); a nested group (spans both columns) always opens a new + * row. Used to trim the outer box's bottom padding so the gap below a + * nested box matches the gap at its sides (an even-looking box). + */ +export function lastRowIsGroup(children: readonly TabGroupNode[]): boolean { + let openHalfRows = 0; // rows with exactly one free cell + let lastIsGroup = false; // the row-0 parent card is not a group row + for (const child of children) { + if (child.children.length > 0) { + lastIsGroup = true; // opens a new (last) row + } else if (openHalfRows > 0) { + openHalfRows -= 1; // back-fills an earlier half row; last row unchanged + } else { + openHalfRows += 1; // opens a new (last) row, half-filled + lastIsGroup = false; + } + } + return lastIsGroup; +} + +/** * Horizontal bleed (px) of a group box at nesting `level` (1 = outermost) * when the deepest box is `maxDepth`. A box bleeds OUTWARD by this much (a * negative margin + equal padding), so the cards inside every box sit on |
