feat(traffic): AI-camera detail page redesign + dashboard traffic card fixes - #434
Merged
Merged
Conversation
… 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]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
CwStackedBarChartfrom cwui 0.1.113) replaces the unreadable 8-series generic line chart — 00–23 axis, translated legend with toggles, hover tooltips, colorblind-validated palettetraffic_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 modulesisTrafficTable()instead of an exact device-type-name matchDashboard cards (visual design unchanged)
bicycle_count-style keys in JA); also fixes the table viewtraffic_hourshown as localized date+hour instead of raw UTC ISO;line_numberhidden; details heading localizedInfra
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