fix: mini-cal marks full multi-day span; short week events show title inline

- Mini calendar: mark every day an event spans (not just the start day) so
  multi-day events (Urlaub/Ferien) show a dot across the whole range
- Week view: render short events on one line (time next to title) so the title
  stays visible; drop the location line when there's no room

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-07-01 09:42:02 +02:00
parent 906241a743
commit f791160d1a
3 changed files with 25 additions and 6 deletions

View File

@@ -576,11 +576,22 @@ function renderMiniCal() {
const DOW_LABELS = weekStartDay === 'sunday' ? DOW_SUNDAY : DOW_MONDAY;
miniDowEls.forEach((el, i) => { el.textContent = DOW_LABELS[i]; });
// Build event date set
const eventDates = new Set(state.events.map(ev => {
// Build event date set — mark every day an event spans, not just its start
// day, so multi-day events (Urlaub/Ferien) show a dot across the whole range.
const eventDates = new Set();
state.events.forEach(ev => {
const s = new Date(ev.start);
return `${s.getFullYear()}-${s.getMonth()}-${s.getDate()}`;
}));
let end = new Date(ev.end || ev.start);
// All-day events store an exclusive end → step back to the last real day.
if (ev.allDay) { end.setHours(0, 0, 0, 0); if (end > s) end.setDate(end.getDate() - 1); }
const cur = new Date(s.getFullYear(), s.getMonth(), s.getDate());
const last = new Date(end.getFullYear(), end.getMonth(), end.getDate());
let guard = 0;
while (cur <= last && guard++ < 400) {
eventDates.add(`${cur.getFullYear()}-${cur.getMonth()}-${cur.getDate()}`);
cur.setDate(cur.getDate() + 1);
}
});
const days = [];
const cur = new Date(gridStart);

View File

@@ -124,8 +124,12 @@ export function renderWeek(container, currentDate, events, onSlotClick, onEventC
const color = ev.color || ev.calendarColor || '#4285f4';
const pastCls = isPast(ev) ? 'past' : '';
const startStr = fmtTime(s);
const locHtml = ev.location ? `<div class="ev-loc">${escHtml(ev.location)}</div>` : '';
return `<div class="timed-event ${pastCls}"
// Short events lack the vertical room to stack time over title, so render
// them on one line (time next to title) and drop the location.
const isShort = height < 34;
const shortCls = isShort ? 'short' : '';
const locHtml = (!isShort && ev.location) ? `<div class="ev-loc">${escHtml(ev.location)}</div>` : '';
return `<div class="timed-event ${pastCls} ${shortCls}"
style="top:${top}px;height:${height}px;left:${left}%;width:${width}%;background:${color};color:#fff"
data-id="${ev.id}" data-url="${escAttr(ev.url)}" title="${escAttr(ev.title)}">
<div class="ev-time">${startStr}</div>