Overview
FlightsListComponent provides a tabular view of flight data using Angular Material’s table component. It supports sorting, row selection, and integrates with the global filter system.
Location: src/app/features/flights/flights-list/flights-list.component.ts
Key Features
- Sortable Columns: Click column headers to sort data
- Row Selection: Click rows to select/deselect flights
- Reactive Filtering: Automatically updates when filters change
- Status Indicators: Visual LED indicators for flight status
- Responsive Design: Adapts to different screen sizes
Component Configuration
Table Structure
Displayed Columns
| Column | Description | Sortable |
|---|---|---|
callsign | Flight callsign/identifier | Yes |
icao24 | Aircraft ICAO24 address | Yes |
operator | Airline/operator name | Yes |
flyingStatus | On-ground or flying status | Yes |
Data Source
MatTableDataSource for built-in sorting and filtering capabilities.
Reactive Data Binding
The table automatically updates when filtered flights change:Effect Flow
store.filteredFlights()signal changes- Effect triggers and updates
dataSource.data - Table automatically re-renders with new data
Sorting Configuration
Setup
Custom Sort Logic
- Text Columns: Case-insensitive alphabetical sorting
- Nullable Fields: Empty strings for null values (sorted to top/bottom)
- Flying Status: Boolean converted to number (0 = flying, 1 = on ground)
Usage in Template
Row Selection
Clicking a row toggles flight selection:Selection Behavior
- First Click: Selects the flight
- Second Click: Deselects the flight
- Different Flight: Switches selection to new flight
Visual Feedback
Selected rows typically have CSS styling:Integration with Filters
The component automatically respects global filters:Status Indicators
The flying status column uses a custom LED component:- Green LED: Flying
- Red LED: On ground
Template Structure
Usage Example
The component is typically used in the FlightsShellComponent:Accessibility
Keyboard Navigation
- Tab: Navigate between rows
- Enter/Space: Trigger row click
- Arrow Keys: When sorting is active
ARIA Labels
Performance Considerations
Change Detection
Uses default change detection strategy. The effect automatically triggers change detection whenfilteredFlights() changes.
Large Datasets
For very large datasets (>1000 rows), consider:- Virtual Scrolling: Use
@angular/cdk/scrolling - Pagination: Add
MatPaginator - Server-Side Sorting: Move sort logic to backend
Example with Pagination
Common Customizations
Adding More Columns
Custom Row Styling
Related Components
- FlightsShellComponent - Parent container
- FlightsMapComponent - Map companion view
- [FlightsFilterMenuComponent] - Filter controls
- [FlightStatusLedComponent] - Status indicator
Services Used
- FlightsStoreService - Flight data and selection state
Material Dependencies
MatTableModule- Table structureMatSortModule- Column sortingMatCardModule- Card containerMatIconModule- IconsMatTooltipModule- Tooltips
