fix: /protocol Monthly UTC chart — phone x-axis overlap (last 12 months + YY-MM) #703
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#703
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
On phone,
/protocolUTC chart Monthly x-axis labels overlap into an unreadable pile (2024-09…2026-08stacked on the same baseline). The plot still fetches the full 24 UTC calendar months because bar-slot math (~12px) ignores that monthly labels areYYYY-MM(~7 glyphs). #677 P668-9 then forces Daily/Monthly to label every bar or every second bar — so ~12–24 ×2026-08strings collide on a ~260–300px plot.Bundle into one frontend issue: (1) request the last 12 UTC calendar months on phone-width (drop to 6 if 12 still collides), keep 24 on desktop; (2) shorten the axis to a 2-digit year (
26-08); (3) keep labels horizontal — do not rotate/skew SVG text. Tooltip / bararia-labelkeep fullYYYY-MM. Same plot serves Volume / Liquidity / Fees (#689) — one series, exclusive metric.Do not split “fewer months” vs “shorter labels” vs “no rotate” into separate issues. Do not reopen closed #668 / #677 / #689. Do not change indexer monthly retain ≥ 24 months or GET
limitmax 24.Related: #668 (grain + width clamp), #677 (dense x-axis), #689 (metric toggle), #652 (UTC series), #576 (trailing tiles ≠ calendar bars), #489 (short copy / no extra cognitive work), #653 (one chrome layer).
Current codebase
The overlap is specified, not a missing widget.
make verify-issue-677/668/689stay green while phone Monthly is illegible.ProtocolVolumeDailyChart.tsx—ResizeObserversetslimitvialimitFromPlotWidth(width − PAD_L − PAD_R, grain)(~12px/bar). SVGtextunderprotocol-volume-chart-xaxisistextAnchor="middle"fontSize="8", notransform. Tooltip + bararia-labelalready include the full UTC period (pointPeriod).protocolVolumeGrain.tsPROTOCOL_VOLUME_BAR_SLOT_PX = 12, monthly clamp 6–24. Phone plot ~260–300px →floor(260/12)=21…floor(320/12)=26→ 24 months on 390px. Desktop 1280 also 24 (max). Tests locklimitFromPlotWidth(1280, 'monthly') === 24.timeLabelStep: Daily/Monthly only 1 or 2 even whenestimatedAxisLabelWidthPx('monthly')(7 glyphs × 4.8 + 2 ≈ 36px) needs step 3–4. Hourly may widen.timeLabelIndexesalways labels first and last. Adjacent last-two labels (step thenpush(last)) can sit one slot apart (~11px vs ~36px glyph run).formatPeriodAxisLabel('2026-08', 'monthly')returns2026-08. Hourly isHH, dailyMM-DD(5 glyphs). Tests assert monthly stays2026-08.useProtocolVolumeSeriesQuery.tsquery key(metric, grain, limit).client.tsgetProtocolVolumeSeries/getProtocolLiquiditySeries/getProtocolFeesSeriesreject non-allowlisted grain/limit before fetch.GET /api/v1/protocol/{volume,liquidity,fees}/daily?grain=monthly&limit=max 24. Newest-last. Monthly = UTC calendar month (YYYY-MM), not trailing 30d. Rollup retain ≥ 24 months (P668-7 / P689-6). No GET-path SUM.e2e/protocol-page.spec.tsassertVolumeXAxisDensityat 1280 requires monthlylabelCount ≥ ceil(barCount/2). Phone 390 tests never click Monthly or assert non-overlapping<text>boxes. QA 10.2.18 is desktop-density, not collision.Collision math (phone): 24 ×
YYYY-MMat step 2 ≈ 13 labels × ~36px on a ~260px plot. Operators see2024-09through2026-08overprinted; the current month bar is readable, the axis is not.Why this is needed
YYYY-MMon 390px.2026-08sideways is extra cognitive work (#489). Horizontal shorter strings + fewer months is the product choice.--freshindexers already return idle zeros / available months (P668-7). Showing 6–12 newest months on phone does not require GET-path backfill.Constraints / guardrails
limit(most recent N UTC calendar months), not a newfrom/to(those stay 400).transform="rotate(…)", CSSwriting-mode,textPath). Horizontal only.7d/30dgrain,PriceChart, LlamaGET /defillama/daily, nestedcard-glass, or overlay Volume+Liquidity+Fees.maxLabels = 5.YY-MM; tooltip +aria-labelkeepYYYY-MM(and USD / em-dash). Century wrap (99vs00) is OK on the axis; tooltip disambiguates.innerHTML/eval/javascript:). Maliciousutc_monthmust not break layout into executable markup.[6, 24].limit. Empty / 404 sibling routes unchanged.UTC calendar monthstays). No lecture about “showing last 12 months.”skills/AGENTS_FRONTEND_PROTOCOL_STATS.md— do not treat today’s 24-on-phone as a regression to keep.Relevant files
frontend-dapp/src/utils/protocolVolumeGrain.ts—limitFromPlotWidth,estimatedAxisLabelWidthPx,timeLabelStep,formatPeriodAxisLabelfrontend-dapp/src/utils/__tests__/protocolVolumeGrain.test.tsfrontend-dapp/src/components/protocol/ProtocolVolumeDailyChart.tsxfrontend-dapp/src/components/protocol/useProtocolVolumeSeriesQuery.ts(query key already(grain, limit))frontend-dapp/src/services/indexer/client.ts— allowlistedgrain+limitfrontend-dapp/src/pages/ProtocolPage.test.tsxfrontend-dapp/e2e/protocol-page.spec.ts— add phone 390 Monthly collision + bar-count assertsskills/AGENTS_FRONTEND_PROTOCOL_STATS.md— P668-4 / P668-9 + this issue’s IDsdocs/frontend.md,docs/testing.md,QA_TEMPLATE.md(extend 10.2.18 or add a Monthly-phone row)scripts/qa/verify-issue-*.sh+Makefileverify-issue-*for this IIDlimit(then fix the client)Recommended direction
Phone-first months + shorter year. No rotated ticks.
limiton narrow plots: Forgrain === 'monthly', do not use the 12px bar slot as the only cap. On plot widths used at 390 (and tablet 820 if labels still collide), clamp monthlylimitto 12 (preferred) or 6 (PROTOCOL_VOLUME_GRAIN_MIN.monthly). Desktop 1280 stays 24.limitFromPlotWidth(320, 'monthly')must be ≤ 12, not 24.YY-MM:formatPeriodAxisLabel('2026-08', 'monthly')→26-08(same glyph budget as dailyMM-DD). UpdateestimatedAxisLabelWidthPx('monthly')to 5 glyphs. Tooltip /aria-label/pointPeriodstay2026-08.YY-MMstill collides on 390, drop to 6 bars rather than widening monthly step past 2 or rotating text.protocol-volume-chart-xaxis textbounding boxes — no pair overlaps (small epsilon). AssertbarCount ≤ 12(or 6). Repeat Volume / Liquidity / Fees. Light + dark not required if labels are SVGfill=var(--ink-dim).docs/frontend.md+ QA row: phone Monthly shows last 6–12 UTC months, axisYY-MM, horizontal.make verify-issue-677/668/689stay green (amend asserts that lock 24-on-phone /2026-08on the axis).Acceptance criteria
rotate/writing-modeon tick text.YY-MM, e.g.26-08). Tooltip + bararia-labelstill include fullYYYY-MM+ USD (unpriced → em-dash).MM-DD, hourlyHH. Trailing Last 24h/7d/30d tiles unchanged. Grain default Daily. Metric default Volume.limitand axis rules. Switching metric does not refetch a different month count. 404/501 volume still hides the chart; sibling 404 hides that metric only.from/to400, 60s cache, rollup-only — unchanged.PriceChart, Llama, nestedcard-glass,7d/30dgrain.QA_TEMPLATE+make verify-issue-{this}+ Playwright phone Monthly. Keepverify-issue-677/668/689/652/667/653green.Test plan (all paths)
/protocol→ MonthlyYY-MMticks; no bbox overlap; subtitleUTC calendar month; first+last labeledYY-MM); fills panel (P668-9 viewBox)limitdrop; query key updates; no stale 24-label pile--fresh/ all"0"nullvolume_usd/fees_usdnull; liquidity missing sampleYY-MMprotocolVolumeGrain.test.tsformatPeriodAxisLabelmonthlyYY-MM;2026-08still in tooltip tests26-01style, not overlapping 24 ×2026-ink-dim; still horizontalPlaywright 5 workers on
e2e-smoke. No wasm / LocalTerra required.Test plan (attack, hack, abuse)
limit=999,1.5,0,-1,monthly'; DROPgrain=week,grain=daily OR 1=1,grain=monthly;from/to/days/metricon grain GET"<script>…</script>",javascript:,"><img onerror><text>+ tooltip text only.querySelector('script')null. Layout may be ugly; must not execute.volume_usdInfinity/NaN/ huge NUMERIC$0/ finite ticks). NoInfinityon axis.SUM.card-glassaround plotprotocol-global-stats.<a href>utc_month26-08,2026-13, emptyVerification criteria
make verify-issue-{this}all steps PASS (docs grep + Vitest grain helper + ProtocolPage + Playwright phone Monthly collision + related 677/668/689).make verify-issue-677/make verify-issue-668/make verify-issue-689stay green after asserts that required 24 months on phone or axis2026-08are updated./protocol→ Monthly, Volume then Liquidity / Fees — ticks readable, no head-tilt, last 6 or 12 months not a 2024–2026 smear. Desktop Monthly still shows longer history when width allows.Close when AC M1–M8 are met. Do not close on desktop-only screenshots.
marked as related to #677
marked as related to #668
marked as related to #689
marked as related to #652
Skill / docs IDs for this issue: P703-1–P703-8 map 1:1 to AC M1–M8. Amend P668-4 (phone monthly
limit≤ 12) and P668-9 (Monthly on phone is fewer bars +YY-MM, not rotated ticks). Do not reopen #668 / #677 / #689.mentioned in commit
cec46e863fmentioned in merge request !1196
Implemented in !1196.
M1–M8 covered in
make verify-issue-703(Vitest + Playwright phone 390 / tablet 820 collision, related 677/668/689). Phone Monthlylimitis 6–12 newest UTC months; axis isYY-MM; ticks stay horizontal. Indexer GET max remains 24.Remaining for operators: a Chrome 390×844
/protocol→ Monthly (Volume then Liquidity / Fees) pass, and desktop 1280 Monthly still showing longer history.mentioned in commit
5ff870ffa9