diff --git a/packages/frontend/src/Applications/FlightTracker/FlightTracker.test.tsx b/packages/frontend/src/Applications/FlightTracker/FlightTracker.test.tsx index 2e9714c4..6e9b5166 100644 --- a/packages/frontend/src/Applications/FlightTracker/FlightTracker.test.tsx +++ b/packages/frontend/src/Applications/FlightTracker/FlightTracker.test.tsx @@ -134,7 +134,11 @@ vi.mock("classicy", () => ({ /> ), MAC_OS_8_CRAYONS: [], - ClassicyIcons: { controlPanels: { location: { app: "icon.png" } } }, + ClassicyIcons: { + controlPanels: { location: { app: "icon.png" } }, + applications: {}, + }, + registerClassicyIcons: (icons: T) => icons, quitMenuItemHelper: () => ({}), registerAppEventHandler: () => {}, useAppManager: (sel: (s: unknown) => unknown) => @@ -270,6 +274,14 @@ describe("FlightTracker", () => { expect((last.positions as unknown[]).length).toBe(1); }); + it("registers app.png as the app icon and passes it to every window", () => { + render(); + expect(windowProps.length).toBeGreaterThan(0); + for (const w of windowProps) { + expect(String(w.icon)).toMatch(/app\.png/); + } + }); + it("clears the selection when the selected flight leaves the airborne set (e.g. after a seek)", () => { // useFlightTrack fires a real fetch once a flight is selected; stub it out // so the test only exercises the selection-clearing behavior under test. diff --git a/packages/frontend/src/Applications/FlightTracker/FlightTracker.tsx b/packages/frontend/src/Applications/FlightTracker/FlightTracker.tsx index b62e8510..de555b60 100644 --- a/packages/frontend/src/Applications/FlightTracker/FlightTracker.tsx +++ b/packages/frontend/src/Applications/FlightTracker/FlightTracker.tsx @@ -9,10 +9,12 @@ import { ClassicyWindow, MAC_OS_8_CRAYONS, quitMenuItemHelper, + registerClassicyIcons, useAppManager, useAppManagerDispatch, useClassicyDateTime, } from "classicy"; +import appIconPng from "./app.png"; import { type ChangeEvent, type FC, @@ -58,10 +60,21 @@ const BASEMAP_URL = (import.meta.env.VITE_FLIGHT_BASEMAP_URL as string | undefined) ?? "https://files.911realtime.org/maps/na-basemap.pmtiles"; +// This app's own icon, registered into the shared registry at +// ClassicyIcons.applications.flightTracker.app. registerClassicyIcons assigns +// shallowly, so the existing applications namespace is spread in to keep +// classicy's bundled app icons intact. +const ICONS = registerClassicyIcons({ + applications: { + ...ClassicyIcons.applications, + flightTracker: { app: appIconPng }, + }, +}); + export const FlightTracker: FC = () => { const appId = "FlightTracker.app"; const appName = "Flight Tracker"; - const appIcon = ClassicyIcons.controlPanels.location.app as string; + const appIcon = ICONS.applications.flightTracker.app; const isRunning = useAppManager( (s) => appId in (s.System.Manager.Applications.apps ?? {}), @@ -361,6 +374,7 @@ export const FlightTracker: FC = () => { {