Fix popups
This commit is contained in:
fraxle
2026-05-19 01:27:03 +01:00
parent fc1795bb70
commit ab9cccd38d
2 changed files with 10 additions and 9 deletions
+3 -3
View File
@@ -1348,10 +1348,10 @@ ${isPro && (activeProfile === 'custom' || activeCols['air']) && html`<button cla
<span>${localHHMM}</span> <span>${localHHMM}</span>
${(() => { ${(() => {
const rowEvents = getCellTagEvents(selectedDayEvents, r); const rowEvents = getCellTagEvents(selectedDayEvents, r);
return rowEvents.map(ev => html` return rowEvents.map((ev, idx) => html`
<span key=${ev.id} class="event-cell-tag" <span key=${ev.id} class="event-cell-tag"
onClick=${(e) => handleEventTagClick(rowEvents, e)} onClick=${(e) => handleEventTagClick(rowEvents, idx, e)}
onMouseEnter=${(e) => handleEventTagEnter(rowEvents, e)} onMouseEnter=${(e) => handleEventTagEnter(rowEvents, idx, e)}
onMouseLeave=${handleEventTagLeave} onMouseLeave=${handleEventTagLeave}
role="button" tabIndex="0" aria-label=${ev.title} role="button" tabIndex="0" aria-label=${ev.title}
>${ev.emoji}</span> >${ev.emoji}</span>
+7 -6
View File
@@ -149,9 +149,10 @@ export function useColumnPopup() {
}, [eventTagPopup, evSlideTo]); }, [eventTagPopup, evSlideTo]);
// --- Event tag popup handlers ---------------------------------------- // --- Event tag popup handlers ----------------------------------------
const openEventTagPopup = (events, spanEl) => { const openEventTagPopup = (events, spanEl, startIndex = 0) => {
clearInterval(evSlideTimerRef.current); clearInterval(evSlideTimerRef.current);
setEvSlideIndex(0); setEvSlideIndex(startIndex);
prevSlideIndexRef.current = startIndex;
setEvTransition(null); setEvTransition(null);
setEventTagPopup({ events, ...calcEventPopupPos(spanEl) }); setEventTagPopup({ events, ...calcEventPopupPos(spanEl) });
}; };
@@ -166,7 +167,7 @@ export function useColumnPopup() {
}; };
// rowEvents = all events for that row (passed in from app.js) // rowEvents = all events for that row (passed in from app.js)
const handleEventTagClick = (rowEvents, e) => { const handleEventTagClick = (rowEvents, startIndex, e) => {
e.stopPropagation(); e.stopPropagation();
clearTimeout(evHoverTimerRef.current); clearTimeout(evHoverTimerRef.current);
clearTimeout(evCloseTimerRef.current); clearTimeout(evCloseTimerRef.current);
@@ -174,14 +175,14 @@ export function useColumnPopup() {
if (eventTagPopup && JSON.stringify(eventTagPopup.events.map(ev => ev.id)) === JSON.stringify(rowEvents.map(ev => ev.id))) { if (eventTagPopup && JSON.stringify(eventTagPopup.events.map(ev => ev.id)) === JSON.stringify(rowEvents.map(ev => ev.id))) {
closeEventTagPopup(); return; closeEventTagPopup(); return;
} }
openEventTagPopup(rowEvents, e.currentTarget); openEventTagPopup(rowEvents, e.currentTarget, startIndex);
}; };
const handleEventTagEnter = (rowEvents, e) => { const handleEventTagEnter = (rowEvents, startIndex, e) => {
clearTimeout(evHoverTimerRef.current); clearTimeout(evHoverTimerRef.current);
clearTimeout(evCloseTimerRef.current); clearTimeout(evCloseTimerRef.current);
const spanEl = e.currentTarget; const spanEl = e.currentTarget;
evHoverTimerRef.current = setTimeout(() => openEventTagPopup(rowEvents, spanEl), 700); evHoverTimerRef.current = setTimeout(() => openEventTagPopup(rowEvents, spanEl, startIndex), 700);
}; };
const handleEventTagLeave = () => clearTimeout(evHoverTimerRef.current); const handleEventTagLeave = () => clearTimeout(evHoverTimerRef.current);