Skip to content

Commit

Permalink
fix: eslint changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Revyn112 committed Dec 14, 2023
1 parent d608a6f commit e85cdc6
Show file tree
Hide file tree
Showing 80 changed files with 2,521 additions and 2,598 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"editor.formatOnSave": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
Expand Down
1,271 changes: 580 additions & 691 deletions hdw-a333x/src/systems/instruments/src/EFB/Assets/NoseOutline.tsx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ interface InformationEntryProps {
}

const InformationEntry = ({ title, info }: InformationEntryProps) => (
<div className="justify-content flex w-full flex-col items-center">
<h3 className="text-center font-light">{title}</h3>
<div className="flex flex-col items-center w-full justify-content">
<h3 className="font-light text-center">{title}</h3>
<h2 className="font-bold">{info}</h2>
</div>
);
Expand All @@ -30,8 +30,8 @@ interface NoSimBriefDataOverlayProps {
}

const NoSimBriefDataOverlay = ({ simbriefDataLoaded, simbriefDataPending, fetchData }: NoSimBriefDataOverlayProps) => (
<div className={`bg-theme-body absolute inset-0 transition duration-200 ${simbriefDataLoaded ? 'pointer-events-none opacity-0' : 'opacity-100'}`}>
<h1 className="flex h-full w-full items-center justify-center">
<div className={`absolute inset-0 transition duration-200 bg-theme-body ${simbriefDataLoaded ? 'opacity-0 pointer-events-none' : 'opacity-100'}`}>
<h1 className="flex justify-center items-center w-full h-full">
{simbriefDataPending ? (
<CloudArrowDown className="animate-bounce" size={40} />
) : (
Expand All @@ -48,7 +48,7 @@ const NoSimBriefDataOverlay = ({ simbriefDataLoaded, simbriefDataPending, fetchD
<button
type="button"
onClick={fetchData}
className="text-theme-body hover:text-theme-highlight bg-theme-highlight hover:bg-theme-body border-theme-highlight flex w-full items-center justify-center space-x-4 rounded-md border-2 p-2 transition duration-100"
className="flex justify-center items-center p-2 space-x-4 w-full rounded-md border-2 transition duration-100 text-theme-body hover:text-theme-highlight bg-theme-highlight hover:bg-theme-body border-theme-highlight"
>
<CloudArrowDown size={26} />
<p className="text-current">{t('Dashboard.YourFlight.ImportSimBriefData')}</p>
Expand All @@ -66,7 +66,7 @@ export const FlightWidget = () => {
const [simbriefDataPending, setSimbriefDataPending] = useState(false);
const [navigraphUsername] = usePersistentProperty('NAVIGRAPH_USERNAME');
const [overrideSimBriefUserID] = usePersistentProperty('CONFIG_OVERRIDE_SIMBRIEF_USERID');
// const [airframe] = useState(getAirframeType());
const [airframe] = useState(getAirframeType());

const {
schedIn,
Expand Down Expand Up @@ -125,7 +125,7 @@ export const FlightWidget = () => {

return (
<div className="w-1/2">
<div className="mb-4 flex flex-row items-center justify-between">
<div className="flex flex-row justify-between items-center mb-4">
<h1 className="font-bold">{t('Dashboard.YourFlight.Title')}</h1>
{simbriefDataLoaded && (
<h1>
Expand All @@ -137,72 +137,72 @@ export const FlightWidget = () => {
</h1>
)}
</div>
<div className="h-content-section-reduced border-theme-accent relative w-full overflow-hidden rounded-lg border-2 p-6">
<div className="flex h-full flex-col justify-between">
<div className="overflow-hidden relative p-6 w-full rounded-lg border-2 h-content-section-reduced border-theme-accent">
<div className="flex flex-col justify-between h-full">
<div className="space-y-8">
<div className="flex flex-row justify-between">
<div>
<h1 className="text-4xl font-bold">{departingAirport}</h1>
<p className="w-52 text-sm">{departingName}</p>
</div>
<div>
<h1 className="text-right text-4xl font-bold">{arrivingAirport}</h1>
<p className="w-52 text-right text-sm">{arrivingName}</p>
<h1 className="text-4xl font-bold text-right">{arrivingAirport}</h1>
<p className="w-52 text-sm text-right">{arrivingName}</p>
</div>
</div>
<div>
<div className="flex w-full flex-row items-center">
<div className="flex flex-row items-center w-full">
<p className={`font-body ${flightPlanProgress > 1 ? 'text-theme-highlight' : 'text-theme-text'}`}>
{schedOutParsed}
</p>
<div className="relative mx-6 flex h-1 w-full flex-row">
<div className="border-theme-text absolute inset-x-0 border-b-4 border-dashed" />
<div className="flex relative flex-row mx-6 w-full h-1">
<div className="absolute inset-x-0 border-b-4 border-dashed border-theme-text" />

<div className="bg-theme-highlight relative w-full" style={{ width: `${flightPlanProgress}%` }}>
<div className="relative w-full bg-theme-highlight" style={{ width: `${flightPlanProgress}%` }}>
{!!flightPlanProgress && (
<IconPlane
className="text-theme-highlight absolute right-0 -translate-y-1/2 translate-x-1/2 fill-current"
className="absolute right-0 transform translate-x-1/2 -translate-y-1/2 fill-current text-theme-highlight"
size={50}
strokeLinejoin="miter"
/>
)}
</div>
</div>
<p className={`font-body text-right ${Math.round(flightPlanProgress) >= 98 ? 'text-theme-highlight' : 'text-theme-text'}`}>
<p className={`text-right font-body ${Math.round(flightPlanProgress) >= 98 ? 'text-theme-highlight' : 'text-theme-text'}`}>
{schedInParsed}
</p>
</div>
</div>
<div>
<div className="mb-4 flex flex-row justify-around">
<div className="flex flex-row justify-around mb-4">
<InformationEntry title={t('Dashboard.YourFlight.Alternate')} info={altIcao ?? 'NONE'} />
<div className="bg-theme-accent mx-4 my-auto h-8 w-1" />
<div className="my-auto mx-4 w-1 h-8 bg-theme-accent" />
<InformationEntry title={t('Dashboard.YourFlight.CompanyRoute')} info={departingIata + arrivingIata} />
<div className="bg-theme-accent mx-4 my-auto h-8 w-1" />
<div className="my-auto mx-4 w-1 h-8 bg-theme-accent" />
<InformationEntry title={t('Dashboard.YourFlight.ZFW')} info={estimatedZfw} />
</div>
<div className="bg-theme-accent my-auto h-0.5 w-full" />
<div className="mt-4 flex flex-row justify-around">
<div className="my-auto w-full h-0.5 bg-theme-accent" />
<div className="flex flex-row justify-around mt-4">
<InformationEntry title={t('Dashboard.YourFlight.CostIndex')} info={costInd} />
<div className="bg-theme-accent mx-4 my-auto h-8 w-1" />
<div className="my-auto mx-4 w-1 h-8 bg-theme-accent" />
<InformationEntry title={t('Dashboard.YourFlight.AverageWind')} info={avgWind} />
<div className="bg-theme-accent mx-4 my-auto h-8 w-1" />
<div className="my-auto mx-4 w-1 h-8 bg-theme-accent" />
<InformationEntry title={t('Dashboard.YourFlight.CruiseAlt')} info={crzAlt} />
</div>
</div>
<div>
<h5 className="mb-2 text-2xl font-bold">{t('Dashboard.YourFlight.Route')}</h5>
<ScrollableContainer height={15}>
<p className="font-mono text-2xl">
<span className="text-theme-highlight text-2xl">
<span className="text-2xl text-theme-highlight">
{departingAirport}
/
{departingRunway}
</span>
{' '}
{route}
{' '}
<span className="text-theme-highlight text-2xl">
<span className="text-2xl text-theme-highlight">
{arrivingAirport}
/
{arrivingRunway}
Expand All @@ -214,7 +214,7 @@ export const FlightWidget = () => {
<button
type="button"
onClick={fetchData}
className="text-theme-body hover:text-theme-highlight bg-theme-highlight hover:bg-theme-body border-theme-highlight flex w-full items-center justify-center space-x-4 rounded-lg border-2 p-2 transition duration-100"
className="flex justify-center items-center p-2 space-x-4 w-full rounded-lg border-2 transition duration-100 text-theme-body hover:text-theme-highlight bg-theme-highlight hover:bg-theme-body border-theme-highlight"
>
<CloudArrowDown size={26} />
<p className="text-current">{t('Dashboard.YourFlight.ImportSimBriefData')}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface InformationEntryProps {

const InformationEntry: FC<InformationEntryProps> = ({ children, title, info }) => (
<div>
<div className="text-theme-highlight flex flex-row items-center space-x-4">
<div className="flex flex-row items-center space-x-4 text-theme-highlight">
{children}
<p className="whitespace-nowrap">{title}</p>
</div>
Expand All @@ -36,18 +36,18 @@ export const OverviewPage = () => {
const numberWithCommas = (x: number) => x.toFixed(0).replace(/\B(?=(\d{3})+(?!\d))/g, ',');

switch (unitType) {
case 'weight':
return `${numberWithCommas(Units.kilogramToUser(metricValue))} [${Units.userWeightSuffixEis2}]`;
case 'volume':
return `${numberWithCommas(Units.litreToUser(metricValue))} [${Units.userVolumeSuffixEis2}]`;
case 'distance':
return `${numberWithCommas(metricValue)} [nm]`;
default: throw new Error('Invalid unit type');
case 'weight':
return `${numberWithCommas(Units.kilogramToUser(metricValue))} [${Units.userWeightSuffixEis2}]`;
case 'volume':
return `${numberWithCommas(Units.litreToUser(metricValue))} [${Units.userVolumeSuffixEis2}]`;
case 'distance':
return `${numberWithCommas(metricValue)} [nm]`;
default: throw new Error('Invalid unit type');
}
};

const A330343 = (
<div className="mt-8 flex flex-row space-x-16">
<div className="flex flex-row mt-8 space-x-16">
<div className="flex flex-col space-y-8">
<InformationEntry title={t('Dispatch.Overview.Model')} info="A330-343 [A333]">
<IconPlane className="fill-current" size={23} stroke={1.5} strokeLinejoin="miter" />
Expand Down Expand Up @@ -97,7 +97,7 @@ export const OverviewPage = () => {
);

const ACJ330941 = (
<div className="mt-8 flex flex-row space-x-16">
<div className="flex flex-row mt-8 space-x-16">
<div className="flex flex-col space-y-8">
<InformationEntry title={t('Dispatch.Overview.Model')} info="A330-941 [A339]">
<IconPlane className="fill-current" size={23} stroke={1.5} strokeLinejoin="miter" />
Expand Down Expand Up @@ -147,12 +147,12 @@ export const OverviewPage = () => {
);

return (
<div className="h-content-section-reduced border-theme-accent mr-3 w-full overflow-hidden rounded-lg border-2 p-6">
<div className="overflow-hidden p-6 mr-3 w-full h-content-section-reduced rounded-lg border-2 border-theme-accent">
{airframe === 'A330_343' ? <h1 className="font-bold">Airbus A330-300</h1> : <h1 className="font-bold">Airbus A330-300P2F</h1>}
<p>{airline}</p>

<div className="mt-6 flex items-center justify-center">
<NoseOutline className="flip-horizontal w-full" />
<div className="flex justify-center items-center mt-6">
<NoseOutline className="w-full flip-horizontal" />
</div>

{airframe === 'A330_343' ? A330343 : ACJ330941}
Expand Down
8 changes: 4 additions & 4 deletions hdw-a333x/src/systems/instruments/src/EFB/Efb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ const BATTERY_DURATION_CHARGE_MIN = 180;
const BATTERY_DURATION_DISCHARGE_MIN = 540;

const LoadingScreen = () => (
<div className="bg-theme-statusbar flex h-screen w-screen items-center justify-center">
<div className="flex justify-center items-center w-screen h-screen bg-theme-statusbar">
<HdwLogo width={128} height={120} className="text-theme-text" />
</div>
);

const EmptyBatteryScreen = () => (
<div className="bg-theme-statusbar flex h-screen w-screen items-center justify-center">
<div className="flex justify-center items-center w-screen h-screen bg-theme-statusbar">
<Battery size={128} className="text-utility-red" />
</div>
);
Expand Down Expand Up @@ -297,7 +297,7 @@ const Efb = () => {
switch (powerState) {
case PowerStates.SHUTOFF:
case PowerStates.STANDBY:
return <div className="h-screen w-screen" onClick={offToLoaded} />;
return <div className="w-screen h-screen" onClick={offToLoaded} />;
case PowerStates.LOADING:
case PowerStates.SHUTDOWN:
return <LoadingScreen />;
Expand Down Expand Up @@ -325,7 +325,7 @@ const Efb = () => {
/>
<div className="flex flex-row">
<ToolBar />
<div className="h-screen w-screen pr-6 pt-14">
<div className="pt-14 pr-6 w-screen h-screen">
<Switch>
<Route exact path="/">
<Redirect to="/dashboard" />
Expand Down
Loading

0 comments on commit e85cdc6

Please sign in to comment.