diff --git a/frontend/src/calendar.jsx b/frontend/src/calendar.jsx index c060e67..fc296f4 100644 --- a/frontend/src/calendar.jsx +++ b/frontend/src/calendar.jsx @@ -90,7 +90,7 @@ export default function CalendarWidget() { const getFeeds = () => { try { return JSON.parse(localStorage.getItem('dd_cal_feeds') || '[]'); } catch { return []; } }; const [feedCount, setFeedCount] = useState(0); // trigger re-render const [loading, setLoading] = useState(false); - const [selected, setSelected] = useState(null); // date object + const [selected, setSelected] = useState(new Date()); // default: heute const [errors, setErrors] = useState([]); @@ -124,6 +124,15 @@ export default function CalendarWidget() { const refresh = () => { const f = getFeeds(); if (f.length > 0) loadFeeds(f); setFeedCount(f.length); }; useEffect(() => { if (isOpen) refresh(); }, [isOpen]); + // Nächster oder aktueller Termin (für zugeklappte Ansicht) + const nextEvent = useMemo(() => { + const now = new Date(); + const upcoming = events + .filter(e => e.dtend >= now) + .sort((a,b) => a.dtstart - b.dtstart); + return upcoming[0] || null; + }, [events]); + // Calendar grid const days = useMemo(() => { const first = new Date(cur.y, cur.m, 1); @@ -161,6 +170,24 @@ export default function CalendarWidget() { )} + {/* Nächster Termin auch im zugeklappten Zustand */} + {!isOpen && nextEvent && ( +