diff --git a/client/src/pages/home.tsx b/client/src/pages/home.tsx index 9becdd9..220a866 100644 --- a/client/src/pages/home.tsx +++ b/client/src/pages/home.tsx @@ -493,6 +493,19 @@ export default function Home() { return rows; }, [gridItems]); + const widePickedArticles = useMemo(() => { + if (!articles || articles.length < 3) return []; + const carouselIds = new Set(articles.slice(0, 9).map((a) => a.id)); + const candidates = articles.filter((a) => !carouselIds.has(a.id)); + const pool = candidates.length >= 2 ? candidates : articles; + const copy = [...pool]; + for (let i = copy.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [copy[i], copy[j]] = [copy[j], copy[i]]; + } + return copy.slice(0, 2); + }, [articles]); + if (isLoading || !articles) { return (