Skip to content

Commit

Permalink
fix(a380x/mfd): Disable MFD INIT & DEPARTURE page buttons depending o…
Browse files Browse the repository at this point in the history
…n fms phase (flybywiresim#8992)

disable INIT & departure mfd buttons if not in preflight phase

Co-authored-by: flogross89 <63071941+flogross89@users.noreply.github.com>
  • Loading branch information
BravoMike99 and flogross89 authored Oct 12, 2024
1 parent 0a7f9d0 commit 90aeaa1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { FmgcFlightPhase } from '@shared/flightphase';
import { Units, LegType, TurnDirection, AltitudeDescriptor } from '@flybywiresim/fbw-sdk';
import { MfdFmsFplnVertRev } from 'instruments/src/MFD/pages/FMS/F-PLN/MfdFmsFplnVertRev';
import { AltitudeConstraint, SpeedConstraint } from '@fmgc/flightplanning/data/constraint';
import { ConditionalComponent } from '../../common/ConditionalComponent';

interface MfdFmsFplnProps extends AbstractMfdPageProps {}

Expand Down Expand Up @@ -919,12 +920,19 @@ export class MfdFmsFpln extends FmsPage<MfdFmsFplnProps> {
</div>
</div>
<div class="mfd-fms-fpln-footer">
<Button
label="INIT"
onClick={() =>
this.props.mfd.uiService.navigateTo(`fms/${this.props.mfd.uiService.activeUri.get().category}/init`)
<ConditionalComponent
condition={this.activeFlightPhase.map((phase) => phase === FmgcFlightPhase.Preflight)}
width={125}
componentIfTrue={
<Button
label="INIT"
onClick={() =>
this.props.mfd.uiService.navigateTo(`fms/${this.props.mfd.uiService.activeUri.get().category}/init`)
}
buttonStyle="width: 125px;"
/>
}
buttonStyle="width: 125px;"
componentIfFalse={<></>}
/>
<Button
disabled={Subject.create(true)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ export class MfdFmsInit extends FmsPage<MfdFmsInitProps> {
);

private departureButtonDisabled = MappedSubject.create(
([toIcao, fromIcao]) => !toIcao || !fromIcao,
([toIcao, fromIcao, phase]) => !toIcao || !fromIcao || phase !== FmgcFlightPhase.Preflight,
this.fromIcao,
this.toIcao,
this.activeFlightPhase,
);

public onAfterRender(node: VNode): void {
Expand Down

0 comments on commit 90aeaa1

Please sign in to comment.