From 6ef5bd54d5cdea80adc6972dbcb662908b3e39dd Mon Sep 17 00:00:00 2001 From: real-zephex Date: Sun, 19 May 2024 08:00:13 +0530 Subject: added series support --- src/app/web-series/components/HomePageModules.jsx | 56 +++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/app/web-series/components/HomePageModules.jsx (limited to 'src/app/web-series/components/HomePageModules.jsx') diff --git a/src/app/web-series/components/HomePageModules.jsx b/src/app/web-series/components/HomePageModules.jsx new file mode 100644 index 0000000..90af2f8 --- /dev/null +++ b/src/app/web-series/components/HomePageModules.jsx @@ -0,0 +1,56 @@ +import { POPULAR_SHOWS, TRENDING_SHOWS, TOP_SHOWS } from "./data-fetch"; +import styles from "../styles/pages.module.css"; +import Image from "next/image"; +import Link from "next/link"; +import PreFecthSeriesInfo from "./cacher"; + +const HomepageUtils = async (type) => { + const fetchFunctions = { + popular: POPULAR_SHOWS, + trending: TRENDING_SHOWS, + top: TOP_SHOWS, + }; + + const fetchData = fetchFunctions[type]; + + if (fetchData) { + return await fetchData(); + } else { + return; + } +}; + +const Pages = async ({ type: type }) => { + const data = await HomepageUtils(type); + PreFecthSeriesInfo(data); + return ( +
+

{type} series

+
+ {data && + data.results.length > 0 && + data.results.map((item, index) => ( + +
+ Series Poster +

{item.name || "Not sure"}

+
+ + ))} +
+
+ ); +}; + +export default Pages; -- cgit v1.2.3