diff --git a/attached_assets/image_1772314714413.png b/attached_assets/image_1772314714413.png new file mode 100644 index 0000000..18cfe31 Binary files /dev/null and b/attached_assets/image_1772314714413.png differ diff --git a/attached_assets/image_1772314762863.png b/attached_assets/image_1772314762863.png new file mode 100644 index 0000000..a003f86 Binary files /dev/null and b/attached_assets/image_1772314762863.png differ diff --git a/client/src/pages/home.tsx b/client/src/pages/home.tsx index 02ff3cd..5412fd8 100644 --- a/client/src/pages/home.tsx +++ b/client/src/pages/home.tsx @@ -252,66 +252,16 @@ function TopStoriesList({ articles }: { articles: Article[] }) { } function FeaturedCarousel({ articles, popular, galleryImages, focalPoints }: { articles: Article[]; popular?: Article[]; galleryImages?: GalleryImage[]; focalPoints?: Record }) { - const hasGallery = galleryImages && galleryImages.length > 0; - const articlePages = Math.min(5, Math.max(1, articles.length)); - const total = articlePages + (hasGallery ? 1 : 0); - const [page, setPage] = useState(0); - const [paused, setPaused] = useState(false); - - const next = useCallback(() => { - setPage((p) => (p + 1) % total); - }, [total]); - - useEffect(() => { - if (paused || total <= 1) return; - const timer = setInterval(next, 8000); - return () => clearInterval(timer); - }, [paused, next, total]); - - const isGalleryPage = hasGallery && page === total - 1; - const isWidePage = page === 1; - - let hero: Article | null = null; - let side: Article[] = []; - - if (!isGalleryPage && articles.length > 0) { - hero = articles[page % articles.length]; - } - - if (articles.length > 0) { - const offset = isGalleryPage ? 0 : 1; - side = [ - articles[(page + offset) % articles.length], - articles[(page + offset + 1) % articles.length], - ]; - } + const featured = articles.slice(0, 3); return ( -
setPaused(true)} onMouseLeave={() => setPaused(false)}> -
-
- {isGalleryPage && galleryImages ? ( - - ) : hero ? ( - - ) : null} -
-
- {side.map((a) => ( - - ))} -
-
- {popular && popular.length > 0 && } -
+
+
+ {featured.map((a) => ( + + ))} + {popular && popular.length > 0 && }
- {total > 1 && ( -
- {Array.from({ length: total }).map((_, i) => ( -
- )}
); } @@ -357,9 +307,9 @@ export default function Home() { ); } - const row2 = articles.slice(0, 2); - const row3 = articles.slice(2, 4); - const remaining = articles.slice(4); + const row2 = articles.slice(3, 5); + const row3 = articles.slice(5, 7); + const remaining = articles.slice(7); const rows: Article[][] = []; for (let i = 0; i < remaining.length; i += 4) { rows.push(remaining.slice(i, i + 4));