/**
* On this Page an accordion with tasks is shown. The user selects one and after that a {@link SimplifierPage} is shown.
* On the SimplifierPage the actual task can be solved.
* @extends Page
*/
class SelectPage extends Page {
constructor() {
let content = {
tutorial: new Tutorial(),
accordion: new TaskAccordeon(),
}
// <pageName>-page-container (id of div on index.htlm)
super(content, "select-page-container", "Selector");
}
setup() {
if (!serverFiles.loaded) {
console.warn("Setup of select page requested before circuits where loaded - cant build selectors without loaded circuits")
return;
}
if (!super.beforeSetup()) return;
this.pageDiv.appendChild(this.content.tutorial.setup());
this.pageDiv.appendChild(this.content.accordion.setup());
super.afterSetup();
}
async initialize(){
if (!super.beforeInit()) return;
return awaitVal(() => state.circuitsLoaded, async () => {
// Fill accordion and carousels with svg data
for (const circuitSet of serverFiles.circuitSets) {
await selectorBuilder.setupSelector(circuitSet);
}
state.selectorsBuild = true;
state.options = await getWheatstoneValues();
/** @type {TaskAccordeon} */
let taskAccordion = this.content.accordion
taskAccordion.selector.updateSelectorCounters();
this.setupEasterEggs();
super.afterInit();
});
}
setupEasterEggs() {
this.content.accordion.setupEasterEggs()
}
}