fix: refs #6555 add ifIsEmptyText fn

This commit is contained in:
jorgep 2024-06-19 12:43:02 +02:00
parent 1f9bf03780
commit 496182fa54
1 changed files with 3 additions and 1 deletions

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);