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", "name": "tfdidesign-md11-load-manager",
"version": "0.1.46", "version": "0.1.63",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"type": "module", "type": "module",
@ -10,9 +10,11 @@
"licenses": "license-report --output=markdown > ./src/assets/licenses_node.md", "licenses": "license-report --output=markdown > ./src/assets/licenses_node.md",
"debugger": "cd \"%MSFS_SDK%\\Tools\\CoherentGT Debugger\" && Debugger.exe", "debugger": "cd \"%MSFS_SDK%\\Tools\\CoherentGT Debugger\" && Debugger.exe",
"locale": "cd \"%MSFS_SDK%\\Tools\\MSFS_Localization\" && MSFSLocalizationManager.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", "dev": "npx rollup -c -w",
"build": "npm version patch && 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" "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": { "engines": {
"node": ">=22" "node": ">=22"

View File

@ -45,7 +45,7 @@ const App: FC = () => {
}, []); }, []);
return ( 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"> <div className="flex w-3/4 flex-col items-center">
{isReady && WASMData ? ( {isReady && WASMData ? (
WASMData.userData.isCargo ? ( WASMData.userData.isCargo ? (

View File

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

View File

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

View File

@ -5,13 +5,11 @@ interface ActionBarProps {
loadingState: LoadingState; loadingState: LoadingState;
loadDisabled: boolean; loadDisabled: boolean;
GSXSync: boolean; GSXSync: boolean;
GSXActive: boolean;
importSB?: () => void;
load: () => void; load: () => void;
unload: () => void; unload: () => void;
} }
const ActionBar: FC<ActionBarProps> = ({ loadingState, loadDisabled, GSXSync, GSXActive, importSB, load, unload }) => { const ActionBar: FC<ActionBarProps> = ({ loadingState, loadDisabled, GSXSync, load, unload }) => {
return ( return (
<div className="relative flex w-full items-center justify-start gap-x-6"> <div className="relative flex w-full items-center justify-start gap-x-6">
{loadingState === 'preview' && !GSXSync && ( {loadingState === 'preview' && !GSXSync && (
@ -33,19 +31,6 @@ const ActionBar: FC<ActionBarProps> = ({ loadingState, loadDisabled, GSXSync, GS
Unload Unload
</button> </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> </div>
); );
}; };

View File

@ -109,12 +109,7 @@ const Freighter: FC<FreighterProps> = ({ WASMData, username }) => {
setSelectedTab={setSelectedTab} setSelectedTab={setSelectedTab}
/> />
{username && selectedTab === 0 && ( {username && selectedTab === 0 && (
<SBEntryF <SBEntryF WASMData={WASMData} loadingState={loadingState} setLoadingState={setLoadingState} />
WASMData={WASMData}
loadingState={loadingState}
username={username}
setLoadingState={setLoadingState}
/>
)} )}
{((username && selectedTab === 1) || (!username && selectedTab === 0)) && ( {((username && selectedTab === 1) || (!username && selectedTab === 0)) && (
<ZFWEntryF WASMData={WASMData} loadingState={loadingState} setLoadingState={setLoadingState} /> <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="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"> <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> <div className="flex w-full items-center justify-between text-xs">
<input <label>Pax Weight ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={paxWeight} 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"
onChange={(e) => handleInput(e.target.value, Number.MAX_VALUE, setPaxWeight)} value={paxWeight}
disabled={loadingState !== 'preview' || GSXActive()} onChange={(e) => handleInput(e.target.value, Number.MAX_VALUE, setPaxWeight)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4"> <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> <div className="flex w-full items-center justify-between text-xs">
<input <label>Bag Weight ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={bagWeight} 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"
onChange={(e) => handleInput(e.target.value, Number.MAX_VALUE, setBagWeight)} value={bagWeight}
disabled={loadingState !== 'preview' || GSXActive()} onChange={(e) => handleInput(e.target.value, Number.MAX_VALUE, setBagWeight)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
</div> </div>
</> </>

View File

@ -113,12 +113,7 @@ const Pax: FC<PaxProps> = ({ WASMData, username }) => {
setSelectedTab={setSelectedTab} setSelectedTab={setSelectedTab}
/> />
{username && selectedTab === 0 && ( {username && selectedTab === 0 && (
<SBEntryPax <SBEntryPax WASMData={WASMData} loadingState={loadingState} setLoadingState={setLoadingState} />
WASMData={WASMData}
loadingState={loadingState}
username={username}
setLoadingState={setLoadingState}
/>
)} )}
{((username && selectedTab === 1) || (!username && selectedTab === 0)) && ( {((username && selectedTab === 1) || (!username && selectedTab === 0)) && (
<ZFWEntryPax WASMData={WASMData} loadingState={loadingState} setLoadingState={setLoadingState} /> <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="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"> <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> <div className="flex w-full items-center justify-between text-xs">
<input <label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
type="text" <input
placeholder="" type="text"
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`} placeholder=""
value={fuel} className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
onChange={(e) => handleInput(e.target.value, WASMData.limits.maxFuel, setFuel)} value={fuel}
disabled={loadingState !== 'preview' || GSXActive()} 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" <button
data-ripple-light="true" 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"
onClick={() => { data-ripple-light="true"
SimVar.SetSimVarValue( onClick={() => {
'L:MD11_EFB_PAYLOAD_FUEL', SimVar.SetSimVarValue(
'lbs', 'L:MD11_EFB_PAYLOAD_FUEL',
WASMData.userData.isImperial ? fuel : fuel * 2.20462262185 'lbs',
); WASMData.userData.isImperial ? fuel : fuel * 2.20462262185
SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true); );
setFuelEnabled(WASMData.livePayload.fuel === fuel); SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true);
}} setFuelEnabled(WASMData.livePayload.fuel === fuel);
disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()} }}
> disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()}
Load Fuel >
</button> Load Fuel
</button>
</div>
</div> </div>
</div> </div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4"> <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"> <div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>Upper 1</label> <div className="flex w-full items-center justify-between text-xs">
<input <label>Upper 1</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={upper1} 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"
onChange={(e) => handleInput(e.target.value, WASMData.limits.upper1, setUpper1)} value={upper1}
disabled={loadingState !== 'preview' || GSXActive()} onChange={(e) => handleInput(e.target.value, WASMData.limits.upper1, setUpper1)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4"> <div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4">
<label>Upper 2</label> <div className="flex w-full items-center justify-between text-xs">
<input <label>Upper 2</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={upper2} 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"
onChange={(e) => handleInput(e.target.value, WASMData.limits.upper2, setUpper2)} value={upper2}
disabled={loadingState !== 'preview' || GSXActive()} onChange={(e) => handleInput(e.target.value, WASMData.limits.upper2, setUpper2)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between bg-zinc-600 p-2 px-4"> <div className="relative flex w-full items-center justify-between bg-zinc-600 p-2 px-4">
<label>Upper 3</label> <div className="flex w-full items-center justify-between text-xs">
<input <label>Upper 3</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={upper3} 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"
onChange={(e) => handleInput(e.target.value, WASMData.limits.upper3, setUpper3)} value={upper3}
disabled={loadingState !== 'preview' || GSXActive()} onChange={(e) => handleInput(e.target.value, WASMData.limits.upper3, setUpper3)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4"> <div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4">
<label>Upper 4</label> <div className="flex w-full items-center justify-between text-xs">
<input <label>Upper 4</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={upper4} 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"
onChange={(e) => handleInput(e.target.value, WASMData.limits.upper4, setUpper4)} value={upper4}
disabled={loadingState !== 'preview' || GSXActive()} onChange={(e) => handleInput(e.target.value, WASMData.limits.upper4, setUpper4)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between bg-zinc-600 p-2 px-4"> <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> <div className="flex w-full items-center justify-between text-xs">
<input <label>Forward Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={lowerForward} 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"
onChange={(e) => handleInput(e.target.value, WASMData.limits.lowerForward, setLowerForward)} value={lowerForward}
disabled={loadingState !== 'preview' || GSXActive()} onChange={(e) => handleInput(e.target.value, WASMData.limits.lowerForward, setLowerForward)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4"> <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> <div className="flex w-full items-center justify-between text-xs">
<input <label>Aft Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={lowerRear} 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"
onChange={(e) => handleInput(e.target.value, WASMData.limits.lowerRear, setLowerRear)} value={lowerRear}
disabled={loadingState !== 'preview' || GSXActive()} onChange={(e) => handleInput(e.target.value, WASMData.limits.lowerRear, setLowerRear)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
</div> </div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4"> <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"> <div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label> <div className="flex w-full items-center justify-between text-xs">
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW ( <label>
{WASMData.userData.isImperial ? 'lbs' : 'kg'}) {loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
</label> {WASMData.userData.isImperial ? 'lbs' : 'kg'})
<input </label>
type="text" <input
placeholder="" type="text"
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`} placeholder=""
disabled 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`}
value={ZFW()} disabled
/> value={ZFW()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4"> <div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label> <div className="flex w-full items-center justify-between text-xs">
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW ( <label>
{WASMData.userData.isImperial ? 'lbs' : 'kg'}) {loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
</label> {WASMData.userData.isImperial ? 'lbs' : 'kg'})
<input </label>
type="text" <input
placeholder="" type="text"
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`} placeholder=""
disabled 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`}
value={GW()} disabled
/> value={GW()}
/>
</div>
</div> </div>
</div> </div>
@ -208,7 +226,6 @@ const StationEntryF: FC<StationEntryProps> = ({ WASMData, loadingState, setLoadi
loadingState={loadingState} loadingState={loadingState}
loadDisabled={!ZFWValid() || !GWValid()} loadDisabled={!ZFWValid() || !GWValid()}
GSXSync={WASMData.options.GSXSync} GSXSync={WASMData.options.GSXSync}
GSXActive={GSXActive()}
load={() => { load={() => {
setLoadingState('loaded'); 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="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"> <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> <div className="flex w-full items-center justify-between text-xs">
<input <label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
type="text" <input
placeholder="" type="text"
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`} placeholder=""
value={fuel} className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
onChange={(e) => handleInput(e.target.value, WASMData.limits.maxFuel, setFuel)} value={fuel}
disabled={loadingState !== 'preview' || GSXActive()} 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" <button
data-ripple-light="true" 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"
onClick={() => { data-ripple-light="true"
SimVar.SetSimVarValue( onClick={() => {
'L:MD11_EFB_PAYLOAD_FUEL', SimVar.SetSimVarValue(
'lbs', 'L:MD11_EFB_PAYLOAD_FUEL',
WASMData.userData.isImperial ? fuel : fuel * 2.20462262185 'lbs',
); WASMData.userData.isImperial ? fuel : fuel * 2.20462262185
SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true); );
setFuelEnabled(WASMData.livePayload.fuel === fuel); SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true);
}} setFuelEnabled(WASMData.livePayload.fuel === fuel);
disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()} }}
> disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()}
Load Fuel >
</button> Load Fuel
</button>
</div>
</div> </div>
</div> </div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4"> <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"> <div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label>Business</label> <div className="flex w-full items-center justify-between text-xs">
<input <label>Business</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={business1} 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"
onChange={(e) => handleInput(e.target.value, WASMData.limits.business1, setBusiness1)} value={business1}
disabled={loadingState !== 'preview' || GSXActive()} onChange={(e) => handleInput(e.target.value, WASMData.limits.business1, setBusiness1)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4"> <div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4">
<label>Premium Economy</label> <div className="flex w-full items-center justify-between text-xs">
<input <label>Premium Economy</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={business2} 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"
onChange={(e) => handleInput(e.target.value, WASMData.limits.business2, setBusiness2)} value={business2}
disabled={loadingState !== 'preview' || GSXActive()} onChange={(e) => handleInput(e.target.value, WASMData.limits.business2, setBusiness2)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between bg-zinc-600 p-2 px-4"> <div className="relative flex w-full items-center justify-between bg-zinc-600 p-2 px-4">
<label>Forward Economy</label> <div className="flex w-full items-center justify-between text-xs">
<input <label>Forward Economy</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={economy1} 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"
onChange={(e) => handleInput(e.target.value, WASMData.limits.economy1, setEconomy1)} value={economy1}
disabled={loadingState !== 'preview' || GSXActive()} onChange={(e) => handleInput(e.target.value, WASMData.limits.economy1, setEconomy1)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4"> <div className="relative flex w-full items-center justify-between bg-zinc-700 p-2 px-4">
<label>Aft Economy</label> <div className="flex w-full items-center justify-between text-xs">
<input <label>Aft Economy</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={economy2} 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"
onChange={(e) => handleInput(e.target.value, WASMData.limits.economy2, setEconomy2)} value={economy2}
disabled={loadingState !== 'preview' || GSXActive()} onChange={(e) => handleInput(e.target.value, WASMData.limits.economy2, setEconomy2)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between bg-zinc-600 p-2 px-4"> <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> <div className="flex w-full items-center justify-between text-xs">
<input <label>Forward Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={forwardCargo} 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"
onChange={(e) => handleInput(e.target.value, WASMData.limits.forwardCargo, setForwardCargo)} value={forwardCargo}
disabled={loadingState !== 'preview' || GSXActive()} onChange={(e) => handleInput(e.target.value, WASMData.limits.forwardCargo, setForwardCargo)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4"> <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> <div className="flex w-full items-center justify-between text-xs">
<input <label>Aft Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={rearCargo} 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"
onChange={(e) => handleInput(e.target.value, WASMData.limits.rearCargo, setRearCargo)} value={rearCargo}
disabled={loadingState !== 'preview' || GSXActive()} onChange={(e) => handleInput(e.target.value, WASMData.limits.rearCargo, setRearCargo)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
</div> </div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4"> <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"> <div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label> <div className="flex w-full items-center justify-between text-xs">
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW ( <label>
{WASMData.userData.isImperial ? 'lbs' : 'kg'}) {loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
</label> {WASMData.userData.isImperial ? 'lbs' : 'kg'})
<input </label>
type="text" <input
placeholder="" type="text"
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`} placeholder=""
disabled 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`}
value={ZFW()} disabled
/> value={ZFW()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4"> <div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label> <div className="flex w-full items-center justify-between text-xs">
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW ( <label>
{WASMData.userData.isImperial ? 'lbs' : 'kg'}) {loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
</label> {WASMData.userData.isImperial ? 'lbs' : 'kg'})
<input </label>
type="text" <input
placeholder="" type="text"
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`} placeholder=""
disabled 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`}
value={GW()} disabled
/> value={GW()}
/>
</div>
</div> </div>
</div> </div>
@ -208,7 +226,6 @@ const StationEntryPax: FC<StationEntryProps> = ({ WASMData, loadingState, setLoa
loadingState={loadingState} loadingState={loadingState}
loadDisabled={!ZFWValid() || !GWValid()} loadDisabled={!ZFWValid() || !GWValid()}
GSXSync={WASMData.options.GSXSync} GSXSync={WASMData.options.GSXSync}
GSXActive={GSXActive()}
load={() => { load={() => {
setLoadingState('loaded'); 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="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"> <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> <div className="flex w-full items-center justify-between text-xs">
<input <label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
type="text" <input
placeholder="" type="text"
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`} placeholder=""
value={fuel} className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
onChange={(e) => handleInput(e.target.value, WASMData.limits.maxFuel, setFuel)} value={fuel}
disabled={loadingState !== 'preview' || GSXActive()} 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" <button
data-ripple-light="true" 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"
onClick={() => { data-ripple-light="true"
SimVar.SetSimVarValue( onClick={() => {
'L:MD11_EFB_PAYLOAD_FUEL', SimVar.SetSimVarValue(
'lbs', 'L:MD11_EFB_PAYLOAD_FUEL',
WASMData.userData.isImperial ? fuel : fuel * 2.20462262185 'lbs',
); WASMData.userData.isImperial ? fuel : fuel * 2.20462262185
SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true); );
setFuelEnabled(WASMData.livePayload.fuel === fuel); SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true);
}} setFuelEnabled(WASMData.livePayload.fuel === fuel);
disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()} }}
> disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()}
Load Fuel >
</button> Load Fuel
</button>
</div>
</div> </div>
</div> </div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4"> <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"> <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> <div className="flex w-full items-center justify-between text-xs">
<input <label>Target ZFW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={ZFWTarget} 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"
onChange={(e) => handleInputZFW(e.target.value)} value={ZFWTarget}
onBlur={(e) => handleBlur(e.target.value)} onChange={(e) => handleInputZFW(e.target.value)}
disabled={loadingState !== 'preview' || GSXActive()} onBlur={(e) => handleBlur(e.target.value)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4"> <div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label> <div className="flex w-full items-center justify-between text-xs">
Target ZFWCG ({WASMData.limits.minCG} - {WASMData.limits.maxCG}) <label>
</label> Target ZFWCG ({WASMData.limits.minCG} - {WASMData.limits.maxCG})
<CGSelect </label>
minCG={WASMData.limits.minCG} <CGSelect
maxCG={WASMData.limits.maxCG} minCG={WASMData.limits.minCG}
value={CGTarget} maxCG={WASMData.limits.maxCG}
disabled={loadingState !== 'preview' || GSXActive()} value={CGTarget}
increase={() => disabled={loadingState !== 'preview' || GSXActive()}
setCGTarget((prev) => { increase={() =>
const _new = prev + 0.1; setCGTarget((prev) => {
updateData(undefined, _new); const _new = prev + 0.1;
return _new; updateData(undefined, _new);
}) return _new;
} })
decrease={() => }
setCGTarget((prev) => { decrease={() =>
const _new = prev - 0.1; setCGTarget((prev) => {
updateData(undefined, _new); const _new = prev - 0.1;
return _new; updateData(undefined, _new);
}) return _new;
} })
/> }
/>
</div>
</div> </div>
</div> </div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4"> <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"> <div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label> <div className="flex w-full items-center justify-between text-xs">
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW ( <label>
{WASMData.userData.isImperial ? 'lbs' : 'kg'}) {loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
</label> {WASMData.userData.isImperial ? 'lbs' : 'kg'})
<input </label>
type="text" <input
placeholder="" type="text"
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`} placeholder=""
disabled 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`}
value={ZFW()} disabled
/> value={ZFW()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4"> <div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label> <div className="flex w-full items-center justify-between text-xs">
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW ( <label>
{WASMData.userData.isImperial ? 'lbs' : 'kg'}) {loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
</label> {WASMData.userData.isImperial ? 'lbs' : 'kg'})
<input </label>
type="text" <input
placeholder="" type="text"
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`} placeholder=""
disabled 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`}
value={GW()} disabled
/> value={GW()}
/>
</div>
</div> </div>
</div> </div>
@ -202,7 +212,6 @@ const ZFWEntryF: FC<ZFWEntryProps> = ({ WASMData, loadingState, setLoadingState
loadingState={loadingState} loadingState={loadingState}
loadDisabled={!GWValid()} loadDisabled={!GWValid()}
GSXSync={WASMData.options.GSXSync} GSXSync={WASMData.options.GSXSync}
GSXActive={GSXActive()}
load={() => { load={() => {
setLoadingState('loaded'); 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="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"> <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> <div className="flex w-full items-center justify-between text-xs">
<input <label>Fuel ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
type="text" <input
placeholder="" type="text"
className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`} placeholder=""
value={fuel} className={`w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right`}
onChange={(e) => handleInput(e.target.value, WASMData.limits.maxFuel, setFuel)} value={fuel}
disabled={loadingState !== 'preview' || GSXActive()} 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" <button
data-ripple-light="true" 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"
onClick={() => { data-ripple-light="true"
SimVar.SetSimVarValue( onClick={() => {
'L:MD11_EFB_PAYLOAD_FUEL', SimVar.SetSimVarValue(
'lbs', 'L:MD11_EFB_PAYLOAD_FUEL',
WASMData.userData.isImperial ? fuel : fuel * 2.20462262185 'lbs',
); WASMData.userData.isImperial ? fuel : fuel * 2.20462262185
SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true); );
setFuelEnabled(WASMData.livePayload.fuel === fuel); SimVar.SetSimVarValue('L:MD11_EFB_READ_READY', 'bool', true);
}} setFuelEnabled(WASMData.livePayload.fuel === fuel);
disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()} }}
> disabled={loadingState !== 'preview' || !fuelEnabled || GSXActive()}
Load Fuel >
</button> Load Fuel
</button>
</div>
</div> </div>
</div> </div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4"> <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"> <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> <div className="flex w-full items-center justify-between text-xs">
<input <label>Target ZFW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
type="text" <input
placeholder="" type="text"
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" placeholder=""
value={ZFWTarget} 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"
onChange={(e) => handleInputZFW(e.target.value)} value={ZFWTarget}
onBlur={(e) => handleBlur(e.target.value)} onChange={(e) => handleInputZFW(e.target.value)}
disabled={loadingState !== 'preview' || GSXActive()} onBlur={(e) => handleBlur(e.target.value)}
/> disabled={loadingState !== 'preview' || GSXActive()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4"> <div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label> <div className="flex w-full items-center justify-between text-xs">
Target ZFWCG ({WASMData.limits.minCG} - {WASMData.limits.maxCG}) <label>
</label> Target ZFWCG ({WASMData.limits.minCG} - {WASMData.limits.maxCG})
<CGSelect </label>
minCG={WASMData.limits.minCG} <CGSelect
maxCG={WASMData.limits.maxCG} minCG={WASMData.limits.minCG}
value={CGTarget} maxCG={WASMData.limits.maxCG}
disabled={loadingState !== 'preview' || GSXActive()} value={CGTarget}
increase={() => disabled={loadingState !== 'preview' || GSXActive()}
setCGTarget((prev) => { increase={() =>
const _new = prev + 0.1; setCGTarget((prev) => {
updateData(undefined, _new); const _new = prev + 0.1;
return _new; updateData(undefined, _new);
}) return _new;
} })
decrease={() => }
setCGTarget((prev) => { decrease={() =>
const _new = prev - 0.1; setCGTarget((prev) => {
updateData(undefined, _new); const _new = prev - 0.1;
return _new; updateData(undefined, _new);
}) return _new;
} })
/> }
/>
</div>
</div> </div>
</div> </div>
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4"> <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"> <div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<label> <div className="flex w-full items-center justify-between text-xs">
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW ( <label>
{WASMData.userData.isImperial ? 'lbs' : 'kg'}) {loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
</label> {WASMData.userData.isImperial ? 'lbs' : 'kg'})
<input </label>
type="text" <input
placeholder="" type="text"
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`} placeholder=""
disabled 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`}
value={ZFW()} disabled
/> value={ZFW()}
/>
</div>
</div> </div>
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4"> <div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<label> <div className="flex w-full items-center justify-between text-xs">
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW ( <label>
{WASMData.userData.isImperial ? 'lbs' : 'kg'}) {loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
</label> {WASMData.userData.isImperial ? 'lbs' : 'kg'})
<input </label>
type="text" <input
placeholder="" type="text"
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`} placeholder=""
disabled 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`}
value={GW()} disabled
/> value={GW()}
/>
</div>
</div> </div>
</div> </div>
@ -202,7 +212,6 @@ const ZFWEntryPax: FC<ZFWEntryProps> = ({ WASMData, loadingState, setLoadingStat
loadingState={loadingState} loadingState={loadingState}
loadDisabled={!GWValid()} loadDisabled={!GWValid()}
GSXSync={WASMData.options.GSXSync} GSXSync={WASMData.options.GSXSync}
GSXActive={GSXActive()}
load={() => { load={() => {
setLoadingState('loaded'); setLoadingState('loaded');

View File

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

View File

@ -10,10 +10,3 @@ Build in sim
- LAMM - LAMM
- https://www.satco-inc.com/product-pallet/?part_number=31086-595 - https://www.satco-inc.com/product-pallet/?part_number=31086-595
- https://www.satco-inc.com/product-container/?part_number=34124-901 - 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 fs = require("fs");
const util = require("node:util"); const util = require("node:util");
const exec = util.promisify(require("node:child_process").exec); const exec = util.promisify(require("node:child_process").exec);
const readline = require("readline");
const outFile = const outPath =
"./PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/TFDi_MD11_efb/efb.js"; "./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}) => { exec("git apply ./EFB/efb-js.patch").then(({ stdout, stderr }) => {
console.log("stdout:", stdout); console.log("Patches efb.js applied.");
console.error("stderr:", stderr); });
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.");
});
}); });