From b021ddaf112f21675e188a47196554ca73cd0403 Mon Sep 17 00:00:00 2001 From: Davide Passoni Date: Fri, 2 Aug 2024 17:33:48 +0200 Subject: [PATCH] Started implementing panel, missing loadout summary --- .../react/src/ui/panels/unitcontrolmenu.tsx | 64 ++++++++++++++++++- frontend/server/src/demo/demo.ts | 16 ++++- 2 files changed, 77 insertions(+), 3 deletions(-) diff --git a/frontend/react/src/ui/panels/unitcontrolmenu.tsx b/frontend/react/src/ui/panels/unitcontrolmenu.tsx index 2594ed24..d345b6bc 100644 --- a/frontend/react/src/ui/panels/unitcontrolmenu.tsx +++ b/frontend/react/src/ui/panels/unitcontrolmenu.tsx @@ -34,6 +34,7 @@ import { } from "../components/olicons"; import { Coalition } from "../../types/types"; import { ftToM, knotsToMs, mToFt, msToKnots } from "../../other/utils"; +import { FaGasPump } from "react-icons/fa"; export function UnitControlMenu(props: { open: boolean; onClose: () => void }) { var [selectedUnits, setSelectedUnits] = useState([] as Unit[]); @@ -184,7 +185,7 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) { return ( @@ -716,6 +717,67 @@ export function UnitControlMenu(props: { open: boolean; onClose: () => void }) { )} + <> + {selectedUnits.length === 1 && ( +
+
+
40 && + `bg-green-700` + } + ${ + selectedUnits[0].getFuel() > 10 && + selectedUnits[0].getFuel() <= + 40 && `bg-yellow-700` + } + ${ + selectedUnits[0].getFuel() <= 10 && + `bg-red-700` + } + px-2 py-1 text-sm font-bold text-white + `} + > + + {selectedUnits[0].getFuel()}% +
+
+
+ {selectedUnits[0].getAmmo().map((ammo) => { + return ( +
+
+ {ammo.quantity} +
+
+ {ammo.name} +
+
+ ); + })} +
+
+ )} +
); } diff --git a/frontend/server/src/demo/demo.ts b/frontend/server/src/demo/demo.ts index 8a1db149..5639f45c 100644 --- a/frontend/server/src/demo/demo.ts +++ b/frontend/server/src/demo/demo.ts @@ -66,7 +66,7 @@ module.exports = function (configLocation) { isActiveAWACS: false, onOff: true, followRoads: false, - fuel: 50, + fuel: 10, desiredSpeed: 300, desiredSpeedType: 1, desiredAltitude: 1000, @@ -87,7 +87,19 @@ module.exports = function (configLocation) { prohibitAirWpn: false, prohibitJettison: false, }, - ammo: [], + ammo: [{ + quantity: 2, + name: "A super nice missile", + guidance: 1, + category: 1, + missileCategory: 1 + }, { + quantity: 4, + name: "A less nice missile", + guidance: 1, + category: 1, + missileCategory: 1 + }], contacts: [], activePath: [{ lat: 37.1, lng: -116.1 }], isLeader: true,