Skip to content

feat: show observation details on track point popup (ERA-13537)#1628

Open
jeslefcourt wants to merge 2 commits into
developfrom
ERA-13537-track-point-observation-details
Open

feat: show observation details on track point popup (ERA-13537)#1628
jeslefcourt wants to merge 2 commits into
developfrom
ERA-13537-track-point-observation-details

Conversation

@jeslefcourt

@jeslefcourt jeslefcourt commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves ERA-13537 — customers want to see per-position telemetry (e.g. speed) when clicking a point along a subject's historic track ("snail trail").

Clicking a track timepoint now fetches the underlying observation for that subject + time and exposes its device_status_properties via the same "more details" toggle already used by the subject popup.

Changes

  • TimepointPopup now fetches the observation by subject_id over a small time window bracketing the point, then selects the matching record. Matching is done by instant, not string: the track endpoint serializes times in UTC (...+00:00) while observation recorded_at uses the tenant-local offset (...-07:00) — the same instant, different string. A closest-in-window fallback handles sub-second rounding (track times are whole-second; recorded_at carries milliseconds).
  • New shared AdditionalDeviceProperties component extracts the toggle + device_status_properties list + localStorage persistence that previously lived inline in SubjectPopup. Both popups now consume it, so the control stays consistent and the preference is shared.
  • SubjectPopup refactored to use the shared component. Its extra behaviors (static-subject gating, time-slider active/empty rendering) are preserved via optional props that default off, so TimepointPopup is unaffected.
  • 6px of spacing between the location and the details in the track point popup (collapses when there are no details to show).

Verification

  • Unit tests: TimepointPopup (7) + SubjectPopup (5) pass. New tests lock in the instant-vs-string matching and the non-zero query window as regression guards (both fail against the pre-fix code).
  • Verified against a live tenant (easterisland): across sampled tracked subjects, the popup resolves the correct observation for a clicked point 8/8, with device properties shown where the observation has them. This live check is what surfaced the two matching bugs (UTC-vs-local string mismatch, and a zero-width since==until query returning nothing), which are fixed here.
  • ESLint clean on all touched files.

Notes for reviewers

  • The observation query uses a ±1s window; the nearest observation to a track point was always within 999ms in live data. If a source ever emits denser-than-1s data, the exact-instant match still disambiguates.
  • AdditionalDeviceProperties returns null when there are no device properties, so no empty control or stray spacing renders.

🤖 Generated with Claude Code

Clicking a track timepoint now fetches the underlying observation for that
subject + time and exposes its device_status_properties (e.g. speed) via the
same "more details" toggle used by the subject popup.

- TimepointPopup fetches the observation by subject_id over a small time window
  bracketing the point, matching by instant (track times are UTC while
  observation recorded_at uses tenant-local offset) with a closest-in-window
  fallback for sub-second rounding.
- Extract the toggle/list/localStorage control into a shared
  AdditionalDeviceProperties component consumed by both SubjectPopup and
  TimepointPopup; SubjectPopup behavior (static-subject gating, time-slider
  state) preserved via optional props.
- 4px spacing between location and details in the track point popup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds telemetry (“device status properties”) to the historic track timepoint popup by fetching the nearest matching observation for the clicked subject/time and reusing the same “more details” UI used in the subject popup.

Changes:

  • TimepointPopup now queries /observations for the clicked subject_id within a small time window and matches by instant (with closest-in-window fallback).
  • Introduces a shared AdditionalDeviceProperties component that encapsulates the toggle UI, list rendering, and localStorage persistence.
  • Refactors SubjectPopup to use the shared component and removes the now-duplicated styles/logic.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/TimepointPopup/index.js Fetches observations around the clicked timepoint and renders shared additional device properties UI.
src/TimepointPopup/index.test.js Adds regression coverage for instant-vs-string matching, non-zero query window, and toggle/localStorage behavior.
src/TimepointPopup/styles.module.scss Adds spacing for the additional properties section in the timepoint popup.
src/AdditionalDeviceProperties/index.js New shared component for rendering/toggling device status properties with persisted preference.
src/AdditionalDeviceProperties/styles.module.scss Moves additional device properties list/toggle styles into the shared component.
src/SubjectPopup/index.js Replaces inline additional properties UI with the shared AdditionalDeviceProperties component.
src/SubjectPopup/styles.module.scss Removes additional properties styles that were moved into the shared component.

Comment thread src/TimepointPopup/styles.module.scss
@jeslefcourt
jeslefcourt requested a review from luixlive July 1, 2026 09: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