Add aerodrome quick-picks to movement wizard - #827
Merged
Conversation
Add a quick-pick chip bar under the destination/origin field in the departure and arrival wizards: - Home aerodrome pinned first for everyone (incl. guests), and ordered first in the aerodrome dropdown. Labelled "local flight", not "home base", to avoid confusing visiting pilots. - Personal most-frequent destinations for logged-in pilots, derived from their own movements. Regular users read already-loaded movements (no extra request); admins, whose list is club-wide, fetch their own via the existing createdBy_orderKey index. - A just-used aerodrome is recorded on save and shown immediately in the next form, without waiting for the movement list to reload. Chips render in a new LabeledComponent footer slot so they share the field width. Shared chip styling extracted to QuickPickBar.
LS aerodromes rank before non-LS after the home aerodrome, so LSGG precedes LFSB.
testing-library getByTestId targets data-testid; the chips use the repo's data-cy convention.
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.
What & why
Logging a movement means re-typing the same aerodrome ICAO codes into the
destination/origin field every time. Aircraft already have profile-based
quick-picks; aerodromes had nothing. This adds a quick-pick chip bar under
the destination/origin field in both the departure and arrival wizards.
Two complementary parts
1. Home aerodrome first — for everyone (incl. guests / kiosk)
The most common
locationat a small field is the field itself (circuits /local flights).
__CONF__.aerodrome.ICAOis pinned as the first chip andsorted first in the aerodrome dropdown. It's labelled "local flight" (the
app's own
routes.localFlightterm), not "home" — a house icon would clashwith the existing "home base = aircraft based here" concept and mislead
visiting pilots whose base is elsewhere.
2. Personal most-frequent destinations — for logged-in pilots
Derived from the pilot's own movements, keyed on
createdBy(their email):state.movements(which is bounded to their owncreatedBy) — no extraFirebase read.
allMovementsoperators: their loaded list is club-wide, sofiltering it by their email can return nothing even though their movements
exist further down (the "row 51" problem). They instead do one bounded,
session-cached fetch via the existing
createdBy_orderKeyindex.Freshness
An aerodrome just flown to is recorded on
SAVE_MOVEMENT_SUCCESSand shownimmediately (first) in the next form — no dependency on the movement-list
realtime listener, which previously meant a new destination only appeared
after a full page reload.
Layout
Chips render in a new
LabeledComponentfooterslot, so they sit inside thedestination field and share its width without inheriting the input styling.
Shared chip styling was extracted from
AircraftPageintoQuickPickBar.Cost
Zero additional hosting cost for the common case (regular users reuse
already-downloaded data); only the few admin sessions issue one small bounded,
cached read. No new Firebase index, Cloud Function, or stored data.
Scope / limitations
createdBy);elsewhere only the home chip shows. Gated by
profileEnabled.Tests
Specs added for the dropdown comparator, aggregation helper, reducer (incl.
session recording), admin fetch saga, selector (regular/admin/session/home/
guest), the component (render/click/guest/readOnly + fetch behaviour), and the
LabeledComponentfooter slot.Note: Jest was not run in the authoring sandbox (platform-mismatched
node_modulesvs Jest 30's native resolver);npm run typecheckpasses andCI runs the suites.