Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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: <T,>(icons: T) => icons,
quitMenuItemHelper: () => ({}),
registerAppEventHandler: () => {},
useAppManager: (sel: (s: unknown) => unknown) =>
Expand Down Expand Up @@ -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(<FlightTracker />);
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 ?? {}),
Expand Down Expand Up @@ -361,6 +374,7 @@ export const FlightTracker: FC = () => {
<ClassicyWindow
id="flight-settings"
title="Settings"
icon={appIcon}
appId={appId}
closable={true}
resizable={false}
Expand Down Expand Up @@ -454,6 +468,7 @@ export const FlightTracker: FC = () => {
<ClassicyWindow
id="flight-map"
title="Flight Tracker"
icon={appIcon}
appId={appId}
initialSize={["80%", "80%"]}
initialPosition={["center", "center"]}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading