SB fetch and entry

This commit is contained in:
2025-06-11 23:49:35 +02:00
parent 896a459bba
commit 8975ea17af
11 changed files with 156 additions and 237 deletions
@@ -1,6 +1,8 @@
import { FC, useState } from 'react';
import { LoadingState } from '../../types/general';
import { WASMDataPax } from '../../types/WASMData';
import Profile from '../profile/Profile';
import SBEntryPax from '../SBEntry/SBEntryPax';
import StationEntryPax from '../stationEntry/StationEntryPax';
import Tabbar from '../tabbar/Tabbar';
import ZFWEntryPax from '../zfwEntry/ZFWEntryPax';
@@ -12,24 +14,24 @@ interface PaxProps {
const Pax: FC<PaxProps> = ({ WASMData, username }) => {
const [selectedTab, setSelectedTab] = useState(0);
const [loadingState, setLoadingState] = useState<'preview' | 'accepted' | 'loaded'>('preview');
const [loadingState, setLoadingState] = useState<LoadingState>('preview');
const upper1 = (overrideState: 'preview' | 'accepted' | 'loaded' = loadingState) => {
const upper1 = (overrideState: LoadingState = loadingState) => {
if (overrideState !== 'loaded') return WASMData.targetPayload.business1;
return WASMData.livePayload.business1;
};
const upper2 = (overrideState: 'preview' | 'accepted' | 'loaded' = loadingState) => {
const upper2 = (overrideState: LoadingState = loadingState) => {
if (overrideState !== 'loaded') return WASMData.targetPayload.business2;
return WASMData.livePayload.business2;
};
const upper3 = (overrideState: 'preview' | 'accepted' | 'loaded' = loadingState) => {
const upper3 = (overrideState: LoadingState = loadingState) => {
if (overrideState !== 'loaded') return WASMData.targetPayload.economy1;
return WASMData.livePayload.economy1;
};
const upper4 = (overrideState: 'preview' | 'accepted' | 'loaded' = loadingState) => {
const upper4 = (overrideState: LoadingState = loadingState) => {
if (overrideState !== 'loaded') return WASMData.targetPayload.economy2;
return WASMData.livePayload.economy2;
@@ -101,28 +103,17 @@ const Pax: FC<PaxProps> = ({ WASMData, username }) => {
selectedTab={selectedTab}
setSelectedTab={setSelectedTab}
/>
{/*
{username && selectedTab === 0 && (
<SBEntryPax
unit={unit}
isER={isER}
initialPayload={payload}
fuelLive={fuelLive}
payloadLive={payloadLive}
WASMData={WASMData}
loadingState={loadingState}
username={username}
setLoadingState={setLoadingState}
updateView={(_payload) => {
setPayload(_payload);
}}
loadAircraft={() => {
PaxConfig.setBaseWeight(unit, isER);
PaxConfig.setWeights(payload, unit);
console.log('SET WEIGHT SB');
}}
/>
)}
*/}
{((username && selectedTab === 1) || (!username && selectedTab === 0)) && (
<ZFWEntryPax
WASMData={WASMData}