Skip to content

Commit

Permalink
various small fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
brollin committed May 17, 2024
1 parent 5010886 commit 0f5472e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ui/learn/src/ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class LearnCtrl {
const { stageId, levelId } = extractHashParameters();
this.opts.stageId = stageId;
this.opts.levelId =
// used the level id from the hash path if it exists
// use the level id from the hash path if it exists
levelId ||
// otherwise find a level id based on the last completed level
(() => {
Expand Down
5 changes: 2 additions & 3 deletions ui/learn/src/learn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@ interface LearnServerOpts {

export function initModule({ data, i18n }: LearnServerOpts) {
const _storage = storage(data);
const snabbdomOpts: LearnOpts = {
const opts: LearnOpts = {
i18n,
storage: _storage,
stageId: null,
levelId: null,
};

const ctrl = new LearnCtrl(snabbdomOpts, redraw);
const ctrl = new LearnCtrl(opts, redraw);

const element = document.getElementById('learn-app')!;
element.innerHTML = '';
Expand Down
6 changes: 3 additions & 3 deletions ui/learn/src/sideCtrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export class SideCtrl {
this.trans = ctrl.trans;
this.data = ctrl.data;

this.categId = propWithEffect(this.getCategIdFromStageId(), ctrl.redraw);
this.categId = propWithEffect(this.getCategIdFromStageId() || 1, ctrl.redraw);
}

reset = () => this.opts.storage.reset();

activeStageId = () => this.opts.stageId || 1;
getCategIdFromStageId = () => stages.stageIdToCategId(this.activeStageId()) || this.categId();
updateCategId = () => this.categId(this.getCategIdFromStageId());
getCategIdFromStageId = () => stages.stageIdToCategId(this.activeStageId());
updateCategId = () => this.categId(this.getCategIdFromStageId() || this.categId());

progress = () => {
const max = stages.list.length * 10;
Expand Down

0 comments on commit 0f5472e

Please sign in to comment.