Try two
This commit is contained in:
@@ -20,6 +20,9 @@ const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoadi
|
||||
const [fuelEnabled, setFuelEnabled] = useState(true);
|
||||
const [SBInFlight, setSBInFlight] = useState(false);
|
||||
|
||||
// FROM EFB
|
||||
const simBrief = useSelector((state) => state.simbrief);
|
||||
|
||||
const ZFW = () => {
|
||||
if (loadingState !== 'loaded' && !GSXActive()) return Math.round(WASMData.targetPayload.total);
|
||||
|
||||
@@ -60,7 +63,7 @@ const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoadi
|
||||
setSBInFlight(true);
|
||||
|
||||
const SBResponse = await ImportFlightPlanKH(
|
||||
username,
|
||||
simBrief,
|
||||
WASMData.limits.maxZFW,
|
||||
WASMData.limits.maxTOW,
|
||||
WASMData.limits.maxFuel,
|
||||
@@ -74,7 +77,7 @@ const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoadi
|
||||
|
||||
updateData(undefined, SBResponse.message);
|
||||
|
||||
setFuel(parseFloat(SBResponse.message.fuel) ?? 0);
|
||||
setFuel(parseFloat(SBResponse.message.fuel as unknown as string) ?? 0);
|
||||
setSBInFlight(false);
|
||||
};
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoa
|
||||
const [fuelEnabled, setFuelEnabled] = useState(true);
|
||||
const [SBInFlight, setSBInFlight] = useState(false);
|
||||
|
||||
// FROM EFB
|
||||
const simBrief = useSelector((state) => state.simbrief);
|
||||
|
||||
const ZFW = () => {
|
||||
if (loadingState !== 'loaded' && !GSXActive()) return Math.round(WASMData.targetPayload.total);
|
||||
|
||||
@@ -60,7 +63,7 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoa
|
||||
setSBInFlight(true);
|
||||
|
||||
const SBResponse = await ImportFlightPlanKH(
|
||||
username,
|
||||
simBrief,
|
||||
WASMData.limits.maxZFW,
|
||||
WASMData.limits.maxTOW,
|
||||
WASMData.limits.maxFuel,
|
||||
@@ -74,7 +77,7 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoa
|
||||
|
||||
updateData(undefined, SBResponse.message);
|
||||
|
||||
setFuel(parseFloat(SBResponse.message.fuel) ?? 0);
|
||||
setFuel(parseFloat(SBResponse.message.fuel as unknown as string) ?? 0);
|
||||
setSBInFlight(false);
|
||||
};
|
||||
|
||||
@@ -97,32 +100,34 @@ 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="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">
|
||||
<div className="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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { GSX_SERVICE_CALLED, GSX_SERVICE_FINISHED } from '../../constants';
|
||||
import { LoadingState } from '../../types/general';
|
||||
import { WASMDataF } from '../../types/WASMData';
|
||||
import { CoherentCallOptionsSet } from '../../utils/utils';
|
||||
import ToggleComponent from '../toggleComponent/ToggleComponent';
|
||||
import ToggleComponentKH from '../toggleComponent/ToggleComponent';
|
||||
|
||||
interface OptionsFProps {
|
||||
WASMData: WASMDataF;
|
||||
@@ -22,7 +22,7 @@ const OptionsF: FC<OptionsFProps> = ({ 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-md bg-zinc-600 p-2 px-4">
|
||||
<ToggleComponent
|
||||
<ToggleComponentKH
|
||||
optionName="GSX Sync"
|
||||
value={WASMData.options.GSXSync}
|
||||
leftLabel={{ value: true }}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { GSX_SERVICE_CALLED, GSX_SERVICE_FINISHED } from '../../constants';
|
||||
import { LoadingState } from '../../types/general';
|
||||
import { WASMDataPax } from '../../types/WASMData';
|
||||
import { CoherentCallOptionsSet } from '../../utils/utils';
|
||||
import ToggleComponent from '../toggleComponent/ToggleComponent';
|
||||
import ToggleComponentKH from '../toggleComponent/ToggleComponent';
|
||||
|
||||
interface OptionsPaxProps {
|
||||
WASMData: WASMDataPax;
|
||||
@@ -45,7 +45,7 @@ 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-md bg-zinc-600 p-2 px-4">
|
||||
<ToggleComponent
|
||||
<ToggleComponentKH
|
||||
optionName="GSX Sync"
|
||||
value={WASMData.options.GSXSync}
|
||||
leftLabel={{ value: true }}
|
||||
|
||||
@@ -14,7 +14,7 @@ interface ToggleComponentProps<T> {
|
||||
setValue: (value: T) => void;
|
||||
}
|
||||
|
||||
const ToggleComponent = <T,>({
|
||||
const ToggleComponentKH = <T,>({
|
||||
optionName,
|
||||
value,
|
||||
leftLabel,
|
||||
@@ -48,4 +48,4 @@ const ToggleComponent = <T,>({
|
||||
);
|
||||
};
|
||||
|
||||
export default ToggleComponent;
|
||||
export default ToggleComponentKH;
|
||||
|
||||
Reference in New Issue
Block a user