Skip to content

feat(frontend): range compare on every price chart, with click-anchor and a pinned result - #389

Merged
EraPartner merged 1 commit into
mainfrom
claude/project-thread-f5kltc
Oct 30, 2026
Merged

EraPartner merged 1 commit into
mainfrom
claude/project-thread-f5kltc

Conversation

@EraPartner

Copy link
Copy Markdown
Owner

Requested by EraPartner · project thread

Summary

Tor reported that dragging across a chart after clicking a point no longer shows the price change. A Playwright check on main showed that press-and-drag still worked on the charts that had scrubbable turned on. The security price charts (watchlist dialog, market lookup, research compare, chart builder) never had it, and release cleared the result straight away. This PR:

  • Gesture (scrub.ts): one reducer supports both readings of "click, then drag".
    • Press, drag and release in either direction. The range stays on screen after release.
    • Click, move and click: the first click anchors a point, the range follows the pointer, and the second click pins it.
    • A click on a pinned range, Escape, a plain arrow key, blur, or leaving the chart clears it.
  • Overlay (ScrubOverlay.tsx): the band is tinted gain or loss and has edge hairlines and value dots at both ends. The readout shows the period and Δ (absolute and %) for every series and stays inside the chart box. Before, only series[0] was shown, which on the portfolio hero chart is the dashed "invested" line.
  • ComposedChart gains scrubbable.
  • Turned on for WatchlistChartDialog, MarketLookupPage, ResearchComparePage, ChartBuilderPage (main chart) and PortfolioForecastPage. Statistics flow charts, the oscillator and AI tool charts stay off.
  • A click on a chart no longer draws the browser's default black focus outline. Keyboard focus keeps the house ring.
  • Shortcut tip (en/nl) and docs (docs/components/charts.md, docs/reference/code-patterns.md, docs/architecture/frontend-architecture.md) are updated.

Type of change

  • feat — new feature

Checklist

  • Types check (tsc -p tsconfig.app.json)
  • Lint clean on changed files (one pre-existing warning in StackedBarChart)
  • Conventional Commit title
  • Affected docs/ pages updated
  • i18n: validate-locales passes

Architecture & data

  • No architectural change
  • No API change
  • No schema change

Verification

  • New boundary tests in chartScrub.test.tsx cover both drag directions, the pinned result, click to clear, click-move-click, Escape and leave, the not-scrubbable case, and Line and Composed charts. Chart suite: 8 files, 48/48 pass.
  • Full frontend vitest: 3829 passed, 4 failed. All 4 failures are in CSV encoding tests (useCsvPreview, FileHeadersPanel, PortfolioCsvColumnMapper), which expect windows-1252 € and get \u0080. That points to the container's ICU, and this PR touches none of those files.
  • Playwright against a Vite harness, not committed: drag R→L, release keeps the readout, a click dismisses it, click-move-click pins, and Escape and leave clear.

Residual risk & follow-ups

  • Not run in the packaged Electron app on the Mac.
  • With 5 or more series, the readout shows 4 rows and then "+N".

Generated by Claude Code

… and a pinned result

Range compare (drag across a chart to read the change between two points)
was only switched on for the portfolio, net worth, bank balance and
forecast charts. The security price charts never had it.

- scrub.ts: one gesture state for both readings of "click, then drag".
  Press-drag-release compares the range in either direction and keeps it
  on screen. Click-move-click anchors a point, follows the pointer, then
  pins. A click on a pinned range, Escape, blur or leaving clears it.
- ScrubOverlay.tsx: band tinted gain/loss with edge hairlines and value
  dots, plus a readout with the period and Δ (abs + %) for every series.
  Before, only series[0] was shown, which on the portfolio hero chart is
  the dashed "invested" line. The readout stays inside the chart box.
- ComposedChart gains `scrubbable` (chart builder price chart).
- Turned on for the watchlist chart dialog, market lookup, research
  compare, chart builder and portfolio forecast.
- Clicking a chart no longer draws the browser's default focus outline;
  keyboard focus keeps the ring.
- Shortcut tip (en/nl) describes the click gesture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018QJtaMokesZfp18PhCAeFD
@EraPartner EraPartner self-assigned this Oct 30, 2026
@github-actions

Copy link
Copy Markdown

Coverage Report for backend

Status Category Percentage Covered / Total
🟢 Lines 91.07% (🎯 80%) 23182 / 25455
🟢 Statements 89.33% (🎯 78%) 24949 / 27926
🟢 Functions 91.45% (🎯 76%) 5010 / 5478
🟢 Branches 81.62% (🎯 68%) 17492 / 21431
File CoverageNo changed files found.
Generated in workflow #1966 for commit 059ac92 by the Vitest Coverage Report Action

@EraPartner
EraPartner marked this pull request as ready for review October 30, 2026 18:48
@EraPartner
EraPartner merged commit 009ce3a into main Oct 30, 2026
11 checks passed
@EraPartner
EraPartner deleted the claude/project-thread-f5kltc branch October 30, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants