Improved subtopics mapping
This commit is contained in:
parent
0bb9693790
commit
2c922cfbd5
1 changed files with 12 additions and 2 deletions
14
app/index.js
14
app/index.js
|
@ -313,6 +313,7 @@ function processData(data, filename) {
|
|||
currentFileName = filename;
|
||||
|
||||
topics = [...new Set(data.flatMap(item => item.topics))].sort();
|
||||
subtopics = [...new Set(data.flatMap(item => item.subtopics))].sort();
|
||||
renderTopics();
|
||||
|
||||
const fragment = document.createDocumentFragment();
|
||||
|
@ -330,11 +331,20 @@ function processData(data, filename) {
|
|||
const bigQuestionBox = document.createElement("div");
|
||||
bigQuestionBox.id = questionid;
|
||||
|
||||
const allClasses = [...topics.map(t => t.trim()),
|
||||
...subtopics.map(s => s.trim()),
|
||||
/*const allClasses = [...topics.map(t => t.trim()),
|
||||
subtopics,
|
||||
"hidden"];
|
||||
bigQuestionBox.classList.add(...allClasses);*/
|
||||
|
||||
const allClasses = [
|
||||
...topics.map(t => t.trim()).filter(t => t),
|
||||
...(typeof subtopics === "string" ? [subtopics] : []),
|
||||
"hidden"
|
||||
];
|
||||
|
||||
bigQuestionBox.classList.add(...allClasses);
|
||||
|
||||
|
||||
const btnContainer = document.createElement("div");
|
||||
btnContainer.classList.add("btn-container");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue