From d455165b30e15f56cef42ac6cd1b11bf4c617c7d Mon Sep 17 00:00:00 2001 From: Jonas Geertsen Lund Date: Thu, 21 Nov 2024 13:54:09 +0100 Subject: [PATCH] Add setting for filtering out base stations and AtoN --- src/__tests__/StreamManager.test.ts | 4 +-- src/components/navbar.tsx | 42 +++++++++++++++++++++++++++- src/contexts/appcontext.tsx | 19 ++++++++++++- src/implementations/StreamManager.ts | 1 - src/pages/vesselMapPage.tsx | 28 ++++++++++++++++--- src/svgs/faviconSVG.tsx | 8 +++--- 6 files changed, 89 insertions(+), 13 deletions(-) diff --git a/src/__tests__/StreamManager.test.ts b/src/__tests__/StreamManager.test.ts index 85d3557..c6720a3 100644 --- a/src/__tests__/StreamManager.test.ts +++ b/src/__tests__/StreamManager.test.ts @@ -18,9 +18,9 @@ beforeEach(() => { getSimpleVessles: jest .fn() .mockResolvedValue([ - { mmsi: 123456, location: { point: { lon: 1, lat: 2 }, timestamp: new Date(), heading: 45 } }, + { mmsi: 123456789, location: { point: { lon: 1, lat: 2 }, timestamp: new Date(), heading: 45 } }, ]), - getMonitoredVessels: jest.fn().mockResolvedValue([{ mmsi: 123456, trustworthiness: 0.9, reason: 'Test' }]), + getMonitoredVessels: jest.fn().mockResolvedValue([{ mmsi: 123456789, trustworthiness: 0.9, reason: 'Test' }]), } as unknown as jest.Mocked setAllVessels = jest.fn() diff --git a/src/components/navbar.tsx b/src/components/navbar.tsx index 323e440..3f89992 100644 --- a/src/components/navbar.tsx +++ b/src/components/navbar.tsx @@ -5,7 +5,17 @@ import HamburgerSVG from '../svgs/hamburgerSVG' import CloseSVG from '../svgs/closeSVG' export default function Navbar() { - const { myClockSpeed, setMyClockSpeed, myDateTimeRef, hideVessels, setHideVessels } = useAppContext() + const { + myClockSpeed, + setMyClockSpeed, + myDateTimeRef, + hideVessels, + setHideVessels, + showBaseStations, + setShowBaseStations, + showAtoNs, + setShowAtoNs, + } = useAppContext() const [opened, setOpened] = useState(false) const [localClock, setLocalClock] = useState(myDateTimeRef.current) const [localSpeed, setLocalSpeed] = useState(myClockSpeed.toString()) @@ -92,6 +102,36 @@ export default function Navbar() {
+ +
+ +

Filtering

+
+ Show base stations + +
+
+ Show AtoN (navigational aids) + +
)}