highlight medal events in today's page

This commit is contained in:
Fabrice Lamant
2024-08-30 10:00:43 +01:00
parent 14e3e320a1
commit 8a0b031f77
4 changed files with 315 additions and 211 deletions

View File

@ -7,7 +7,7 @@ import { Event, Medal, NOC, Sport } from "./types";
import { getAllSportsKeys, getSportIcon } from "./sports";
import { existsSync, writeFileSync } from "fs";
import { hasFile, readFile, saveFile } from "./io";
import cheerio from "cheerio";
import * as cheerio from "cheerio";
import { getNOCFlag, getNOCName, isValidNOC } from "./nocs";
import * as translate from "./translate";
import { generateICS } from "./ics";
@ -390,8 +390,17 @@ export class Calendar {
};
}
content.push(`<div class="event py-4" data-start="${event.DTSTART}" data-end="${event.DTEND}" data-noc="${event._NOCS.sort().join(",")}">`);
content.push(" <div class=\"time w-1/4 align-top text-right inline-block text-5xl text-center tabular-nums pr-2 border-r border-slate-900/10\">");
let medalColor = "";
if (event._MEDAL) {
if (event._UNITNAME.match(/bronze/gi)) {
medalColor = "bg-orange-700";
} else {
medalColor = "bg-amber-400";
}
}
content.push(`<div class="event py-4 ${medalColor}" data-start="${event.DTSTART}" data-end="${event.DTEND}" data-noc="${event._NOCS.sort().join(",")}" >`);
content.push(` <div class=\"time w-1/4 align-top text-right inline-block text-5xl text-center tabular-nums pr-2 border-r border-slate-900/10\">`);
content.push(" <span class=\"time-start\">__:__</span>");
content.push(" <div class=\"time-end text-xs\">__:__</div>");
content.push(" </div>");

View File

@ -68,7 +68,6 @@
const cycleColor = () => {
color++
color = color % 5
console.log(color);
switch (color) {
case 0: return "blue";
case 1: return "yellow";