diff --git a/client/src/pages/home.tsx b/client/src/pages/home.tsx index 80fc9cb..60e6fb2 100644 --- a/client/src/pages/home.tsx +++ b/client/src/pages/home.tsx @@ -518,6 +518,22 @@ export default function Home() { return copy.slice(0, 2); }, [articles]); + const bottomSection = useMemo(() => { + const items: { type: "widget" | "ad"; el: JSX.Element }[] = [ + { type: "widget", el: }, + { type: "widget", el:
}, + { type: "widget", el: }, + { type: "widget", el: }, + { type: "ad", el: }, + { type: "ad", el: }, + ]; + for (let i = items.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [items[i], items[j]] = [items[j], items[i]]; + } + return items; + }, []); + if (isLoading || !articles) { return (
@@ -565,6 +581,14 @@ export default function Home() {
))} +
+ {bottomSection.map((item, i) => ( +
+ {item.el} +
+ ))} +
+