Dateien nach "frontend/src" hochladen

This commit is contained in:
2026-05-26 14:57:28 +02:00
parent 7b6bf964cb
commit d713a738ee

View File

@@ -86,9 +86,9 @@ export default function CalendarWidget() {
const [today] = useState(new Date());
const [cur, setCur] = useState({ y: today.getFullYear(), m: today.getMonth() });
const [events, setEvents] = useState([]);
const [feeds, setFeeds] = useState(() => {
try { return JSON.parse(localStorage.getItem('dd_cal_feeds') || '[]'); } catch { return []; }
});
// Feeds immer frisch aus localStorage lesen
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
@@ -121,7 +121,8 @@ export default function CalendarWidget() {
setLoading(false);
};
useEffect(() => { if (isOpen && feeds.length > 0) loadFeeds(feeds); }, [isOpen]);
const refresh = () => { const f = getFeeds(); if (f.length > 0) loadFeeds(f); setFeedCount(f.length); };
useEffect(() => { if (isOpen) refresh(); }, [isOpen]);
// Calendar grid
const days = useMemo(() => {
@@ -150,8 +151,8 @@ export default function CalendarWidget() {
<span style={{ color:'rgba(255,255,255,0.4)', fontSize:11, display:'inline-block',
transform:isOpen?'rotate(90deg)':'rotate(0)', transition:'transform 0.2s' }}></span>
</button>
{isOpen && feeds.length > 0 && (
<button onClick={()=>loadFeeds(feeds)} disabled={loading}
{isOpen && getFeeds().length > 0 && (
<button onClick={refresh} disabled={loading}
style={{ background:'transparent', border:'none', color:'rgba(255,255,255,0.4)',
cursor:'pointer', fontSize:13, padding:'0 0 0 8px', marginLeft:8 }}
title="Neu laden">
@@ -252,7 +253,7 @@ export default function CalendarWidget() {
</div>
)}
{feeds.length === 0 && (
{getFeeds().length === 0 && (
<div style={{ marginTop:10, color:'rgba(255,255,255,0.3)', fontFamily:'monospace', fontSize:11, textAlign:'center' }}>
Noch keine Kalender abonniert. Füge Kalender in den Einstellungen hinzu.
</div>