41 lines
827 B
JavaScript
Raw Normal View History

2025-02-25 13:59:26 +01:00
export class MainMenu {
2025-03-31 15:02:37 +02:00
constructor(uiService, installMenu, configMenu) {
2025-02-25 13:59:26 +01:00
this.ui = uiService;
2025-03-07 13:14:32 +01:00
this.installMenu = installMenu;
2025-03-31 15:02:37 +02:00
this.configMenu = configMenu;
2025-02-25 15:25:14 +01:00
this.running = true;
2025-02-25 13:59:26 +01:00
}
show = async () => {
this.ui.showLogo();
2025-02-25 13:59:26 +01:00
this.ui.showInfoMessage("hello");
2025-03-07 13:14:32 +01:00
2025-02-25 15:25:14 +01:00
while (this.running) {
await this.promptMainMenu();
}
this.ui.showInfoMessage("K-THX-BYE");
};
2025-03-07 13:14:32 +01:00
promptMainMenu = async () => {
await this.ui.askMultipleChoice("Select an option", [
{
label: "Install Codex",
action: this.installMenu.show,
},
2025-03-31 15:02:37 +02:00
{
label: "Configure Codex",
action: this.configMenu.show,
},
{
2025-03-07 13:14:32 +01:00
label: "Exit",
action: this.closeMainMenu,
},
2025-03-07 13:14:32 +01:00
]);
2025-02-25 13:59:26 +01:00
};
2025-02-25 15:25:14 +01:00
2025-03-07 13:14:32 +01:00
closeMainMenu = async () => {
2025-02-25 15:25:14 +01:00
this.running = false;
};
2025-02-25 13:59:26 +01:00
}