From d57521c03d0a8f0e8df1ae9dd1c2fc29e32552ab Mon Sep 17 00:00:00 2001 From: Raffson Date: Sun, 7 Jul 2024 14:05:36 +0200 Subject: [PATCH] Fix UI bug wrt selected flight-plans --- .../components/flightplanslayer/FlightPlansLayer.test.tsx | 6 +++--- .../src/components/flightplanslayer/FlightPlansLayer.tsx | 7 +------ client/src/components/liberationmap/LiberationMap.tsx | 4 ++-- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/client/src/components/flightplanslayer/FlightPlansLayer.test.tsx b/client/src/components/flightplanslayer/FlightPlansLayer.test.tsx index 820957d0..88241dbc 100644 --- a/client/src/components/flightplanslayer/FlightPlansLayer.test.tsx +++ b/client/src/components/flightplanslayer/FlightPlansLayer.test.tsx @@ -182,7 +182,7 @@ describe("FlightPlansLayer", () => { expect(mockLayerGroup).toBeCalledTimes(1); }); it("are not drawn when only selected flights are to be drawn", () => { - renderWithProviders(, { + renderWithProviders(, { preloadedState: { flights: { flights: { @@ -355,7 +355,7 @@ describe("FlightPlansLayer", () => { expect(mockLayerGroup).toBeCalledTimes(1); }); it("are not drawn if red", () => { - renderWithProviders(, { + renderWithProviders(, { preloadedState: { flights: { flights: { @@ -397,7 +397,7 @@ describe("FlightPlansLayer", () => { }, }, }); - expect(mockPolyline).not.toHaveBeenCalled(); + expect(mockPolyline).toHaveBeenCalled(); expect(mockLayerGroup).toBeCalledTimes(1); }); }); diff --git a/client/src/components/flightplanslayer/FlightPlansLayer.tsx b/client/src/components/flightplanslayer/FlightPlansLayer.tsx index 7f8ede20..392049c1 100644 --- a/client/src/components/flightplanslayer/FlightPlansLayer.tsx +++ b/client/src/components/flightplanslayer/FlightPlansLayer.tsx @@ -5,7 +5,7 @@ import FlightPlan from "../flightplan"; import { LayerGroup } from "react-leaflet"; interface FlightPlansLayerProps { - blue: boolean; + blue?: boolean; selectedOnly?: true; } @@ -15,11 +15,6 @@ function SelectedFlightPlan(props: FlightPlansLayerProps) { return <>; } - if (!props.blue) { - // We don't currently support playing as red, so nothing to draw. - return <>; - } - return ( - - + +