Base
This commit is contained in:
parent
80cb726501
commit
93c7815d96
@ -0,0 +1,11 @@
|
|||||||
|
<script type="text/html" id="TFDi_MD11_efb">
|
||||||
|
<div id="MSFS_REACT_MOUNT">
|
||||||
|
<h1>If you're seeing this, instrument didn't load.</h1>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/Pages/VCockpit/Instruments/aircraft_efb/TFDi_MD11_efb/efb.css" />
|
||||||
|
<link rel="stylesheet" href="/Pages/VCockpit/Instruments/aircraft_efb/TFDi_MD11_efb/index.css" />
|
||||||
|
<script type="text/html" import-script="/Pages/VCockpit/Instruments/aircraft_efb/TFDi_MD11_efb/efb.js" import-async="false"></script>
|
||||||
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tfdidesign-md11-load-manager",
|
"name": "tfdidesign-md11-load-manager",
|
||||||
"version": "0.1.22",
|
"version": "0.1.28",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@ -14,7 +14,9 @@ import svgs from 'svg-slim';
|
|||||||
|
|
||||||
const { NODE_ENV: targetEnv = 'development' } = process.env;
|
const { NODE_ENV: targetEnv = 'development' } = process.env;
|
||||||
const outDirBase = '../html_ui';
|
const outDirBase = '../html_ui';
|
||||||
const panelDirBase = `${outDirBase}/InGamePanels/tfdidesign-md11-load-manager-panel`;
|
const panelDirBaseNorm = `${outDirBase}/InGamePanels/tfdidesign-md11-load-manager-panel`;
|
||||||
|
const panelDirBaseSplit = `${outDirBase}/Pages/VCockpit/Instruments/aircraft_efb/TFDi_MD11_efb`;
|
||||||
|
const panelDirBase = process.env.SPLIT ? panelDirBaseSplit : panelDirBaseNorm;
|
||||||
|
|
||||||
function svgSlim(code, id) {
|
function svgSlim(code, id) {
|
||||||
if (!id.endsWith('.svg')) return code;
|
if (!id.endsWith('.svg')) return code;
|
||||||
|
|||||||
@ -9,11 +9,7 @@ import {
|
|||||||
} from './constants';
|
} from './constants';
|
||||||
import { WASMDataF, WASMDataPax } from './types/WASMData';
|
import { WASMDataF, WASMDataPax } from './types/WASMData';
|
||||||
|
|
||||||
interface IAppProps {
|
const App: FC = () => {
|
||||||
commBus: ViewListener.ViewListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
const App: FC<IAppProps> = ({ commBus }) => {
|
|
||||||
const [SBUsername, setSBUsername] = useState<string>();
|
const [SBUsername, setSBUsername] = useState<string>();
|
||||||
const [WASMData, setWASMData] = useState<WASMDataPax | WASMDataF>();
|
const [WASMData, setWASMData] = useState<WASMDataPax | WASMDataF>();
|
||||||
const [isReady, setIsReady] = useState(false);
|
const [isReady, setIsReady] = useState(false);
|
||||||
@ -29,6 +25,8 @@ const App: FC<IAppProps> = ({ commBus }) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('Initializing CommBus');
|
console.log('Initializing CommBus');
|
||||||
|
|
||||||
|
const commBus = RegisterViewListener('JS_LISTENER_COMM_BUS');
|
||||||
|
|
||||||
commBus.on(TFDI_SIMBRIEF_USERNAME_EVENT, usernameCallback);
|
commBus.on(TFDI_SIMBRIEF_USERNAME_EVENT, usernameCallback);
|
||||||
commBus.on(COMM_BUS_LIVE_DATA_EVENT, wasmCallback);
|
commBus.on(COMM_BUS_LIVE_DATA_EVENT, wasmCallback);
|
||||||
|
|
||||||
@ -39,6 +37,8 @@ const App: FC<IAppProps> = ({ commBus }) => {
|
|||||||
return () => {
|
return () => {
|
||||||
commBus.off(TFDI_SIMBRIEF_USERNAME_EVENT, usernameCallback);
|
commBus.off(TFDI_SIMBRIEF_USERNAME_EVENT, usernameCallback);
|
||||||
commBus.off(COMM_BUS_LIVE_DATA_EVENT, wasmCallback);
|
commBus.off(COMM_BUS_LIVE_DATA_EVENT, wasmCallback);
|
||||||
|
|
||||||
|
commBus.unregister();
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { FC, useEffect, useState } from 'react';
|
|||||||
import { GSX_SERVICE_CALLED, GSX_SERVICE_FINISHED } from '../../constants';
|
import { GSX_SERVICE_CALLED, GSX_SERVICE_FINISHED } from '../../constants';
|
||||||
import { WASMDataF } from '../../types/WASMData';
|
import { WASMDataF } from '../../types/WASMData';
|
||||||
import { LoadingState, SimBrief } from '../../types/general';
|
import { LoadingState, SimBrief } from '../../types/general';
|
||||||
import { ImportFlightPlan } from '../../utils/TFDISBImport';
|
import { ImportFlightPlanKH } from '../../utils/TFDISBImport';
|
||||||
import { CoherentCallSBEntryF, inRangeOf, loadAircraft, unloadAircraft } from '../../utils/utils';
|
import { CoherentCallSBEntryF, inRangeOf, loadAircraft, unloadAircraft } from '../../utils/utils';
|
||||||
import CGSelect from '../CGSelect/CGSelect';
|
import CGSelect from '../CGSelect/CGSelect';
|
||||||
import ActionBar from '../actionbar/ActionBar';
|
import ActionBar from '../actionbar/ActionBar';
|
||||||
@ -59,7 +59,7 @@ const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoadi
|
|||||||
const handleSB = async () => {
|
const handleSB = async () => {
|
||||||
setSBInFlight(true);
|
setSBInFlight(true);
|
||||||
|
|
||||||
const SBResponse = await ImportFlightPlan(
|
const SBResponse = await ImportFlightPlanKH(
|
||||||
username,
|
username,
|
||||||
WASMData.limits.maxZFW,
|
WASMData.limits.maxZFW,
|
||||||
WASMData.limits.maxTOW,
|
WASMData.limits.maxTOW,
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { FC, useEffect, useState } from 'react';
|
|||||||
import { GSX_SERVICE_CALLED, GSX_SERVICE_FINISHED } from '../../constants';
|
import { GSX_SERVICE_CALLED, GSX_SERVICE_FINISHED } from '../../constants';
|
||||||
import { WASMDataPax } from '../../types/WASMData';
|
import { WASMDataPax } from '../../types/WASMData';
|
||||||
import { LoadingState, SimBrief } from '../../types/general';
|
import { LoadingState, SimBrief } from '../../types/general';
|
||||||
import { ImportFlightPlan } from '../../utils/TFDISBImport';
|
import { ImportFlightPlanKH } from '../../utils/TFDISBImport';
|
||||||
import { CoherentCallSBEntryPax, inRangeOf, loadAircraft, unloadAircraft } from '../../utils/utils';
|
import { CoherentCallSBEntryPax, inRangeOf, loadAircraft, unloadAircraft } from '../../utils/utils';
|
||||||
import CGSelect from '../CGSelect/CGSelect';
|
import CGSelect from '../CGSelect/CGSelect';
|
||||||
import ActionBar from '../actionbar/ActionBar';
|
import ActionBar from '../actionbar/ActionBar';
|
||||||
@ -59,7 +59,7 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoa
|
|||||||
const handleSB = async () => {
|
const handleSB = async () => {
|
||||||
setSBInFlight(true);
|
setSBInFlight(true);
|
||||||
|
|
||||||
const SBResponse = await ImportFlightPlan(
|
const SBResponse = await ImportFlightPlanKH(
|
||||||
username,
|
username,
|
||||||
WASMData.limits.maxZFW,
|
WASMData.limits.maxZFW,
|
||||||
WASMData.limits.maxTOW,
|
WASMData.limits.maxTOW,
|
||||||
|
|||||||
@ -3,8 +3,6 @@ import { createRoot } from 'react-dom/client';
|
|||||||
import App from './App';
|
import App from './App';
|
||||||
|
|
||||||
class TFDiDesignMD11LoadManagerPanel extends TemplateElement {
|
class TFDiDesignMD11LoadManagerPanel extends TemplateElement {
|
||||||
private commBus: ViewListener.ViewListener | undefined;
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@ -12,20 +10,16 @@ class TFDiDesignMD11LoadManagerPanel extends TemplateElement {
|
|||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
|
|
||||||
this.commBus = RegisterViewListener('JS_LISTENER_COMM_BUS');
|
|
||||||
|
|
||||||
const container = document.getElementById('react');
|
const container = document.getElementById('react');
|
||||||
if (container) {
|
if (container) {
|
||||||
console.log('Starting React');
|
console.log('Starting React');
|
||||||
const root = createRoot(container);
|
const root = createRoot(container);
|
||||||
root.render(createElement(App, { commBus: this.commBus }));
|
root.render(createElement(App));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
super.disconnectedCallback();
|
super.disconnectedCallback();
|
||||||
|
|
||||||
this.commBus?.unregister();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
const getSimBriefFlightPlan = async (simBriefUsername: string) => {
|
const getSimBriefFlightPlanKH = async (simBriefUsername: string) => {
|
||||||
const flightPlanURL = `https://www.simbrief.com/api/xml.fetcher.php?username=${simBriefUsername}&json=1`;
|
const flightPlanURL = `https://www.simbrief.com/api/xml.fetcher.php?username=${simBriefUsername}&json=1`;
|
||||||
let response: Response;
|
let response: Response;
|
||||||
let success = false;
|
let success = false;
|
||||||
@ -15,14 +15,14 @@ const getSimBriefFlightPlan = async (simBriefUsername: string) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ImportFlightPlan = async (
|
export const ImportFlightPlanKH = async (
|
||||||
username: string,
|
username: string,
|
||||||
maxZFW: number,
|
maxZFW: number,
|
||||||
maxTOW: number,
|
maxTOW: number,
|
||||||
maxFuel: number,
|
maxFuel: number,
|
||||||
isImperial: boolean
|
isImperial: boolean
|
||||||
) => {
|
) => {
|
||||||
const flightPlan = await getSimBriefFlightPlan(username);
|
const flightPlan = await getSimBriefFlightPlanKH(username);
|
||||||
if (!flightPlan.success) {
|
if (!flightPlan.success) {
|
||||||
return {
|
return {
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
|
|
||||||
/* Language and Environment */
|
/* Language and Environment */
|
||||||
"target": "es6",
|
"target": "es2017",
|
||||||
/* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
/* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||||
"lib": ["es2017", "dom"],
|
"lib": ["es2017", "dom"],
|
||||||
/* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
/* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||||
@ -29,7 +29,7 @@
|
|||||||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||||
|
|
||||||
/* Modules */
|
/* Modules */
|
||||||
"module": "es6",
|
"module": "es2015",
|
||||||
/* Specify what module code is generated. */
|
/* Specify what module code is generated. */
|
||||||
// "rootDir": "./", /* Specify the root folder within your source files. */
|
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
@ -65,7 +65,7 @@
|
|||||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||||
"outDir": "../html_ui/InGamePanels/tfdidesign-md11-load-manager-panel",
|
// "outDir": "../html_ui/InGamePanels/tfdidesign-md11-load-manager-panel",
|
||||||
/* Specify an output folder for all emitted files. */
|
/* Specify an output folder for all emitted files. */
|
||||||
// "removeComments": true, /* Disable emitting comments. */
|
// "removeComments": true, /* Disable emitting comments. */
|
||||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||||
|
|||||||
1
PackageSources/js-bundle/tsconfig.tsbuildinfo
Normal file
1
PackageSources/js-bundle/tsconfig.tsbuildinfo
Normal file
File diff suppressed because one or more lines are too long
10
README.md
10
README.md
@ -13,9 +13,7 @@ Build in sim
|
|||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
|
|
||||||
- EFB integration (BRANCH)
|
- Fix duplicate names
|
||||||
- Check if including bundle is getting loaded
|
- Fix SB import (move to TFDi function proper)
|
||||||
- Add to bundle global scoped react "import"
|
- Adj. Dispatch page to navigate to Payload page
|
||||||
- Automate this?
|
- TEST
|
||||||
- Add to EFB.js and EFB.html
|
|
||||||
- Automate this?
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user