Skip to content

feat(viewer): add colour-by-survey-date mode#2

Merged
MattNotarangelo merged 1 commit into
mainfrom
feat/colour-by-date
Jun 11, 2026
Merged

feat(viewer): add colour-by-survey-date mode#2
MattNotarangelo merged 1 commit into
mainfrom
feat/colour-by-date

Conversation

@MattNotarangelo

Copy link
Copy Markdown
Owner

Background

  • "Colour by date" was first on the README's planned list, and it's now more valuable since PocketTopo .top support (feat(parser): add PocketTopo .top (v3) support #1): every trip lands dates on legs, and date colouring is also how users spot bad device dates (e.g. the 2005-vs-2015 clock-reset case found during .top validation).
  • All the machinery already existed — legs carry date?: DateRange, and the colour-mode/legend system is pure pluggable logic — so this is a small, focused addition.

What Has Changed

  • New "date" colour mode in src/viewer/coloring.ts: legs are coloured across the model's overall date range using the existing depth ramp (oldest cool/blue → newest warm/red); undated legs render grey. A leg's position in the range uses the midpoint of its date span.
  • Legend: gradient labelled with the newest / middle / oldest ISO dates; a "no dates recorded" note when the model has no dated legs; single-date surveys colour at mid-ramp without dividing by zero.
  • The colour-mode dropdown and legend pick the new mode up automatically (no UI code changes needed).
  • README updated: mode list + controls docs; "Colour by date" removed from the planned row.
  • Tests: 6 new cases in test/coloring.test.ts (range colouring, date-span midpoints, legend labels, no-dates note, single-date edge, mode registration). 70/70 passing.

Verified end-to-end in the browser with Survex's date-edge-case fixture (dump3ddate.3d, 1900-01-01 → 2078-12-31): per-leg colours shift along the traverse and the legend labels are correct.

Screenshots/Video

  • {Leave for author}

Checklist

  • Self-review completed
  • Tests added or updated
  • Tested locally

🤖 Generated with Claude Code

New "Survey date" colour mode: legs are coloured across the model's date
range (oldest cool, newest warm; undated legs grey), using the midpoint
of each leg's date range. The legend shows the newest/middle/oldest
dates as ISO labels, or a "no dates recorded" note when nothing is
dated. Pure logic lives in coloring.ts; the dropdown and legend pick the
mode up automatically.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying caveviewer with  Cloudflare Pages  Cloudflare Pages

Latest commit: a2f7b52
Status: ✅  Deploy successful!
Preview URL: https://d1e36d4b.caveviewer.pages.dev
Branch Preview URL: https://feat-colour-by-date.caveviewer.pages.dev

View logs

@MattNotarangelo MattNotarangelo merged commit 392ebb1 into main Jun 11, 2026
2 checks passed
@MattNotarangelo MattNotarangelo deleted the feat/colour-by-date branch June 11, 2026 19:37
MattNotarangelo added a commit that referenced this pull request Jun 11, 2026
Resolved test/coloring.test.ts import block (main's superset wins);
coloring.ts auto-merged — date mode and the equate-aware
entranceDistances coexist.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant