From d9d5becd8ae3f23175607e8e419618f10895d02d Mon Sep 17 00:00:00 2001 From: r-freeman Date: Sun, 29 Jan 2023 11:24:06 +0000 Subject: [PATCH] Updated dashboard --- lib/dashboard.ts | 14 +++++++------- pages/dashboard.tsx | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/dashboard.ts b/lib/dashboard.ts index 7677201..be0e4e6 100644 --- a/lib/dashboard.ts +++ b/lib/dashboard.ts @@ -9,33 +9,33 @@ export async function dashboard() { ]) const totalStars = await getTotalStars(totalRepos) - const articles = await getAllArticles() - const {views} = await getViews() + const totalArticles = (await getAllArticles()).length + const totalArticleViews = (await getViews()).views return [ { title: "GitHub Repos", - total: totalRepos, + metric: totalRepos, href: "https://github.com/r-freeman?tab=repositories" }, { title: "GitHub Followers", - total: totalFollowers, + metric: totalFollowers, href: "https://github.com/r-freeman?tab=followers" }, { title: "GitHub Stars", - total: totalStars, + metric: totalStars, href: "https://github.com/r-freeman/" }, { title: "Total Articles", - total: articles.length, + metric: totalArticles, href: "/writing" }, { title: "Total Article Views", - total: views, + metric: totalArticleViews, href: "/writing" } ] diff --git a/pages/dashboard.tsx b/pages/dashboard.tsx index cf9f5ab..2a787aa 100644 --- a/pages/dashboard.tsx +++ b/pages/dashboard.tsx @@ -7,7 +7,7 @@ import {dashboard} from '@/lib/dashboard' type CardProps = { title: string - total: number + metric: number href: string } @@ -44,7 +44,7 @@ export default function Dashboard({cards}: { cards: CardProps[] }) { {card.title} - {numberFormat(card.total)} + {numberFormat(card.metric)} ))} @@ -57,7 +57,7 @@ export default function Dashboard({cards}: { cards: CardProps[] }) { export const getStaticProps: GetStaticProps = async () => { return { props: { - cards: (await dashboard()) + cards: await dashboard() } } }