#6555 refactor to js #28

Merged
jorgep merged 13 commits from 6555-refactorToJs into test 2024-10-10 13:51:47 +00:00
1 changed files with 3 additions and 1 deletions
Showing only changes of commit 496182fa54 - Show all commits

View File

@ -92,7 +92,7 @@ function printTimetable(timetable) {
timetable.forEach((row, index) => { timetable.forEach((row, index) => {
for (let day = weekDays.length - 1; day >= 0; day--) { for (let day = weekDays.length - 1; day >= 0; day--) {
const img = createElement("img", { attrs: { src: ifIsEmptyImage(row[`${day}daysAgoDirection`]) } }); const img = createElement("img", { attrs: { src: ifIsEmptyImage(row[`${day}daysAgoDirection`]) } });
const p = createElement("p", { text: row[`${day}daysAgo`] }); const p = createElement("p", { text: ifIsEmptyText(row[`${day}daysAgo`]) });
const innerDiv = createElement("div", { childs: [img, p] }); const innerDiv = createElement("div", { childs: [img, p] });
const outerDiv = createElement("div", { classes: ["time", ifIsEmpty(row[`${day}daysAgo`])], childs: [innerDiv] }); const outerDiv = createElement("div", { classes: ["time", ifIsEmpty(row[`${day}daysAgo`])], childs: [innerDiv] });
@ -116,6 +116,8 @@ const ifIsEmpty = (value) => (value?.trim() ? "show" : "hide");
const ifIsEmptyImage = (value) => (value?.trim() ? `img/${value}.svg` : "img/in.svg"); const ifIsEmptyImage = (value) => (value?.trim() ? `img/${value}.svg` : "img/in.svg");
const ifIsEmptyText = (value) => (value?.toString()?.trim() ? value : "00:00");
function close() { function close() {
localStorage.removeItem("userData"); localStorage.removeItem("userData");
setTimeout(() => (window.location = "index.html"), 200); setTimeout(() => (window.location = "index.html"), 200);