import styles from "../../../styles/modules/Category.module.scss"; import Link from "next/link"; import { ArticleWithIncludes, CategoryWithIncludes, FetchManager } from "../../../manager/fetchManager"; import { formatTextToUrlName } from "../../../utils"; export default async function CategoryPage({ params }: { params: { categoryName: string } }) { const categoryName = formatTextToUrlName(params.categoryName); const category: CategoryWithIncludes = await FetchManager.Category.get(categoryName); const allArticles: ArticleWithIncludes[] = await FetchManager.Article.getByCategory(categoryName); // const popularArticles: Article[] = await GetPopularArticles(categoryName); // const recentArticles: Article[] = await GetRecentArticles(categoryName); return (

{category?.title}

Most popular articles

{/* {popularArticles?.map((a, i) => { { return ( {a.title} ); } })} */}
{/*

Most recent articles

{recentArticles?.map((a, i) => { { return ( {a.name} ); } })}
*/}

All articles

{allArticles ? Array.from(allArticles).map((a, i) => { { return ( {a.title} ); } }) : ""}
); }