mirror of
https://github.com/nfonteyne/octane-website.git
synced 2026-09-03 23:24:48 +02:00
update: see next concert in calendar
This commit is contained in:
parent
bf18eb4659
commit
49979fda39
2 changed files with 28 additions and 4 deletions
|
|
@ -1422,12 +1422,15 @@ a.back-link:hover { color: var(--accent); }
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cell-rehearsal-badge {
|
.cell-badges {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0.3rem;
|
top: 0.3rem;
|
||||||
right: 0.4rem;
|
right: 0.4rem;
|
||||||
|
display: flex;
|
||||||
|
gap: 0.2rem;
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cal-cell.has-rehearsal { border-color: var(--accent); }
|
.cal-cell.has-rehearsal { border-color: var(--accent); }
|
||||||
|
.cal-cell.has-concert { border-color: var(--success); }
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ let state = {
|
||||||
slots: [],
|
slots: [],
|
||||||
personIds: [],
|
personIds: [],
|
||||||
rehearsals: [],
|
rehearsals: [],
|
||||||
|
nextConcert: null,
|
||||||
};
|
};
|
||||||
let me = null;
|
let me = null;
|
||||||
let currentModalDate = null;
|
let currentModalDate = null;
|
||||||
|
|
@ -23,6 +24,11 @@ async function loadRehearsals() {
|
||||||
renderCalendar();
|
renderCalendar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function loadNextConcert() {
|
||||||
|
state.nextConcert = await api.get('/api/setlists/next');
|
||||||
|
renderCalendar();
|
||||||
|
}
|
||||||
|
|
||||||
async function loadLastChecked() {
|
async function loadLastChecked() {
|
||||||
const { last_checked } = await api.get('/api/calendar/last-checked');
|
const { last_checked } = await api.get('/api/calendar/last-checked');
|
||||||
const el = document.getElementById('last-checked');
|
const el = document.getElementById('last-checked');
|
||||||
|
|
@ -64,6 +70,8 @@ function renderCalendar() {
|
||||||
const rehearsalsByDate = new Map();
|
const rehearsalsByDate = new Map();
|
||||||
for (const r of state.rehearsals) rehearsalsByDate.set(isoDate(new Date(r.startsAt)), r);
|
for (const r of state.rehearsals) rehearsalsByDate.set(isoDate(new Date(r.startsAt)), r);
|
||||||
|
|
||||||
|
const nextConcertDate = state.nextConcert ? isoDate(new Date(state.nextConcert.concert_date)) : null;
|
||||||
|
|
||||||
// Grid starts on the Monday of the current week so columns align Mon->Sun.
|
// Grid starts on the Monday of the current week so columns align Mon->Sun.
|
||||||
const start = new Date(today);
|
const start = new Date(today);
|
||||||
const dow = start.getDay();
|
const dow = start.getDay();
|
||||||
|
|
@ -95,16 +103,28 @@ function renderCalendar() {
|
||||||
dateLabel.innerHTML = `<span class="day-num">${date.getDate()}</span>${shortMonth(date)}`;
|
dateLabel.innerHTML = `<span class="day-num">${date.getDate()}</span>${shortMonth(date)}`;
|
||||||
cell.appendChild(dateLabel);
|
cell.appendChild(dateLabel);
|
||||||
|
|
||||||
|
const badges = document.createElement('div');
|
||||||
|
badges.className = 'cell-badges';
|
||||||
|
|
||||||
const rehearsal = rehearsalsByDate.get(isoDate(date));
|
const rehearsal = rehearsalsByDate.get(isoDate(date));
|
||||||
if (rehearsal) {
|
if (rehearsal) {
|
||||||
cell.classList.add('has-rehearsal');
|
cell.classList.add('has-rehearsal');
|
||||||
const badge = document.createElement('div');
|
const badge = document.createElement('span');
|
||||||
badge.className = 'cell-rehearsal-badge';
|
|
||||||
badge.title = 'Répétition proposée';
|
badge.title = 'Répétition proposée';
|
||||||
badge.textContent = '🎸';
|
badge.textContent = '🎸';
|
||||||
cell.appendChild(badge);
|
badges.appendChild(badge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nextConcertDate && isoDate(date) === nextConcertDate) {
|
||||||
|
cell.classList.add('has-concert');
|
||||||
|
const badge = document.createElement('span');
|
||||||
|
badge.title = `Prochain concert${state.nextConcert.name ? ' : ' + state.nextConcert.name : ''}${state.nextConcert.venue ? ' (' + state.nextConcert.venue + ')' : ''}`;
|
||||||
|
badge.textContent = '🎤';
|
||||||
|
badges.appendChild(badge);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (badges.childElementCount) cell.appendChild(badges);
|
||||||
|
|
||||||
if (isPastDay) {
|
if (isPastDay) {
|
||||||
cell.classList.add('empty');
|
cell.classList.add('empty');
|
||||||
const lbl = document.createElement('div');
|
const lbl = document.createElement('div');
|
||||||
|
|
@ -565,6 +585,7 @@ async function onRemoveMyFeed(feedId) {
|
||||||
await loadPeople();
|
await loadPeople();
|
||||||
buildFilters();
|
buildFilters();
|
||||||
await loadRehearsals();
|
await loadRehearsals();
|
||||||
|
await loadNextConcert();
|
||||||
await loadSlots();
|
await loadSlots();
|
||||||
await loadLastChecked();
|
await loadLastChecked();
|
||||||
await loadMyFeeds();
|
await loadMyFeeds();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue