import { Flight } from "../../api/flight"; import FlightPlan from "../flightplan"; import { LayerGroup } from "react-leaflet"; import { selectFlights } from "../../api/flightsSlice"; import { useAppSelector } from "../../app/hooks"; interface FlightPlansLayerProps { blue: boolean; } export default function FlightPlansLayer(props: FlightPlansLayerProps) { const atos = useAppSelector(selectFlights); const flights = props.blue ? atos.blue : atos.red; const isNotSelected = (flight: Flight) => { if (atos.selected == null) { return true; } return atos.selected.id !== flight.id; }; const selectedFlight = atos.selected ? ( ) : ( <> ); return ( {Object.values(flights) .filter(isNotSelected) .map((flight) => { return ( ); })} {selectedFlight} ); }