diff --git a/src/lib/components/blocks/CalendarBlock.svelte b/src/lib/components/blocks/CalendarBlock.svelte index 4cdb5f0..fe79b37 100644 --- a/src/lib/components/blocks/CalendarBlock.svelte +++ b/src/lib/components/blocks/CalendarBlock.svelte @@ -405,6 +405,24 @@ t(T.calendar_weekday_so), ]); + let hasHover = $state(false); + let tooltipDay = $state(null); + let tooltipPos = $state({ x: 0, y: 0 }); + + function showTooltip(e: MouseEvent, key: string) { + if (!hasHover) return; + const r = (e.currentTarget as HTMLElement).getBoundingClientRect(); + tooltipPos = { x: r.left + r.width / 2, y: r.top }; + tooltipDay = key; + } + function hideTooltip() { + tooltipDay = null; + } + + const tooltipEvents = $derived( + tooltipDay ? (eventsByDay.get(tooltipDay) ?? []) : [], + ); + let feedHost = $state(""); const webcalUrl = $derived( feedHost ? `webcal://${feedHost}/api/kalender.ics` : "#", @@ -474,6 +492,9 @@ onMount(() => { feedHost = window.location.host; + hasHover = window.matchMedia( + "(hover: hover) and (pointer: fine)", + ).matches; tickTimer = setInterval(() => { nowMs = Date.now(); }, 60_000); @@ -852,13 +873,13 @@ Tag-Grid. Klick auf Tag filtert Liste unten. -->
-
+
{monthLabel}