Skip to content

Add multi-aircraft profile with wizard quick-pick#702

Merged
rzueger merged 1 commit intodevelopfrom
feature/multi-aircraft-profile
Apr 16, 2026
Merged

Add multi-aircraft profile with wizard quick-pick#702
rzueger merged 1 commit intodevelopfrom
feature/multi-aircraft-profile

Conversation

@rzueger
Copy link
Copy Markdown
Member

@rzueger rzueger commented Apr 16, 2026

Summary

  • Migrate profile aircraft storage from single flat fields to an array of aircraft objects
  • Profile page: aircraft section with add (full 4-field form), inline edit (expand/collapse), and remove. Pilot form save button scoped inside its section. Duplicate registrations prevented. List sorted alphabetically.
  • Movement wizard: 1 aircraft = auto-prefilled, no chips. 2+ aircraft = empty fields with favourites bar (gold star + chips, mobile-friendly 44px tap targets, wraps on narrow screens). Clicking a chip fills all 4 fields + recalculates arrival fees.
  • On-read migration: existing profiles with flat aircraft fields auto-migrate to array on login. Migration persist is error-resilient (profile loads in-memory even if Firebase write fails, retries next login). Backwards-compat fallback in movement prefill for un-migrated profiles.
  • Firebase rules: aircrafts/$index added to profiles with field validation
  • Defensive normalizer: handles Firebase storing arrays as objects with numeric keys
  • Action types prefixed (ADD_PROFILE_AIRCRAFT etc.) to avoid collision with settings/aircrafts module

Test plan

  • npm test — 1775 tests pass (16 new)
  • npm run typecheck — clean
  • Deploy Firebase rules (firebase deploy --only database) before testing
  • Profile page: existing profile with flat aircraft auto-migrates to list
  • Profile page: add, edit, remove aircraft
  • Profile page: duplicate registration blocked
  • New departure with 1 aircraft: prefilled, no chips
  • New departure with 2+ aircraft: empty fields, chips shown, click fills form
  • New arrival with chips: click recalculates landing fees
  • New departure with 0 aircraft: no prefill, no chips
  • ReadOnly movement: no chips
  • Mobile: chips wrap, tap targets comfortable

Migrate profile aircraft storage from a single flat set of
fields to an array. Existing profiles are auto-migrated on
login (flat fields moved into array, then cleaned up).
Migration is error-resilient: profile loads even if the
Firebase persist fails, and retries on next login.

Profile page: aircraft section replaced with a list that
supports add, edit (inline expand), and remove. Pilot form
save button moved inside its section. Add form reuses the
same field components as the movement wizard.

Movement wizard: when the profile has exactly one aircraft,
it is prefilled automatically. With two or more, a
favourites bar with quick-pick chips appears above the
form fields (gold star icon, mobile-friendly tap targets).
Backwards-compatible fallback reads flat fields for
profiles not yet migrated.

Firebase rules updated to allow the new aircrafts array.
Duplicate registrations are prevented on add and edit.
List is kept sorted alphabetically by registration.

Handles Firebase edge case where arrays are stored as
objects with numeric keys (defensive normalizer).
@rzueger rzueger merged commit 7bfb22d into develop Apr 16, 2026
2 checks passed
@rzueger rzueger deleted the feature/multi-aircraft-profile branch April 16, 2026 14:38
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