Skip to content

feat(traffic): AI-camera detail page redesign + dashboard traffic card fixes - #434

Merged
CropWatchDevelopment merged 1 commit into
masterfrom
develop
Jul 27, 2026
Merged

CropWatchDevelopment merged 1 commit into
masterfrom
develop

Conversation

@CropWatchDevelopment

Copy link
Copy Markdown
Owner

Professional redesign of the traffic (AI camera) device detail page and content fixes for the dashboard cards. Companion to CropWatchDevelopment/api#80 (already merged & deployed — API must be live first, otherwise dashboard traffic cards read zeros).

Detail page (cw_traffic2 devices)

  • Purpose-built hourly stacked bar chart (new CwStackedBarChart from cwui 0.1.113) replaces the unreadable 8-series generic line chart — 00–23 axis, translated legend with toggles, hover tooltips, colorblind-validated palette
  • KPI strip: today's total, current hour, peak hour, top class, compact daily-weather tile
  • Class breakdown card with share-of-total bars (colors match the chart)
  • Hourly table: translated per-class headers, traffic_hour-keyed bucketing, broken per-row weather column removed (weather stays in KPI tile, calendar, and hourly CSV)
  • TrafficDisplay.svelte (1,677 lines) decomposed into 7 focused modules
  • Traffic detection via isTrafficTable() instead of an exact device-type-name match
  • Calendar month nav shows a spinner + disabled state while the month loads (cwui 0.1.113)

Dashboard cards (visual design unchanged)

  • All 7 detection-class labels translated (fixes raw bicycle_count-style keys in JA); also fixes the table view
  • Integer counts render without forced 2-decimals (no more "0.00")
  • traffic_hour shown as localized date+hour instead of raw UTC ISO; line_number hidden; details heading localized

Infra

  • cwui 0.1.110 → 0.1.113, installed from registry.npmjs.org (GitHub Packages scope routing removed — package is public; installs no longer need NODE_AUTH_TOKEN)

Verified in the browser in both locales (device 0025CA0000002F33 / Kokokara); lint, svelte-check, 113 unit tests, and production build all pass.

🤖 Generated with Claude Code

… cards

Detail page (cw_traffic2 devices):
- Replace the generic 8-series line chart with a purpose-built hourly
  stacked bar chart (new CwStackedBarChart from cwui 0.1.113), 00-23 axis,
  translated legend, per-class colors validated for colorblind safety
- New KPI strip: today's total, current hour, peak hour, top class, and a
  compact daily-weather tile
- New class-breakdown card with share-of-total bars matching chart colors
- Hourly table: translated per-class headers (was raw prettified English),
  buckets keyed by traffic_hour instead of created_at hour, dead per-row
  weather column removed (weather stays in KPI tile, calendar, and CSV)
- Decompose the 1677-line TrafficDisplay.svelte into focused modules:
  traffic-data.ts, traffic-weather.ts, TrafficKpiStrip, TrafficHourlyChart,
  TrafficClassBreakdown, TrafficHourlyTable, TrafficCalendarCard
- Detect traffic devices via isTrafficTable(dataTable) instead of an exact
  device-type-name match; suppress the generic chart for traffic devices
- Replace the 250ms polling loop with a 60s clock tick + keyed effects
- Calendar month nav shows loading spinner (CwCalendar loading prop)

Dashboard cards (visual design unchanged):
- Translate all traffic metric labels via existing traffic_metric_* keys
  (sensor-labels now covers all 7 detection classes; fixes DashboardTable too)
- Integer metrics render without the forced 2-decimal format (no more 0.00)
- traffic_hour renders as a localized date+hour instead of a raw UTC ISO
  string; line_number hidden; details heading localized
- created_at row filter now guards on the column key, not the label text

Infra:
- cwui 0.1.110 -> 0.1.113, now installed from registry.npmjs.org (scope
  routing to GitHub Packages removed; package is public, installs need no
  NODE_AUTH_TOKEN)

Requires the API dashboard aggregation change (deploy API first): dashboard
values for cw_traffic2 are today's totals summed across line_number buckets;
the previous latest-row read returned a near-empty accumulator bucket.

Co-Authored-By: Claude Fable 5 <[email protected]>
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
crop-watch Ready Ready Preview, Comment Jul 27, 2026 9:38am

Request Review

@CropWatchDevelopment
CropWatchDevelopment merged commit 5491310 into master Jul 27, 2026
11 checks passed

This branch was successfully deployed

1 active deployment
Preview — 86eb80eb Deployed Jul 27, 2026 by vercel[bot]
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