Integration finished

This commit is contained in:
Kilian Hofmann 2025-07-03 21:22:06 +02:00
parent 8952aba12d
commit 09397edef9
15 changed files with 678 additions and 611 deletions

View File

@ -1,6 +1,6 @@
{
"name": "tfdidesign-md11-load-manager",
"version": "0.1.46",
"version": "0.1.63",
"description": "",
"main": "index.js",
"type": "module",
@ -10,9 +10,11 @@
"licenses": "license-report --output=markdown > ./src/assets/licenses_node.md",
"debugger": "cd \"%MSFS_SDK%\\Tools\\CoherentGT Debugger\" && Debugger.exe",
"locale": "cd \"%MSFS_SDK%\\Tools\\MSFS_Localization\" && MSFSLocalizationManager.exe",
"clean": "rimraf ..\\html_ui\\Pages\\VCockpit\\Instruments\\aircraft_efb\\TFDi_MD11_efb",
"dev": "npx rollup -c -w",
"build": "npm version patch && npx rollup -c",
"release": "pnpm types && pnpm lint && pnpm run licenses && pnpm clean && npm version patch && cross-env NODE_ENV=production npx rollup -c"
"build": "npm version patch && npx rollup -c && pnpm efb",
"release": "pnpm types && pnpm lint && pnpm run licenses && pnpm clean && npm version patch && cross-env NODE_ENV=production npx rollup -c && pnpm efb",
"efb": "cd ..\\.. && node insert-efb"
},
"engines": {
"node": ">=22"

View File

@ -45,7 +45,7 @@ const App: FC = () => {
}, []);
return (
<div className="flex w-full justify-center pt-2 bg-zinc-900">
<div className="flex w-full justify-center py-5 bg-zinc-900">
<div className="flex w-3/4 flex-col items-center">
{isReady && WASMData ? (
WASMData.userData.isCargo ? (

View File

@ -10,18 +10,17 @@ import ActionBar from '../actionbar/ActionBar';
interface SBEntryProps {
WASMData: WASMDataF;
loadingState: LoadingState;
username: string;
setLoadingState: (newState: LoadingState) => void;
}
const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoadingState }) => {
const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, setLoadingState }) => {
const [CGTarget, setCGTarget] = useState(WASMData.targetPayload.CGTarget);
const [fuel, setFuel] = useState(Math.round(WASMData.livePayload.fuel));
const [fuelEnabled, setFuelEnabled] = useState(true);
const [SBInFlight, setSBInFlight] = useState(false);
// FROM EFB
const simBrief = useSelector((state) => state.simbrief);
const simBrief = useSelector((state) => state.simbrief.plan);
const ZFW = () => {
if (loadingState !== 'loaded' && !GSXActive()) return Math.round(WASMData.targetPayload.total);
@ -59,10 +58,12 @@ const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoadi
}
};
const handleSB = async () => {
useEffect(() => {
if (!simBrief) return;
setSBInFlight(true);
const SBResponse = await ImportFlightPlanKH(
const SBResponse = ImportFlightPlanKH(
simBrief,
WASMData.limits.maxZFW,
WASMData.limits.maxTOW,
@ -75,11 +76,11 @@ const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoadi
return;
}
updateData(undefined, SBResponse.message);
updateData(undefined, SBResponse.message as SimBrief);
setFuel(parseFloat(SBResponse.message.fuel as unknown as string) ?? 0);
setFuel(parseFloat((SBResponse.message as SimBrief).fuel as unknown as string) ?? 0);
setSBInFlight(false);
};
}, [simBrief]);
useEffect(
() =>
@ -101,108 +102,120 @@ const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoadi
<>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-md bg-zinc-600 p-2 px-4">
<label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(e) => handleInput(e.target.value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<button
className="middle none center rounded-lg bg-green-600 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
data-ripple-light="true"
onClick={() => {
SimVar.SetSimVarValue(
'L:MD11_EFB_PAYLOAD_FUEL',
'lbs',
WASMData.userData.isImperial ? fuel : fuel * 2.20462262185
);
SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true);
setFuelEnabled(WASMData.livePayload.fuel === fuel);
}}
disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()}
>
Load Fuel
</button>
<div className="flex w-full items-center justify-between text-xs">
<label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(e) => handleInput(e.target.value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<button
className="middle none center rounded-lg bg-green-600 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
data-ripple-light="true"
onClick={() => {
SimVar.SetSimVarValue(
'L:MD11_EFB_PAYLOAD_FUEL',
'lbs',
WASMData.userData.isImperial ? fuel : fuel * 2.20462262185
);
SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true);
setFuelEnabled(WASMData.livePayload.fuel === fuel);
}}
disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()}
>
Load Fuel
</button>
</div>
</div>
</div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>Planned ZFW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={WASMData.sbPlanned.ZFW}
disabled
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Planned ZFW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={WASMData.sbPlanned.ZFW}
disabled
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4">
<label>Planned GW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={WASMData.sbPlanned.GW}
disabled
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Planned GW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={WASMData.sbPlanned.GW}
disabled
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-600 p-2 px-4">
<label>
Target ZFWCG ({WASMData.limits.minCG} - {WASMData.limits.maxCG})
</label>
<CGSelect
minCG={WASMData.limits.minCG}
maxCG={WASMData.limits.maxCG}
value={CGTarget}
disabled={loadingState !== 'preview' || GSXActive()}
increase={() =>
setCGTarget((prev) => {
const _new = prev + 0.1;
updateData(_new);
return _new;
})
}
decrease={() =>
setCGTarget((prev) => {
const _new = prev - 0.1;
updateData(_new);
return _new;
})
}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>
Target ZFWCG ({WASMData.limits.minCG} - {WASMData.limits.maxCG})
</label>
<CGSelect
minCG={WASMData.limits.minCG}
maxCG={WASMData.limits.maxCG}
value={CGTarget}
disabled={loadingState !== 'preview' || GSXActive()}
increase={() =>
setCGTarget((prev) => {
const _new = prev + 0.1;
updateData(_new);
return _new;
})
}
decrease={() =>
setCGTarget((prev) => {
const _new = prev - 0.1;
updateData(_new);
return _new;
})
}
/>
</div>
</div>
</div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${ZFWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={ZFW()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${ZFWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={ZFW()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${GWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={GW()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${GWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={GW()}
/>
</div>
</div>
</div>
@ -210,8 +223,6 @@ const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoadi
loadingState={loadingState}
loadDisabled={!GWValid() || SBInFlight}
GSXSync={WASMData.options.GSXSync}
GSXActive={GSXActive()}
importSB={handleSB}
load={() => {
setLoadingState('loaded');

View File

@ -10,18 +10,17 @@ import ActionBar from '../actionbar/ActionBar';
interface SBEntryProps {
WASMData: WASMDataPax;
loadingState: LoadingState;
username: string;
setLoadingState: (newState: LoadingState) => void;
}
const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoadingState }) => {
const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, setLoadingState }) => {
const [CGTarget, setCGTarget] = useState(WASMData.targetPayload.CGTarget);
const [fuel, setFuel] = useState(Math.round(WASMData.livePayload.fuel));
const [fuelEnabled, setFuelEnabled] = useState(true);
const [SBInFlight, setSBInFlight] = useState(false);
// FROM EFB
const simBrief = useSelector((state) => state.simbrief);
const simBrief = useSelector((state) => state.simbrief.plan);
const ZFW = () => {
if (loadingState !== 'loaded' && !GSXActive()) return Math.round(WASMData.targetPayload.total);
@ -59,10 +58,12 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoa
}
};
const handleSB = async () => {
useEffect(() => {
if (!simBrief) return;
setSBInFlight(true);
const SBResponse = await ImportFlightPlanKH(
const SBResponse = ImportFlightPlanKH(
simBrief,
WASMData.limits.maxZFW,
WASMData.limits.maxTOW,
@ -75,11 +76,11 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoa
return;
}
updateData(undefined, SBResponse.message);
updateData(undefined, SBResponse.message as SimBrief);
setFuel(parseFloat(SBResponse.message.fuel as unknown as string) ?? 0);
setFuel(parseFloat((SBResponse.message as SimBrief).fuel as unknown as string) ?? 0);
setSBInFlight(false);
};
}, [simBrief]);
useEffect(
() =>
@ -100,8 +101,8 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoa
return (
<>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="flex w-full items-center justify-between text-xs">
<div className="flex w-full items-center justify-between rounded-md bg-zinc-600 p-2 px-4">
<div className="flex w-full items-center justify-between rounded-md bg-zinc-600 p-2 px-4">
<div className="flex w-full items-center justify-between text-xs">
<label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
@ -132,79 +133,89 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoa
</div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>Planned ZFW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={WASMData.sbPlanned.ZFW}
disabled
/>
<div className="flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<div className="flex w-full items-center justify-between text-xs">
<label>Planned ZFW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={WASMData.sbPlanned.ZFW}
disabled
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4">
<label>Planned GW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={WASMData.sbPlanned.GW}
disabled
/>
<div className="flex w-full items-center justify-between bg-zinc-700 p-2 px-4">
<div className="flex w-full items-center justify-between text-xs">
<label>Planned GW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={WASMData.sbPlanned.GW}
disabled
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-600 p-2 px-4">
<label>
Target ZFWCG ({WASMData.limits.minCG} - {WASMData.limits.maxCG})
</label>
<CGSelect
minCG={WASMData.limits.minCG}
maxCG={WASMData.limits.maxCG}
value={CGTarget}
disabled={loadingState !== 'preview' || GSXActive()}
increase={() =>
setCGTarget((prev) => {
const _new = prev + 0.1;
updateData(_new);
return _new;
})
}
decrease={() =>
setCGTarget((prev) => {
const _new = prev - 0.1;
updateData(_new);
return _new;
})
}
/>
<div className="flex w-full items-center justify-between rounded-b-md bg-zinc-600 p-2 px-4">
<div className="flex w-full items-center justify-between text-xs">
<label>
Target ZFWCG ({WASMData.limits.minCG} - {WASMData.limits.maxCG})
</label>
<CGSelect
minCG={WASMData.limits.minCG}
maxCG={WASMData.limits.maxCG}
value={CGTarget}
disabled={loadingState !== 'preview' || GSXActive()}
increase={() =>
setCGTarget((prev) => {
const _new = prev + 0.1;
updateData(_new);
return _new;
})
}
decrease={() =>
setCGTarget((prev) => {
const _new = prev - 0.1;
updateData(_new);
return _new;
})
}
/>
</div>
</div>
</div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${ZFWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={ZFW()}
/>
<div className="flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<div className="flex w-full items-center justify-between text-xs">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${ZFWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={ZFW()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${GWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={GW()}
/>
<div className="flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<div className="flex w-full items-center justify-between text-xs">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${GWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={GW()}
/>
</div>
</div>
</div>
@ -212,8 +223,6 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoa
loadingState={loadingState}
loadDisabled={!GWValid() || SBInFlight}
GSXSync={WASMData.options.GSXSync}
GSXActive={GSXActive()}
importSB={handleSB}
load={() => {
setLoadingState('loaded');

View File

@ -5,13 +5,11 @@ interface ActionBarProps {
loadingState: LoadingState;
loadDisabled: boolean;
GSXSync: boolean;
GSXActive: boolean;
importSB?: () => void;
load: () => void;
unload: () => void;
}
const ActionBar: FC<ActionBarProps> = ({ loadingState, loadDisabled, GSXSync, GSXActive, importSB, load, unload }) => {
const ActionBar: FC<ActionBarProps> = ({ loadingState, loadDisabled, GSXSync, load, unload }) => {
return (
<div className="relative flex w-full items-center justify-start gap-x-6">
{loadingState === 'preview' && !GSXSync && (
@ -33,19 +31,6 @@ const ActionBar: FC<ActionBarProps> = ({ loadingState, loadDisabled, GSXSync, GS
Unload
</button>
)}
<div className="grow" />
{!!importSB && loadingState === 'preview' && (
<button
className="middle none center rounded-lg bg-green-600 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
data-ripple-light="true"
onClick={importSB}
disabled={GSXActive}
>
Import from SimBrief
</button>
)}
</div>
);
};

View File

@ -109,12 +109,7 @@ const Freighter: FC<FreighterProps> = ({ WASMData, username }) => {
setSelectedTab={setSelectedTab}
/>
{username && selectedTab === 0 && (
<SBEntryF
WASMData={WASMData}
loadingState={loadingState}
username={username}
setLoadingState={setLoadingState}
/>
<SBEntryF WASMData={WASMData} loadingState={loadingState} setLoadingState={setLoadingState} />
)}
{((username && selectedTab === 1) || (!username && selectedTab === 0)) && (
<ZFWEntryF WASMData={WASMData} loadingState={loadingState} setLoadingState={setLoadingState} />

View File

@ -61,26 +61,30 @@ const OptionsPax: FC<OptionsPaxProps> = ({ WASMData, loadingState }) => {
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>Pax Weight ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={paxWeight}
onChange={(e) => handleInput(e.target.value, Number.MAX_VALUE, setPaxWeight)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Pax Weight ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={paxWeight}
onChange={(e) => handleInput(e.target.value, Number.MAX_VALUE, setPaxWeight)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4">
<label>Bag Weight ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={bagWeight}
onChange={(e) => handleInput(e.target.value, Number.MAX_VALUE, setBagWeight)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Bag Weight ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={bagWeight}
onChange={(e) => handleInput(e.target.value, Number.MAX_VALUE, setBagWeight)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
</div>
</>

View File

@ -113,12 +113,7 @@ const Pax: FC<PaxProps> = ({ WASMData, username }) => {
setSelectedTab={setSelectedTab}
/>
{username && selectedTab === 0 && (
<SBEntryPax
WASMData={WASMData}
loadingState={loadingState}
username={username}
setLoadingState={setLoadingState}
/>
<SBEntryPax WASMData={WASMData} loadingState={loadingState} setLoadingState={setLoadingState} />
)}
{((username && selectedTab === 1) || (!username && selectedTab === 0)) && (
<ZFWEntryPax WASMData={WASMData} loadingState={loadingState} setLoadingState={setLoadingState} />

View File

@ -78,129 +78,147 @@ const StationEntryF: FC<StationEntryProps> = ({ WASMData, loadingState, setLoadi
<>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-md bg-zinc-600 p-2 px-4">
<label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(e) => handleInput(e.target.value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<button
className="middle none center rounded-lg bg-green-600 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
data-ripple-light="true"
onClick={() => {
SimVar.SetSimVarValue(
'L:MD11_EFB_PAYLOAD_FUEL',
'lbs',
WASMData.userData.isImperial ? fuel : fuel * 2.20462262185
);
SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true);
setFuelEnabled(WASMData.livePayload.fuel === fuel);
}}
disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()}
>
Load Fuel
</button>
<div className="flex w-full items-center justify-between text-xs">
<label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(e) => handleInput(e.target.value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<button
className="middle none center rounded-lg bg-green-600 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
data-ripple-light="true"
onClick={() => {
SimVar.SetSimVarValue(
'L:MD11_EFB_PAYLOAD_FUEL',
'lbs',
WASMData.userData.isImperial ? fuel : fuel * 2.20462262185
);
SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true);
setFuelEnabled(WASMData.livePayload.fuel === fuel);
}}
disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()}
>
Load Fuel
</button>
</div>
</div>
</div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>Upper 1</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={upper1}
onChange={(e) => handleInput(e.target.value, WASMData.limits.upper1, setUpper1)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Upper 1</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={upper1}
onChange={(e) => handleInput(e.target.value, WASMData.limits.upper1, setUpper1)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4">
<label>Upper 2</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={upper2}
onChange={(e) => handleInput(e.target.value, WASMData.limits.upper2, setUpper2)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Upper 2</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={upper2}
onChange={(e) => handleInput(e.target.value, WASMData.limits.upper2, setUpper2)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between bg-zinc-600 p-2 px-4">
<label>Upper 3</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={upper3}
onChange={(e) => handleInput(e.target.value, WASMData.limits.upper3, setUpper3)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Upper 3</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={upper3}
onChange={(e) => handleInput(e.target.value, WASMData.limits.upper3, setUpper3)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4">
<label>Upper 4</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={upper4}
onChange={(e) => handleInput(e.target.value, WASMData.limits.upper4, setUpper4)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Upper 4</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={upper4}
onChange={(e) => handleInput(e.target.value, WASMData.limits.upper4, setUpper4)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between bg-zinc-600 p-2 px-4">
<label>Forward Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={lowerForward}
onChange={(e) => handleInput(e.target.value, WASMData.limits.lowerForward, setLowerForward)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Forward Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={lowerForward}
onChange={(e) => handleInput(e.target.value, WASMData.limits.lowerForward, setLowerForward)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label>Aft Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={lowerRear}
onChange={(e) => handleInput(e.target.value, WASMData.limits.lowerRear, setLowerRear)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Aft Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={lowerRear}
onChange={(e) => handleInput(e.target.value, WASMData.limits.lowerRear, setLowerRear)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
</div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${ZFWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={ZFW()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${ZFWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={ZFW()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${GWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={GW()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${GWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={GW()}
/>
</div>
</div>
</div>
@ -208,7 +226,6 @@ const StationEntryF: FC<StationEntryProps> = ({ WASMData, loadingState, setLoadi
loadingState={loadingState}
loadDisabled={!ZFWValid() || !GWValid()}
GSXSync={WASMData.options.GSXSync}
GSXActive={GSXActive()}
load={() => {
setLoadingState('loaded');

View File

@ -78,129 +78,147 @@ const StationEntryPax: FC<StationEntryProps> = ({ WASMData, loadingState, setLoa
<>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-md bg-zinc-600 p-2 px-4">
<label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(e) => handleInput(e.target.value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<button
className="middle none center rounded-lg bg-green-600 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
data-ripple-light="true"
onClick={() => {
SimVar.SetSimVarValue(
'L:MD11_EFB_PAYLOAD_FUEL',
'lbs',
WASMData.userData.isImperial ? fuel : fuel * 2.20462262185
);
SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true);
setFuelEnabled(WASMData.livePayload.fuel === fuel);
}}
disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()}
>
Load Fuel
</button>
<div className="flex w-full items-center justify-between text-xs">
<label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(e) => handleInput(e.target.value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<button
className="middle none center rounded-lg bg-green-600 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
data-ripple-light="true"
onClick={() => {
SimVar.SetSimVarValue(
'L:MD11_EFB_PAYLOAD_FUEL',
'lbs',
WASMData.userData.isImperial ? fuel : fuel * 2.20462262185
);
SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true);
setFuelEnabled(WASMData.livePayload.fuel === fuel);
}}
disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()}
>
Load Fuel
</button>
</div>
</div>
</div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>Business</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={business1}
onChange={(e) => handleInput(e.target.value, WASMData.limits.business1, setBusiness1)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Business</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={business1}
onChange={(e) => handleInput(e.target.value, WASMData.limits.business1, setBusiness1)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4">
<label>Premium Economy</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={business2}
onChange={(e) => handleInput(e.target.value, WASMData.limits.business2, setBusiness2)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Premium Economy</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={business2}
onChange={(e) => handleInput(e.target.value, WASMData.limits.business2, setBusiness2)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between bg-zinc-600 p-2 px-4">
<label>Forward Economy</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={economy1}
onChange={(e) => handleInput(e.target.value, WASMData.limits.economy1, setEconomy1)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Forward Economy</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={economy1}
onChange={(e) => handleInput(e.target.value, WASMData.limits.economy1, setEconomy1)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4">
<label>Aft Economy</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={economy2}
onChange={(e) => handleInput(e.target.value, WASMData.limits.economy2, setEconomy2)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Aft Economy</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={economy2}
onChange={(e) => handleInput(e.target.value, WASMData.limits.economy2, setEconomy2)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between bg-zinc-600 p-2 px-4">
<label>Forward Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={forwardCargo}
onChange={(e) => handleInput(e.target.value, WASMData.limits.forwardCargo, setForwardCargo)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Forward Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={forwardCargo}
onChange={(e) => handleInput(e.target.value, WASMData.limits.forwardCargo, setForwardCargo)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label>Aft Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={rearCargo}
onChange={(e) => handleInput(e.target.value, WASMData.limits.rearCargo, setRearCargo)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Aft Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={rearCargo}
onChange={(e) => handleInput(e.target.value, WASMData.limits.rearCargo, setRearCargo)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
</div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${ZFWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={ZFW()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${ZFWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={ZFW()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${GWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={GW()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${GWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={GW()}
/>
</div>
</div>
</div>
@ -208,7 +226,6 @@ const StationEntryPax: FC<StationEntryProps> = ({ WASMData, loadingState, setLoa
loadingState={loadingState}
loadDisabled={!ZFWValid() || !GWValid()}
GSXSync={WASMData.options.GSXSync}
GSXActive={GSXActive()}
load={() => {
setLoadingState('loaded');

View File

@ -101,100 +101,110 @@ const ZFWEntryF: FC<ZFWEntryProps> = ({ WASMData, loadingState, setLoadingState
<>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-md bg-zinc-600 p-2 px-4">
<label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(e) => handleInput(e.target.value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<button
className="middle none center rounded-lg bg-green-600 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
data-ripple-light="true"
onClick={() => {
SimVar.SetSimVarValue(
'L:MD11_EFB_PAYLOAD_FUEL',
'lbs',
WASMData.userData.isImperial ? fuel : fuel * 2.20462262185
);
SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true);
setFuelEnabled(WASMData.livePayload.fuel === fuel);
}}
disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()}
>
Load Fuel
</button>
<div className="flex w-full items-center justify-between text-xs">
<label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(e) => handleInput(e.target.value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<button
className="middle none center rounded-lg bg-green-600 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
data-ripple-light="true"
onClick={() => {
SimVar.SetSimVarValue(
'L:MD11_EFB_PAYLOAD_FUEL',
'lbs',
WASMData.userData.isImperial ? fuel : fuel * 2.20462262185
);
SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true);
setFuelEnabled(WASMData.livePayload.fuel === fuel);
}}
disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()}
>
Load Fuel
</button>
</div>
</div>
</div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>Target ZFW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={ZFWTarget}
onChange={(e) => handleInputZFW(e.target.value)}
onBlur={(e) => handleBlur(e.target.value)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Target ZFW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={ZFWTarget}
onChange={(e) => handleInputZFW(e.target.value)}
onBlur={(e) => handleBlur(e.target.value)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label>
Target ZFWCG ({WASMData.limits.minCG} - {WASMData.limits.maxCG})
</label>
<CGSelect
minCG={WASMData.limits.minCG}
maxCG={WASMData.limits.maxCG}
value={CGTarget}
disabled={loadingState !== 'preview' || GSXActive()}
increase={() =>
setCGTarget((prev) => {
const _new = prev + 0.1;
updateData(undefined, _new);
return _new;
})
}
decrease={() =>
setCGTarget((prev) => {
const _new = prev - 0.1;
updateData(undefined, _new);
return _new;
})
}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>
Target ZFWCG ({WASMData.limits.minCG} - {WASMData.limits.maxCG})
</label>
<CGSelect
minCG={WASMData.limits.minCG}
maxCG={WASMData.limits.maxCG}
value={CGTarget}
disabled={loadingState !== 'preview' || GSXActive()}
increase={() =>
setCGTarget((prev) => {
const _new = prev + 0.1;
updateData(undefined, _new);
return _new;
})
}
decrease={() =>
setCGTarget((prev) => {
const _new = prev - 0.1;
updateData(undefined, _new);
return _new;
})
}
/>
</div>
</div>
</div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${ZFWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={ZFW()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${ZFWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={ZFW()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${GWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={GW()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${GWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={GW()}
/>
</div>
</div>
</div>
@ -202,7 +212,6 @@ const ZFWEntryF: FC<ZFWEntryProps> = ({ WASMData, loadingState, setLoadingState
loadingState={loadingState}
loadDisabled={!GWValid()}
GSXSync={WASMData.options.GSXSync}
GSXActive={GSXActive()}
load={() => {
setLoadingState('loaded');

View File

@ -101,100 +101,110 @@ const ZFWEntryPax: FC<ZFWEntryProps> = ({ WASMData, loadingState, setLoadingStat
<>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-md bg-zinc-600 p-2 px-4">
<label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(e) => handleInput(e.target.value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<button
className="middle none center rounded-lg bg-green-600 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
data-ripple-light="true"
onClick={() => {
SimVar.SetSimVarValue(
'L:MD11_EFB_PAYLOAD_FUEL',
'lbs',
WASMData.userData.isImperial ? fuel : fuel * 2.20462262185
);
SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true);
setFuelEnabled(WASMData.livePayload.fuel === fuel);
}}
disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()}
>
Load Fuel
</button>
<div className="flex w-full items-center justify-between text-xs">
<label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
value={fuel}
onChange={(e) => handleInput(e.target.value, WASMData.limits.maxFuel, setFuel)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<button
className="middle none center rounded-lg bg-green-600 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none"
data-ripple-light="true"
onClick={() => {
SimVar.SetSimVarValue(
'L:MD11_EFB_PAYLOAD_FUEL',
'lbs',
WASMData.userData.isImperial ? fuel : fuel * 2.20462262185
);
SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true);
setFuelEnabled(WASMData.livePayload.fuel === fuel);
}}
disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()}
>
Load Fuel
</button>
</div>
</div>
</div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>Target ZFW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={ZFWTarget}
onChange={(e) => handleInputZFW(e.target.value)}
onBlur={(e) => handleBlur(e.target.value)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>Target ZFW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={ZFWTarget}
onChange={(e) => handleInputZFW(e.target.value)}
onBlur={(e) => handleBlur(e.target.value)}
disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label>
Target ZFWCG ({WASMData.limits.minCG} - {WASMData.limits.maxCG})
</label>
<CGSelect
minCG={WASMData.limits.minCG}
maxCG={WASMData.limits.maxCG}
value={CGTarget}
disabled={loadingState !== 'preview' || GSXActive()}
increase={() =>
setCGTarget((prev) => {
const _new = prev + 0.1;
updateData(undefined, _new);
return _new;
})
}
decrease={() =>
setCGTarget((prev) => {
const _new = prev - 0.1;
updateData(undefined, _new);
return _new;
})
}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>
Target ZFWCG ({WASMData.limits.minCG} - {WASMData.limits.maxCG})
</label>
<CGSelect
minCG={WASMData.limits.minCG}
maxCG={WASMData.limits.maxCG}
value={CGTarget}
disabled={loadingState !== 'preview' || GSXActive()}
increase={() =>
setCGTarget((prev) => {
const _new = prev + 0.1;
updateData(undefined, _new);
return _new;
})
}
decrease={() =>
setCGTarget((prev) => {
const _new = prev - 0.1;
updateData(undefined, _new);
return _new;
})
}
/>
</div>
</div>
</div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${ZFWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={ZFW()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${ZFWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={ZFW()}
/>
</div>
</div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${GWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={GW()}
/>
<div className="flex w-full items-center justify-between text-xs">
<label>
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
</label>
<input
type="text"
placeholder=""
className={`w-1/2 rounded-lg border ${GWValid() ? 'border-white' : 'border-red-500 text-red-500'} bg-zinc-700 px-3 py-2 text-right`}
disabled
value={GW()}
/>
</div>
</div>
</div>
@ -202,7 +212,6 @@ const ZFWEntryPax: FC<ZFWEntryProps> = ({ WASMData, loadingState, setLoadingStat
loadingState={loadingState}
loadDisabled={!GWValid()}
GSXSync={WASMData.options.GSXSync}
GSXActive={GSXActive()}
load={() => {
setLoadingState('loaded');

View File

@ -1,10 +1,8 @@
export const ImportFlightPlanKH = async (
plan: any,
maxZFW: number,
maxTOW: number,
maxFuel: number,
isImperial: boolean
) => {
import { SimBrief } from '../types/general';
export const ImportFlightPlanKH = (plan: any, maxZFW: number, maxTOW: number, maxFuel: number, isImperial: boolean) => {
if (!plan) return { type: 'error', message: 'Empty plan' };
let convFactor = 1;
if (plan.params.units === 'kgs' && isImperial) convFactor = 2.20462262185;
if (plan.params.units === 'lbs' && !isImperial) convFactor = 1 / 2.20462262185;
@ -17,6 +15,6 @@ export const ImportFlightPlanKH = async (
pax: plan.weights.pax_count_actual,
cargo: Math.round(plan.weights.freight_added * convFactor),
fuel: Math.min(maxFuel, Math.round(plan.fuel.plan_ramp * convFactor)),
},
} as SimBrief,
};
};

View File

@ -10,10 +10,3 @@ Build in sim
- LAMM
- https://www.satco-inc.com/product-pallet/?part_number=31086-595
- https://www.satco-inc.com/product-container/?part_number=34124-901
TODO:
- Fix duplicate names
- Fix SB import (move to TFDi function proper)
- Adj. Dispatch page to navigate to Payload page
- TEST

View File

@ -1,13 +1,36 @@
const fs = require("fs");
const util = require("node:util");
const exec = util.promisify(require("node:child_process").exec);
const readline = require("readline");
const outFile =
"./PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/TFDi_MD11_efb/efb.js";
const outPath =
"./PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/TFDi_MD11_efb";
fs.copyFileSync("./efb.js", outFile);
fs.copyFileSync("./EFB/efb.js", `${outPath}/efb.js`);
fs.copyFileSync("./EFB/efb.html", `${outPath}/efb.html`);
console.log("Files transferred.");
exec("git apply efb.patch").then(({stdout, stderr}) => {
console.log("stdout:", stdout);
console.error("stderr:", stderr);
exec("git apply ./EFB/efb-js.patch").then(({ stdout, stderr }) => {
console.log("Patches efb.js applied.");
});
exec("git apply ./EFB/efb-html.patch").then(({ stdout, stderr }) => {
console.log("Patches efb.html applied.");
});
var output = "";
var lineReader = readline.createInterface({
input: fs.createReadStream(`${outPath}/App.js`),
});
lineReader.on("line", (line) => {
if (line.startsWith("import") || line.startsWith("export")) {
output += "// " + line + "\n";
} else {
output += line + "\n";
}
});
lineReader.on("close", () => {
fs.writeFile(`${outPath}/App.js`, output, (err) => {
if (err) console.log(err);
console.log("Import/Export removed.");
});
});