Overview
FlightDetailPanelComponent is a desktop-only component that displays detailed information about a selected flight in an overlay panel. It shows flight data, aircraft information, and optional aircraft photos.
Location: src/app/features/flights/flight-detail-panel/flight-detail-panel.component.ts
Key Features
- Rich Flight Information: Displays comprehensive flight and aircraft data
- Aircraft Photos: Shows aircraft images when available
- Real-time Updates: Automatically updates when flight data changes
- Close Handling: Emits events when user closes the panel
- Computed Data: Reactive flight data lookup from store
Inputs
The ICAO24 identifier of the flight to display. This is a required input signal.Example:
Optional aircraft photo data to display in the panel.AircraftPhoto Interface:Example:
Outputs
Emits when the user clicks the close button. Parent components should listen to this event to clear selection and dispose the overlay.Usage:
Component Structure
Computed Flight Data
The component uses a computed signal to reactively look up flight data:Reactive Behavior
- Auto-updates: When flight data changes in the store, the view automatically updates
- Null Safety: Returns
nullif the flight is no longer in the store - Efficient: Only recomputes when
store.flights()orflightId()changes
Close Handling
Template Structure
The component template displays flight information in sections:Display Sections
1. Header
- Flight callsign or ICAO24
- Close button
2. Photo Section (Optional)
- Aircraft thumbnail image
- Photographer credit
- Link to full-size image
3. Flight Information
- Status (flying/on ground)
- Callsign
- ICAO24 address
- Altitude (with unit conversion)
- Velocity
- Heading
- Vertical rate
- Squawk code
4. Aircraft Information
- Operator/airline (with logo)
- Aircraft model
- Type code
- Registration
- Owner
- Origin country
Usage Example
The component is typically created dynamically by FlightsShellComponent:Styling
The component uses custom styling for the panel layout:Unit Conversion
The component uses a customUnitPipe for unit conversions:
Child Components
AirlineDisplayComponent
Displays airline logo and name:FlightStatusLedComponent
Shows visual indicator for flight status:Error Handling
Flight Not Found
If the flight is no longer in the store:Missing Photo
The photo section is conditionally rendered:Null Field Values
All nullable fields use fallback display:Accessibility
ARIA Labels
Keyboard Navigation
- Escape: Should close the panel (implement in parent)
- Tab: Navigate through focusable elements
- Enter/Space: Activate buttons and expansion panels
Mobile Alternative
On mobile viewports, FlightsShellComponent usesFlightDetailBottomSheetComponent instead of this panel component. Both components share similar inputs and display logic.
Performance Considerations
Computed Signal
The flight lookup is efficient because:- Only recomputes when dependencies change
- Uses built-in
find()method (O(n) but typically small n) - No unnecessary component re-renders
OnPush (Optional)
For better performance with frequent updates:Related Components
- FlightsShellComponent - Parent orchestration component
- [FlightDetailBottomSheetComponent] - Mobile alternative
- [AirlineDisplayComponent] - Airline display child component
- [FlightStatusLedComponent] - Status indicator child component
Services Used
- FlightsStoreService - Flight data store
Material Dependencies
MatButtonModule- Close buttonMatIconModule- IconsMatExpansionModule- Collapsible sectionsMatTooltipModule- TooltipsMatGridListModule- Grid layout
