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:
@@ -915,6 +915,10 @@ a { color: var(--primary); text-decoration: none; }
|
|||||||
.timed-event .ev-time { font-size: 10px; opacity: .85; }
|
.timed-event .ev-time { font-size: 10px; opacity: .85; }
|
||||||
.timed-event .ev-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
.timed-event .ev-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
.timed-event .ev-loc { font-size: 10px; opacity: .75; white-space: nowrap; overflow: hidden; }
|
.timed-event .ev-loc { font-size: 10px; opacity: .75; white-space: nowrap; overflow: hidden; }
|
||||||
|
/* Short events: time and title on one line so the title stays visible. */
|
||||||
|
.timed-event.short { display: flex; flex-direction: row; align-items: baseline; gap: 4px; }
|
||||||
|
.timed-event.short .ev-time { flex-shrink: 0; }
|
||||||
|
.timed-event.short .ev-title { flex: 1; min-width: 0; }
|
||||||
|
|
||||||
/* Day view specifics */
|
/* Day view specifics */
|
||||||
.day-view .week-day-col { flex: 1; }
|
.day-view .week-day-col { flex: 1; }
|
||||||
|
|||||||
@@ -576,11 +576,22 @@ function renderMiniCal() {
|
|||||||
const DOW_LABELS = weekStartDay === 'sunday' ? DOW_SUNDAY : DOW_MONDAY;
|
const DOW_LABELS = weekStartDay === 'sunday' ? DOW_SUNDAY : DOW_MONDAY;
|
||||||
miniDowEls.forEach((el, i) => { el.textContent = DOW_LABELS[i]; });
|
miniDowEls.forEach((el, i) => { el.textContent = DOW_LABELS[i]; });
|
||||||
|
|
||||||
// Build event date set
|
// Build event date set — mark every day an event spans, not just its start
|
||||||
const eventDates = new Set(state.events.map(ev => {
|
// 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);
|
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 days = [];
|
||||||
const cur = new Date(gridStart);
|
const cur = new Date(gridStart);
|
||||||
|
|||||||
@@ -124,8 +124,12 @@ export function renderWeek(container, currentDate, events, onSlotClick, onEventC
|
|||||||
const color = ev.color || ev.calendarColor || '#4285f4';
|
const color = ev.color || ev.calendarColor || '#4285f4';
|
||||||
const pastCls = isPast(ev) ? 'past' : '';
|
const pastCls = isPast(ev) ? 'past' : '';
|
||||||
const startStr = fmtTime(s);
|
const startStr = fmtTime(s);
|
||||||
const locHtml = ev.location ? `<div class="ev-loc">${escHtml(ev.location)}</div>` : '';
|
// Short events lack the vertical room to stack time over title, so render
|
||||||
return `<div class="timed-event ${pastCls}"
|
// 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"
|
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)}">
|
data-id="${ev.id}" data-url="${escAttr(ev.url)}" title="${escAttr(ev.title)}">
|
||||||
<div class="ev-time">${startStr}</div>
|
<div class="ev-time">${startStr}</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user