Skip to content

Commit

Permalink
fix(efb): Fuel Page Airframe request
Browse files Browse the repository at this point in the history
  • Loading branch information
masterrob94 committed Feb 13, 2024
1 parent e454050 commit f73b432
Show file tree
Hide file tree
Showing 9 changed files with 349 additions and 4 deletions.
85 changes: 85 additions & 0 deletions hsim-a318ceo/src/systems/instruments/buildSrc/plugins.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright (c) 2022 FlyByWire Simulations
// SPDX-License-Identifier: GPL-3.0

import fs from 'fs';
import { join } from 'path';
import image from '@rollup/plugin-image';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { babel as babelPlugin } from '@rollup/plugin-babel';
import { typescriptPaths } from 'rollup-plugin-typescript-paths';
import replace from '@rollup/plugin-replace';
import postcss from 'rollup-plugin-postcss';
import tailwindcss from 'tailwindcss';
import dotenv from 'dotenv';
import json from '@rollup/plugin-json';
import postcssColorFunctionalNotation from 'postcss-color-functional-notation';
import { Directories } from './directories.mjs';

const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs'];

dotenv.config();

function babel() {
return babelPlugin({
presets: [
['@babel/preset-env', { targets: { safari: '11' } }],
['@babel/preset-react', { runtime: 'automatic', throwIfNamespace: false }],
['@babel/preset-typescript'],
],
plugins: [
'@babel/plugin-proposal-class-properties',
['@babel/plugin-transform-runtime', { regenerator: true }],
],
babelHelpers: 'runtime',
compact: false,
extensions,
});
}

function postCss(_, instrumentFolder) {
let plugins;

const tailwindConfigPath = join(Directories.instruments, 'src', instrumentFolder, 'tailwind.config.js');

if (fs.existsSync(tailwindConfigPath)) {
plugins = [
tailwindcss(tailwindConfigPath),
];
} else {
plugins = [];
}

plugins.push(postcssColorFunctionalNotation());

return postcss({
use: { sass: {} },
plugins,
extract: 'bundle.css',
});
}

export function baseCompile(instrumentName, instrumentFolder) {
return [
image(),
nodeResolve({ extensions, browser: true }),
json(),
commonjs({ include: /node_modules/ }),
babel(),
typescriptPaths({
tsConfigPath: join(Directories.src, 'tsconfig.json'),
preserveExtensions: true,
}),
replace({
'DEBUG': 'false',
'preventAssignment': true,
'process.env.VITE_BUILD': 'false',
'process.env.NODE_ENV': JSON.stringify('production'),
'process.env.CLIENT_ID': JSON.stringify(process.env.CLIENT_ID),
'process.env.CLIENT_SECRET': JSON.stringify(process.env.CLIENT_SECRET),
'process.env.CHARTFOX_SECRET': JSON.stringify(process.env.CHARTFOX_SECRET),
'process.env.SENTRY_DSN': JSON.stringify(process.env.SENTRY_DSN),
}),
postCss(instrumentName, instrumentFolder),
];
}
2 changes: 1 addition & 1 deletion hsim-a318ceo/src/systems/instruments/src/ND/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"index": "./index.tsx",
"index": "./instrument.tsx",
"isInteractive": false,
"extraDeps": [
"fbw-common/src/systems/instruments/src/ND"
Expand Down
85 changes: 85 additions & 0 deletions hsim-a319ceo/src/systems/instruments/buildSrc/plugins.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright (c) 2022 FlyByWire Simulations
// SPDX-License-Identifier: GPL-3.0

import fs from 'fs';
import { join } from 'path';
import image from '@rollup/plugin-image';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { babel as babelPlugin } from '@rollup/plugin-babel';
import { typescriptPaths } from 'rollup-plugin-typescript-paths';
import replace from '@rollup/plugin-replace';
import postcss from 'rollup-plugin-postcss';
import tailwindcss from 'tailwindcss';
import dotenv from 'dotenv';
import json from '@rollup/plugin-json';
import postcssColorFunctionalNotation from 'postcss-color-functional-notation';
import { Directories } from './directories.mjs';

const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs'];

dotenv.config();

function babel() {
return babelPlugin({
presets: [
['@babel/preset-env', { targets: { safari: '11' } }],
['@babel/preset-react', { runtime: 'automatic', throwIfNamespace: false }],
['@babel/preset-typescript'],
],
plugins: [
'@babel/plugin-proposal-class-properties',
['@babel/plugin-transform-runtime', { regenerator: true }],
],
babelHelpers: 'runtime',
compact: false,
extensions,
});
}

function postCss(_, instrumentFolder) {
let plugins;

const tailwindConfigPath = join(Directories.instruments, 'src', instrumentFolder, 'tailwind.config.js');

if (fs.existsSync(tailwindConfigPath)) {
plugins = [
tailwindcss(tailwindConfigPath),
];
} else {
plugins = [];
}

plugins.push(postcssColorFunctionalNotation());

return postcss({
use: { sass: {} },
plugins,
extract: 'bundle.css',
});
}

export function baseCompile(instrumentName, instrumentFolder) {
return [
image(),
nodeResolve({ extensions, browser: true }),
json(),
commonjs({ include: /node_modules/ }),
babel(),
typescriptPaths({
tsConfigPath: join(Directories.src, 'tsconfig.json'),
preserveExtensions: true,
}),
replace({
'DEBUG': 'false',
'preventAssignment': true,
'process.env.VITE_BUILD': 'false',
'process.env.NODE_ENV': JSON.stringify('production'),
'process.env.CLIENT_ID': JSON.stringify(process.env.CLIENT_ID),
'process.env.CLIENT_SECRET': JSON.stringify(process.env.CLIENT_SECRET),
'process.env.CHARTFOX_SECRET': JSON.stringify(process.env.CHARTFOX_SECRET),
'process.env.SENTRY_DSN': JSON.stringify(process.env.SENTRY_DSN),
}),
postCss(instrumentName, instrumentFolder),
];
}
2 changes: 1 addition & 1 deletion hsim-a319ceo/src/systems/instruments/src/ND/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"index": "./index.tsx",
"index": "./instrument.tsx",
"isInteractive": false,
"extraDeps": [
"fbw-common/src/systems/instruments/src/ND"
Expand Down
85 changes: 85 additions & 0 deletions hsim-a320ceo/src/systems/instruments/buildSrc/plugins.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright (c) 2022 FlyByWire Simulations
// SPDX-License-Identifier: GPL-3.0

import fs from 'fs';
import { join } from 'path';
import image from '@rollup/plugin-image';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { babel as babelPlugin } from '@rollup/plugin-babel';
import { typescriptPaths } from 'rollup-plugin-typescript-paths';
import replace from '@rollup/plugin-replace';
import postcss from 'rollup-plugin-postcss';
import tailwindcss from 'tailwindcss';
import dotenv from 'dotenv';
import json from '@rollup/plugin-json';
import postcssColorFunctionalNotation from 'postcss-color-functional-notation';
import { Directories } from './directories.mjs';

const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs'];

dotenv.config();

function babel() {
return babelPlugin({
presets: [
['@babel/preset-env', { targets: { safari: '11' } }],
['@babel/preset-react', { runtime: 'automatic', throwIfNamespace: false }],
['@babel/preset-typescript'],
],
plugins: [
'@babel/plugin-proposal-class-properties',
['@babel/plugin-transform-runtime', { regenerator: true }],
],
babelHelpers: 'runtime',
compact: false,
extensions,
});
}

function postCss(_, instrumentFolder) {
let plugins;

const tailwindConfigPath = join(Directories.instruments, 'src', instrumentFolder, 'tailwind.config.js');

if (fs.existsSync(tailwindConfigPath)) {
plugins = [
tailwindcss(tailwindConfigPath),
];
} else {
plugins = [];
}

plugins.push(postcssColorFunctionalNotation());

return postcss({
use: { sass: {} },
plugins,
extract: 'bundle.css',
});
}

export function baseCompile(instrumentName, instrumentFolder) {
return [
image(),
nodeResolve({ extensions, browser: true }),
json(),
commonjs({ include: /node_modules/ }),
babel(),
typescriptPaths({
tsConfigPath: join(Directories.src, 'tsconfig.json'),
preserveExtensions: true,
}),
replace({
'DEBUG': 'false',
'preventAssignment': true,
'process.env.VITE_BUILD': 'false',
'process.env.NODE_ENV': JSON.stringify('production'),
'process.env.CLIENT_ID': JSON.stringify(process.env.CLIENT_ID),
'process.env.CLIENT_SECRET': JSON.stringify(process.env.CLIENT_SECRET),
'process.env.CHARTFOX_SECRET': JSON.stringify(process.env.CHARTFOX_SECRET),
'process.env.SENTRY_DSN': JSON.stringify(process.env.SENTRY_DSN),
}),
postCss(instrumentName, instrumentFolder),
];
}
2 changes: 1 addition & 1 deletion hsim-a320ceo/src/systems/instruments/src/ND/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"index": "./index.tsx",
"index": "./instrument.tsx",
"isInteractive": false,
"extraDeps": [
"fbw-common/src/systems/instruments/src/ND"
Expand Down
85 changes: 85 additions & 0 deletions hsim-a321neo/src/systems/instruments/buildSrc/plugins.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright (c) 2022 FlyByWire Simulations
// SPDX-License-Identifier: GPL-3.0

import fs from 'fs';
import { join } from 'path';
import image from '@rollup/plugin-image';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { babel as babelPlugin } from '@rollup/plugin-babel';
import { typescriptPaths } from 'rollup-plugin-typescript-paths';
import replace from '@rollup/plugin-replace';
import postcss from 'rollup-plugin-postcss';
import tailwindcss from 'tailwindcss';
import dotenv from 'dotenv';
import json from '@rollup/plugin-json';
import postcssColorFunctionalNotation from 'postcss-color-functional-notation';
import { Directories } from './directories.mjs';

const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs'];

dotenv.config();

function babel() {
return babelPlugin({
presets: [
['@babel/preset-env', { targets: { safari: '11' } }],
['@babel/preset-react', { runtime: 'automatic', throwIfNamespace: false }],
['@babel/preset-typescript'],
],
plugins: [
'@babel/plugin-proposal-class-properties',
['@babel/plugin-transform-runtime', { regenerator: true }],
],
babelHelpers: 'runtime',
compact: false,
extensions,
});
}

function postCss(_, instrumentFolder) {
let plugins;

const tailwindConfigPath = join(Directories.instruments, 'src', instrumentFolder, 'tailwind.config.js');

if (fs.existsSync(tailwindConfigPath)) {
plugins = [
tailwindcss(tailwindConfigPath),
];
} else {
plugins = [];
}

plugins.push(postcssColorFunctionalNotation());

return postcss({
use: { sass: {} },
plugins,
extract: 'bundle.css',
});
}

export function baseCompile(instrumentName, instrumentFolder) {
return [
image(),
nodeResolve({ extensions, browser: true }),
json(),
commonjs({ include: /node_modules/ }),
babel(),
typescriptPaths({
tsConfigPath: join(Directories.src, 'tsconfig.json'),
preserveExtensions: true,
}),
replace({
'DEBUG': 'false',
'preventAssignment': true,
'process.env.VITE_BUILD': 'false',
'process.env.NODE_ENV': JSON.stringify('production'),
'process.env.CLIENT_ID': JSON.stringify(process.env.CLIENT_ID),
'process.env.CLIENT_SECRET': JSON.stringify(process.env.CLIENT_SECRET),
'process.env.CHARTFOX_SECRET': JSON.stringify(process.env.CHARTFOX_SECRET),
'process.env.SENTRY_DSN': JSON.stringify(process.env.SENTRY_DSN),
}),
postCss(instrumentName, instrumentFolder),
];
}
2 changes: 1 addition & 1 deletion hsim-a321neo/src/systems/instruments/src/ND/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"index": "./index.tsx",
"index": "./instrument.tsx",
"isInteractive": false,
"extraDeps": [
"fbw-common/src/systems/instruments/src/ND"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/* eslint-disable max-len */
import React, { useState } from 'react';
import { getAirframeType } from '../../Efb';
import { Fuel } from './Fuel/Constants'
import { round } from 'lodash';
import { CloudArrowDown, PlayFill, StopCircleFill } from 'react-bootstrap-icons';
import { useSimVar, Units, usePersistentNumberProperty, usePersistentProperty } from '@flybywiresim/fbw-sdk';
Expand Down Expand Up @@ -164,6 +166,9 @@ export const FuelPage = () => {
const formatRefuelStatusClass = () => {
if (airplaneCanRefuel()) {
if (round(totalTarget) === totalCurrentGallon() || !refuelStartedByUser) {
if (refuelStartedByUser) {
setRefuelStartedByUser(false);
}
return 'text-theme-highlight';
}
return ((totalTarget) > (totalCurrentGallon())) ? 'text-green-500' : 'text-yellow-500';
Expand Down

0 comments on commit f73b432

Please sign in to comment.