Devlog 5
I have now finished the following tasks:
-
Ability to edit question extra fields (e.g. min/max of a slider question)
-
Ability to delete a section
-
Ability to add a section
-
Ability to edit a section
-
Ability to add a question
The tasks I have left related to the question management system are:
-
Translation keys
-
Create the phone UI
I also hit a small hiccup along the way of adding these features where I discovered due to my localstorage structure, whenever a competition is switched, the questions are all deleted (now fixed by not just using a blank localstorage.clear())
New Code
/**
* Creates the base skeleton structure for localstorage
*
* @param {boolean} force - Force overwrite of existing localstorage or not
*/
export function createSkeleton(force: boolean) {
const existing = localStorage.getItem("data");
if (existing && !force) {
return;
}
let setPrescout = {
structure: {},
sections: {
"0": {
title: "Section 1",
headersize: 1,
questions: [],
index: 0,
},
},
};
if (existing) {
const parsed = JSON.parse(existing);
setPrescout.structure = parsed.prescout.structure;
setPrescout.sections = parsed.prescout.sections;
}
const skeleton: LocalStorageData = {
compkey: "",
custom: false,
prescout: {
structure: setPrescout.structure,
sections: setPrescout.sections,
teams: {},
},
match: {},
};
localStorage.setItem("data", JSON.stringify(skeleton));
resetAllStates();
}
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.