diff --git a/public/meta/aircraft-icon-a32nx.png b/public/meta/aircraft-icon-a32nx.png new file mode 100644 index 00000000..3df5c924 Binary files /dev/null and b/public/meta/aircraft-icon-a32nx.png differ diff --git a/public/meta/aircraft-icon-a380x.png b/public/meta/aircraft-icon-a380x.png new file mode 100644 index 00000000..321e47c2 Binary files /dev/null and b/public/meta/aircraft-icon-a380x.png differ diff --git a/public/meta/aircraft-icon.png b/public/meta/aircraft-icon.png index ca329b42..1ea27b21 100644 Binary files a/public/meta/aircraft-icon.png and b/public/meta/aircraft-icon.png differ diff --git a/src/components/Map/Map.tsx b/src/components/Map/Map.tsx index d10f34b2..887d2426 100644 --- a/src/components/Map/Map.tsx +++ b/src/components/Map/Map.tsx @@ -4,13 +4,21 @@ import { MapContainer, Marker, Popup, TileLayer } from 'react-leaflet'; import { DivIcon } from 'leaflet'; import { ArrowRightOutlined } from '@ant-design/icons'; -const AircraftIcon = (heading: number, aircraftId: string) => { - const aircraftStyle = `transform: rotate(${heading}deg); transform-origin: center; width: 32px; height: 32px; filter: drop-shadow(0 0 2px rgba(0 0 0 /0.5))`; +const AircraftIcon = (heading: number, aircraftId: string, aircraftType: string) => { + let aircraftIconUrl = '/meta/aircraft-icon.png'; + let aircraftIconSize = 28; + if (aircraftType.includes('A32')) { + aircraftIconUrl = '/meta/aircraft-icon-a32nx.png'; + } + if (aircraftType.includes('A38')) { + aircraftIconUrl = '/meta/aircraft-icon-a380x.png'; aircraftIconSize = 38; + } + const aircraftIconStyle = `transform:rotate(${heading}deg);transform-origin:center;width:${aircraftIconSize}px;height:${aircraftIconSize}px;filter:drop-shadow(0 0 2px rgba(0 0 0 /0.5))`; return new DivIcon({ iconSize: [0, 0], iconAnchor: [15, 10], - html: `${aircraftId}`, + html: `${aircraftId}`, }); }; @@ -25,6 +33,33 @@ export interface LeafletMapProps { const LeafletMap: FC = ({ isFullPageMap, className }) => { const [flights, setFlights] = useState([]); + const MapLegend = () => ( +
+
+
+ + +

+ FlyByWire + A32NX +

+
+ + +

+ FlyByWire + A380X +

+
+ + +

Others

+
+
+
+
+ ); + useEffect(() => { Telex.fetchAllConnections().then((flights) => setFlights(flights)); }, []); @@ -40,7 +75,7 @@ const LeafletMap: FC = ({ isFullPageMap, className }) => { /> {flights.map((it) => ( - +
@@ -74,6 +109,7 @@ const LeafletMap: FC = ({ isFullPageMap, className }) => { ))} +
);