From 2d7e1ccc05fb015fc46d947b203e35ccbebaaf0e Mon Sep 17 00:00:00 2001 From: Peer Richelsen Date: Fri, 25 Mar 2022 23:44:27 +0100 Subject: [PATCH] added categories index (#2286) --- apps/web/pages/apps/categories/index.tsx | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 apps/web/pages/apps/categories/index.tsx diff --git a/apps/web/pages/apps/categories/index.tsx b/apps/web/pages/apps/categories/index.tsx new file mode 100644 index 00000000..18104d00 --- /dev/null +++ b/apps/web/pages/apps/categories/index.tsx @@ -0,0 +1,44 @@ +import { ChevronLeftIcon } from "@heroicons/react/outline"; +import { InferGetStaticPropsType } from "next"; +import Link from "next/link"; + +import { getAppRegistry } from "@calcom/app-store/_appRegistry"; +import { useLocale } from "@calcom/lib/hooks/useLocale"; + +import Shell from "@components/Shell"; +import AppStoreCategories from "@components/apps/Categories"; + +export default function Apps({ categories }: InferGetStaticPropsType) { + const { t } = useLocale(); + + return ( + +
+
+ + + {t("browse_apps")} + + +
+
+
+ +
+
+ ); +} + +export const getStaticProps = async () => { + const appStore = getAppRegistry(); + const categories = appStore.reduce((c, app) => { + c[app.category] = c[app.category] ? c[app.category] + 1 : 1; + return c; + }, {} as Record); + + return { + props: { + categories: Object.entries(categories).map(([name, count]) => ({ name, count })), + }, + }; +};