Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/campaigns/nats/scenario1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const scenario1Data: ScenarioData = {
'No reading - LNB is offline',
],
correctIndex: 0,
explanation: 'The LNB noise temperature of 433K is excellent. Lower noise temperature means better receive sensitivity. Anything under 100K is considered good for C-band.',
explanation: 'The LNB noise temperature of 43K is excellent. Lower noise temperature means better receive sensitivity. Anything under 100K is considered good for C-band.',
pointPenalty: 10,
},
mustMaintain: false,
Expand Down
24 changes: 19 additions & 5 deletions src/modal/objective-failed-modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class ObjectiveFailedModal extends DraggableModal {
isScenarioTimeout: false,
};
private progressSaveManager_: ProgressSaveManager;
private hasCheckpoint_: boolean = false;

private constructor() {
if (ObjectiveFailedModal.instance_) {
Expand All @@ -46,17 +47,22 @@ export class ObjectiveFailedModal extends DraggableModal {
}

protected getModalContentHtml(): string {
const checkpointButton = this.hasCheckpoint_
? `<button id="restart-checkpoint-btn" class="btn btn-primary">Restart from Checkpoint</button>`
: '';

// Make Restart Scenario primary when it's the only option
const scenarioButtonClass = this.hasCheckpoint_ ? 'btn btn-secondary' : 'btn btn-primary';

return html`
<div class="failure-modal">
<div class="failure-modal__icon"><img src="${stopwatchPng}" alt="Time expired" /></div>
<div class="failure-modal__title">${this.options_.title}</div>
<div class="failure-modal__message">${this.options_.message}</div>

<div class="failure-modal__actions">
<button id="restart-checkpoint-btn" class="btn btn-primary">
Restart from Checkpoint
</button>
<button id="restart-scenario-btn" class="btn btn-secondary">
${checkpointButton}
<button id="restart-scenario-btn" class="${scenarioButtonClass}">
Restart Scenario
</button>
</div>
Expand Down Expand Up @@ -106,14 +112,22 @@ export class ObjectiveFailedModal extends DraggableModal {
window.location.reload();
}

showFailure(options: Partial<FailureModalOptions>): void {
async showFailure(options: Partial<FailureModalOptions>): Promise<void> {
this.options_ = {
title: 'Objective Failed',
message: 'Time has expired.',
isScenarioTimeout: false,
...options,
};

// Check if checkpoint exists for current scenario
const scenario = ScenarioManager.getInstance();
if (scenario?.data?.id) {
this.hasCheckpoint_ = await this.progressSaveManager_.hasCheckpoint(scenario.data.id);
} else {
this.hasCheckpoint_ = false;
}

// Close any open popups before showing failure modal
this.closeAllPopups_();

Expand Down
Loading