diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index dc2a61c..f0cb773 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -437,19 +437,17 @@ function BottomNav({ active, setActive, user, onLogout, updateInfo, onUpdateClic // ── Dashboard Widgets ───────────────────────────────────────────────────────── // ── QuickLinks Carousel (Mobile) ───────────────────────────────────────────── function QuickLinksCarousel({ links }) { - const iconW = 58; const gap = 6; - const containerW = window.innerWidth - 28; - const perRow = Math.max(3, Math.floor((containerW + gap) / (iconW + gap))); + const perRow = 4; + const gap = 6; const pageSize = perRow * 2; const pageCount = Math.ceil(links.length / pageSize); const [page, setPage] = useState(0); const scrollRef = useRef(null); - // Sync scroll position → page indicator const onScroll = () => { if (!scrollRef.current) return; - const p = Math.round(scrollRef.current.scrollLeft / containerW); + const p = Math.round(scrollRef.current.scrollLeft / scrollRef.current.offsetWidth); setPage(p); }; @@ -457,18 +455,17 @@ function QuickLinksCarousel({ links }) { const canRight = page < pageCount - 1; const scrollTo = (p) => { - scrollRef.current?.scrollTo({ left: p * containerW, behavior:'smooth' }); + scrollRef.current?.scrollTo({ left: p * scrollRef.current.offsetWidth, behavior:'smooth' }); }; if (pageCount <= 1) return ( -