Implemented Hit/Miss to title of streak indicators

This commit is contained in:
Maximilian Giller 2024-01-28 15:48:42 +01:00
parent a909aee7a1
commit a6735c41ab

View file

@ -332,18 +332,21 @@
const adjustedDate = new Date((new Date()).getTime() - offset * 24 * 60 * 60 * 1000); const adjustedDate = new Date((new Date()).getTime() - offset * 24 * 60 * 60 * 1000);
const formattedDate = adjustedDate.toISOString().split('T')[0]; const formattedDate = adjustedDate.toISOString().split('T')[0];
let titleSuffix = ""
if (streakData.length > 0) { if (streakData.length > 0) {
if (streakData.includes(formattedDate)) { if (streakData.includes(formattedDate)) {
classes.push("bi-circle-fill"); classes.push("bi-circle-fill");
titleSuffix = " | Hit";
} else if (offset == 0) { } else if (offset == 0) {
classes.push("bi-circle-half"); classes.push("bi-circle-half");
} else { } else {
classes.push("bi-circle"); classes.push("bi-circle");
titleSuffix = " | Miss";
} }
} }
document.getElementById("day-" + offset).classList = classes.join(" "); document.getElementById("day-" + offset).classList = classes.join(" ");
document.getElementById("day-" + offset).title = formattedDate; document.getElementById("day-" + offset).title = formattedDate + titleSuffix;
} }
} }