add competitors in today's page

This commit is contained in:
Fabrice Lamant
2024-07-27 08:52:06 +02:00
parent ad1e9b67aa
commit 3157cec982
4 changed files with 16437 additions and 10299 deletions

View File

@ -609,6 +609,9 @@ video {
.text-right {
text-align: right;
}
.align-top {
vertical-align: top;
}
.text-2xl {
font-size: 1.5rem;
line-height: 2rem;

File diff suppressed because it is too large Load Diff

View File

@ -108,6 +108,7 @@ const extractSportCalendar = async (sportKey) => {
LOCATION: unit.venueDescription,
_SPORT: sportKey,
_NOCS: [],
_COMPETITORS: [],
_UNITNAME: unit.eventUnitName,
};
@ -139,6 +140,7 @@ const extractSportCalendar = async (sportKey) => {
.forEach((competitor) => {
if (competitor.name !== getNOCName(competitor.noc)) {
event.DESCRIPTION += `\\n${getNOCFlag(competitor.noc)} ${competitor.name}`;
event._COMPETITORS.push({ noc: competitor.noc, name: `${getNOCFlag(competitor.noc)} ${competitor.name}` });
} else {
event.DESCRIPTION += `\\n${getNOCFlag(competitor.noc)} ${competitor.noc}`;
}
@ -243,10 +245,16 @@ const generateTodayPage = () => {
const summary = event.SUMMARY.match(/ceremony/gi) ? event.SUMMARY : event.SUMMARY.split(" ").slice(1).join(" ");
html.push(`<div class="event py-4" data-start="${event.DTSTART}" data-end="${event.DTEND}" data-noc="${event._NOCS.join(",")}">`);
html.push(" <div class=\"time w-1/4 text-right inline-block text-5xl text-center pr-2 border-r border-slate-900/10\">__:__</div>");
html.push(" <div class=\"w-3/5 inline-block text-black pl-2\">");
html.push(" <div class=\"time w-1/4 align-top text-right inline-block text-5xl text-center pr-2 border-r border-slate-900/10\">__:__</div>");
html.push(" <div class=\"w-3/5 align-top inline-block text-black pl-2\">");
html.push(` <div class="text-2xl">${sport.name.toUpperCase()}</div>`);
html.push(` <div class="">${summary}</div>`);
html.push(` <div class="">${summary}`);
if (event._COMPETITORS) {
event._COMPETITORS.forEach((competitor) => {
html.push(`<div class="competitor ${competitor.noc}">${competitor.name}</div>`);
});
}
html.push(` </div>`);
html.push(" </div>");
html.push("</div>");

View File

@ -70,6 +70,9 @@
element.remove();
}
});
document.querySelectorAll(`.competitor:not(.${noc})`).forEach((element) => {
element.remove();
});
if (document.querySelectorAll('.event').length === 0) {
document.querySelector('.no-event').classList.remove('hidden');
}