SB fetch and entry
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import { FC, StrictMode, useCallback, useEffect, useState } from 'react';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import Pax from './components/pax/Pax';
|
||||
import { COHERENT_COMBUS_WASM_CALL, COMM_BUS_LIVE_DATA_EVENT, TFDI_SIMBRIEF_USERNAME_EVENT } from './constants';
|
||||
import {
|
||||
COHERENT_COMBUS_WASM_CALL,
|
||||
COMM_BUS_LIVE_DATA_EVENT,
|
||||
TFDI_SIMBRIEF_USERNAME_CALL,
|
||||
TFDI_SIMBRIEF_USERNAME_EVENT,
|
||||
} from './constants';
|
||||
import { WASMDataPax } from './types/WASMData';
|
||||
|
||||
interface IAppProps {
|
||||
@@ -23,35 +28,33 @@ const App: FC<IAppProps> = ({ commBus }) => {
|
||||
useEffect(() => {
|
||||
console.log('Initializing CommBus');
|
||||
|
||||
commBus.on(COMM_BUS_LIVE_DATA_EVENT, usernameCallback);
|
||||
commBus.on(TFDI_SIMBRIEF_USERNAME_EVENT, usernameCallback);
|
||||
commBus.on(COMM_BUS_LIVE_DATA_EVENT, wasmCallback);
|
||||
|
||||
setTimeout(() => {
|
||||
Coherent.call(COHERENT_COMBUS_WASM_CALL, TFDI_SIMBRIEF_USERNAME_EVENT, 'null');
|
||||
Coherent.call(COHERENT_COMBUS_WASM_CALL, TFDI_SIMBRIEF_USERNAME_CALL, 'null');
|
||||
}, 1000);
|
||||
|
||||
return () => {
|
||||
commBus.off('receiveSimBriefUsername', usernameCallback);
|
||||
commBus.off(TFDI_SIMBRIEF_USERNAME_EVENT, usernameCallback);
|
||||
commBus.off(COMM_BUS_LIVE_DATA_EVENT, wasmCallback);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<StrictMode>
|
||||
<div className="flex w-full justify-center pt-2 bg-zinc-900">
|
||||
<div className="flex w-3/4 flex-col items-center">
|
||||
{isReady && WASMData ? (
|
||||
WASMData.userData.isCargo ? (
|
||||
<>Not yet Implemented</>
|
||||
) : (
|
||||
<Pax WASMData={WASMData} username={SBUsername} />
|
||||
)
|
||||
<div className="flex w-full justify-center pt-2 bg-zinc-900">
|
||||
<div className="flex w-3/4 flex-col items-center">
|
||||
{isReady && WASMData ? (
|
||||
WASMData.userData.isCargo ? (
|
||||
<>Not yet Implemented</>
|
||||
) : (
|
||||
<h1 className="text-sm font-medium">LOADING</h1>
|
||||
)}
|
||||
</div>
|
||||
<Pax WASMData={WASMData} username={SBUsername} />
|
||||
)
|
||||
) : (
|
||||
<h1 className="text-sm font-medium">LOADING</h1>
|
||||
)}
|
||||
</div>
|
||||
</StrictMode>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user