Skip to content

Refactor aircraft flags and enhance TUI breadcrumbs with route info - #16

Open
frankea wants to merge 2 commits into
mainfrom
claude/implement-tui-design-P1G1e
Open

Refactor aircraft flags and enhance TUI breadcrumbs with route info#16
frankea wants to merge 2 commits into
mainfrom
claude/implement-tui-design-P1G1e

Conversation

@frankea

@frankea frankea commented Apr 24, 2026

Copy link
Copy Markdown
Owner

Summary

This PR refactors the aircraft flags system to better align with the UI design concept and enhances several TUI views with improved breadcrumb navigation and detail expansion handling.

Key Changes

Aircraft Flags Refactoring (adsbtrack/tui/queries.py):

  • Replace type_code-based "HELI" badge with two new boolean fields: has_hover (flights with ≥5 min hover time) and has_type_override (cross-ref type differs from FAA registry)
  • Update _render_flags() to generate "MIL / SPF / HOVER / TYP" badges based on these new fields
  • Add SQL queries to detect hover flights and type overrides at the database level

Map View Enhancement (adsbtrack/tui/views/map.py):

  • Add _route_for() method to fetch origin/destination airport codes for the first flight on a given date
  • Display route information in breadcrumb as "KSPG → KHKY" when available, with graceful fallback for missing/ambiguous endpoints
  • Improve map header context with route visualization

Spoof View Improvements (adsbtrack/tui/views/spoof.py):

  • Add expandable detail rows with visual indicator (+ for collapsed, − for expanded)
  • Track expanded row state across filter/rerender operations
  • Preserve cursor position when filtering to maintain selection context
  • Add crumb_prefix="›" to match scope-level breadcrumb styling

Aircraft View Updates (adsbtrack/tui/views/aircraft.py):

  • Update flag rendering to use new has_hover and has_type_override fields
  • Change badge colors: HOVER and TYP use ACCENT_AMBER (matching concept design)
  • Add crumb_prefix="›" for consistent scope breadcrumb styling

Events View Refinements (adsbtrack/tui/views/events.py):

  • Reorder table columns to match concept layout: TIME / ICAO / CALLSIGN / EVENT / SUMMARY
  • Add crumb_prefix="›" for scope-level breadcrumbs

Widget Styling (adsbtrack/tui/widgets.py):

  • Update status bar separator from dot glyph to double-space for better visual alignment with concept
  • Add crumb_prefix parameter to PageHeader to support both scope () and attribute (·) breadcrumb styles

Checklist

  • uv run pytest passes
  • uv run ruff check . passes
  • uv run ruff format --check . passes
  • Commit messages describe the "why"

https://claude.ai/code/session_01STmuGvn8xHQeqoWyFKgRxM

claude added 2 commits April 24, 2026 18:15
Concrete gaps between the concept mock and the running TUI, page by page:

- Top bar: concept uses flex-gap between items; we were emitting a
  middle-dot separator between them. Drop the dot, keep a double-space.
- Page headers: concept uses '›' as the crumb prefix on scope pages
  (aircraft, events, spoof) and '·' on attribute pages (flights, map,
  status). Add a `crumb_prefix` kwarg to PageHeader and pass '›' from
  the three scope views.
- Aircraft FLAGS column: concept lists MIL / SPF / HOVER / TYP. We had
  MIL / SPF / HELI. Drop HELI; add HOVER (any flight with hover >= 5
  min) and TYP (cross-ref disagrees with registry on type code). Pull
  both via the existing aircraft-list SELECT.
- Event feed column order: concept is ts / hex / callsign / pill /
  summary. We had pill in column 2; move it to column 4.
- Spoof table: concept has a trailing 24px column showing '+' /
  '−' for collapse/expand state. Add the column, track
  `_expanded_key`, flip the glyph and re-render on each toggle.
- Map crumb: concept reads `date · KSPG → KHKY`. Resolve the
  origin/destination airports from the matching flight row on that
  date and include them when both are clean ICAO codes.

All 552 existing tests pass unchanged; no new tests required since
none of the assertions pin column order or flag wording.

https://claude.ai/code/session_01STmuGvn8xHQeqoWyFKgRxM
Ruff flagged the cursor-state capture in _rerender as E501. Pull the
cursor row lookup into a local and read .icao/.takeoff_date off it
instead of indexing twice.

https://claude.ai/code/session_01STmuGvn8xHQeqoWyFKgRxM
@frankea

frankea commented Apr 24, 2026

Copy link
Copy Markdown
Owner Author

@claude

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