From 7758487c9fa325ecc9cb047488831de078a5a1e4 Mon Sep 17 00:00:00 2001 From: Dicken Date: Sat, 13 Jun 2026 18:07:17 +0200 Subject: [PATCH] feat: Scroll-to-Top Button (erscheint ab 300px Scroll) --- frontend/src/App.jsx | 49 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index e35cd85..87a0963 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -3215,6 +3215,51 @@ function PublicUpload({ token }) { ); } +// ── Scroll-to-Top Button ────────────────────────────────────────────────── +function ScrollToTop({ scrollRef }) { + const [visible, setVisible] = useState(false); + + useEffect(() => { + const el = scrollRef?.current; + if (!el) return; + const onScroll = () => setVisible(el.scrollTop > 300); + el.addEventListener('scroll', onScroll, { passive: true }); + return () => el.removeEventListener('scroll', onScroll); + }, [scrollRef]); + + if (!visible) return null; + + return ( + + ); +} + + export default function App() { // Öffentliche Upload-Seite – kein Login, kein Auth const _uploadMatch = window.location.pathname.match(/^\/u\/(.+)$/); @@ -3303,6 +3348,7 @@ export default function App() { if(!user) return setUser(u)}/>; const activeTool = TOOLS.find(t=>t.id===active); + const mainRef = useRef(null); // Mobile padding bottom für fixed nav const isNachrichten = active === 'nachrichten'; @@ -3331,7 +3377,7 @@ export default function App() { unreadMsgs={unreadMsgs}/> )} -
+
{active==='dashboard' && { setUnreadBoard(0); setUnreadPromoted(0); }} unreadChangelog={unreadChangelog} onChangelogRead={()=>setUnreadChangelog(0)} user={user}/>} {active==='admin' && } {activeTool && } @@ -3343,6 +3389,7 @@ export default function App() { unreadMsgs={unreadMsgs}/> )} + );