Skip to content

Commit 1dc8bb1

Browse files
authored
fix(ui): scroll clearance under the sticky nav, balanced source tiles (#270)
- html gets scroll-padding-top: 5rem (64px sticky DaoHeader + breathing room), so anchor jumps and scrollIntoView land clear of the nav site-wide instead of leaving headings clipped behind its blur. - The source tiles' column count now derives from the source count so rows stay balanced: 5 sources render 3+2 instead of 4+1 with an orphan; 6 (a future Seaport source) becomes 3+3. The formula and its composition table are documented in place, including why auto-fit was rejected — it trades a reproducible orphan for an intermittent one.
1 parent 32805c1 commit 1dc8bb1

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

src/app/globals.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@
118118
* {
119119
@apply border-border outline-ring/50;
120120
}
121+
html {
122+
/* The site header is sticky (DaoHeader: h-16 = 64px, translucent) and
123+
content scrolls UNDER it. Any anchor jump or scrollIntoView therefore
124+
lands with its heading behind the nav — 64px of nav plus breathing
125+
room keeps programmatic scroll targets clear of it, site-wide, without
126+
per-section scroll-mt classes that new sections would forget. */
127+
scroll-padding-top: 5rem;
128+
}
121129
body {
122130
@apply bg-background text-foreground;
123131
}

src/components/treasury/TreasuryInflowsList.tsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,34 @@ export function TreasuryInflowsList({
223223
})
224224
.filter((s) => s.count > 0);
225225

226+
// Column count DERIVED from the source count, so rows come out balanced —
227+
// never one orphan tile trailing a full row. The inner ceil is "how many
228+
// rows would a max-4 grid need", the outer spreads the tiles evenly over
229+
// those rows:
230+
//
231+
// sources | cols | rows
232+
// --------+------+------
233+
// 4 | 4 | 4
234+
// 5 | 3 | 3+2 (today: auction, subnet, swap, splits, transfer)
235+
// 6 | 3 | 3+3 (the day a Secondary/Seaport source lands)
236+
// 7 | 4 | 4+3
237+
//
238+
// Deliberately NOT auto-fit/minmax: that makes composition a function of
239+
// card width, so the orphan comes back intermittently at in-between
240+
// breakpoints — a reproducible defect traded for a flaky one. Keep this
241+
// deterministic-by-count even if the two ceils look "simplifiable".
242+
const tileCols =
243+
summary.length <= 4
244+
? summary.length
245+
: Math.ceil(summary.length / Math.ceil(summary.length / 4));
246+
226247
return (
227248
<>
228249
{summary.length > 1 ? (
229-
<ul className="mb-3 grid grid-cols-2 gap-px overflow-hidden rounded-lg border border-border bg-border sm:grid-cols-4">
250+
<ul
251+
className="mb-3 grid grid-cols-2 gap-px overflow-hidden rounded-lg border border-border bg-border sm:grid-cols-[repeat(var(--tile-cols),minmax(0,1fr))]"
252+
style={{ "--tile-cols": tileCols } as React.CSSProperties}
253+
>
230254
{summary.map((s) => (
231255
<li key={s.source} className="bg-card p-3">
232256
<div className="flex items-center gap-1.5">
@@ -250,7 +274,7 @@ export function TreasuryInflowsList({
250274
UNOCCUPIED cell (splits has no entries today) shows as a solid
251275
block of border colour. Card-coloured fillers close the row, one
252276
set per breakpoint because the column count differs. */}
253-
{Array.from({ length: (4 - (summary.length % 4)) % 4 }, (_, i) => (
277+
{Array.from({ length: (tileCols - (summary.length % tileCols)) % tileCols }, (_, i) => (
254278
<li key={`pad-sm-${i}`} aria-hidden className="hidden bg-card sm:block" />
255279
))}
256280
{Array.from({ length: (2 - (summary.length % 2)) % 2 }, (_, i) => (

0 commit comments

Comments
 (0)