Skip to content

Commit

Permalink
better mission display logic
Browse files Browse the repository at this point in the history
  • Loading branch information
BarthPaleologue committed Sep 6, 2024
1 parent e09c7e5 commit ac51e7d
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/ts/ui/currentMissionDisplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,29 @@ export class CurrentMissionDisplay {

private activeMissionIndex: number | null = null;

private readonly defaultPanel: HTMLElement;

private missionToPanel: Map<Mission, HTMLElement> = new Map();

constructor(player: Player) {
this.rootNode = document.createElement("div");
this.rootNode.classList.add("currentMissionDisplay");

this.defaultPanel = document.createElement("div");
this.defaultPanel.classList.add("missionPanel");
this.setNoMissionActive();
}

private setMissionActive(mission: Mission) {
const panelRoot = document.createElement("div");

this.rootNode.innerHTML = "";
this.rootNode.appendChild(panelRoot);
}

private setNoMissionActive() {
const defaultPanel = document.createElement("div");
defaultPanel.classList.add("missionPanel");

const defaultPanelH2 = document.createElement("h2");
defaultPanelH2.innerText = "You don't have any active missions";
this.defaultPanel.appendChild(defaultPanelH2);
defaultPanel.appendChild(defaultPanelH2);

this.rootNode.appendChild(this.defaultPanel);
this.rootNode.innerHTML = "";
this.rootNode.appendChild(defaultPanel);
}
}

0 comments on commit ac51e7d

Please sign in to comment.