From 1b304567c8a936ac0388a53677052bf64e39050c Mon Sep 17 00:00:00 2001 From: Dicken Date: Thu, 4 Jun 2026 08:46:25 +0200 Subject: [PATCH] Fix QuickLinkIcon: Favicon immer aus URL ableiten wenn kein gespeichertes Icon, Fallback auf Emoji --- frontend/src/App.jsx | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 69ea3bb..85e8c56 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -453,15 +453,31 @@ function QuickLinksCarousel({ links }) { } function QuickLinkIcon({ l }) { + const [imgOk, setImgOk] = useState(true); + + // Favicon-URL bauen: gespeicherten Wert nehmen oder aus URL ableiten + const faviconUrl = (() => { + if (l.icon && l.icon.startsWith('http')) return l.icon; + try { + const host = new URL(l.url).hostname; + return `https://www.google.com/s2/favicons?sz=64&domain=${host}`; + } catch { return null; } + })(); + + const showEmoji = !faviconUrl || !imgOk; + const fallbackEmoji = l.icon && !l.icon.startsWith('http') ? l.icon : '🔗'; + return ( - {l.icon && l.icon.startsWith('http') - ? e.target.style.display='none'}/> - : {l.icon}} + {!showEmoji + ? setImgOk(false)}/> + : {fallbackEmoji} + } {l.title}