Updated dashboard

This commit is contained in:
r-freeman 2023-01-29 11:24:06 +00:00
parent ab9c58116b
commit d9d5becd8a
2 changed files with 10 additions and 10 deletions

View File

@ -9,33 +9,33 @@ export async function dashboard() {
]) ])
const totalStars = await getTotalStars(totalRepos) const totalStars = await getTotalStars(totalRepos)
const articles = await getAllArticles() const totalArticles = (await getAllArticles()).length
const {views} = await getViews() const totalArticleViews = (await getViews()).views
return [ return [
{ {
title: "GitHub Repos", title: "GitHub Repos",
total: totalRepos, metric: totalRepos,
href: "https://github.com/r-freeman?tab=repositories" href: "https://github.com/r-freeman?tab=repositories"
}, },
{ {
title: "GitHub Followers", title: "GitHub Followers",
total: totalFollowers, metric: totalFollowers,
href: "https://github.com/r-freeman?tab=followers" href: "https://github.com/r-freeman?tab=followers"
}, },
{ {
title: "GitHub Stars", title: "GitHub Stars",
total: totalStars, metric: totalStars,
href: "https://github.com/r-freeman/" href: "https://github.com/r-freeman/"
}, },
{ {
title: "Total Articles", title: "Total Articles",
total: articles.length, metric: totalArticles,
href: "/writing" href: "/writing"
}, },
{ {
title: "Total Article Views", title: "Total Article Views",
total: views, metric: totalArticleViews,
href: "/writing" href: "/writing"
} }
] ]

View File

@ -7,7 +7,7 @@ import {dashboard} from '@/lib/dashboard'
type CardProps = { type CardProps = {
title: string title: string
total: number metric: number
href: string href: string
} }
@ -44,7 +44,7 @@ export default function Dashboard({cards}: { cards: CardProps[] }) {
<Card.Link href={card.href}>{card.title}</Card.Link> <Card.Link href={card.href}>{card.title}</Card.Link>
</h2> </h2>
<Card.Description className="text-zinc-800 dark:text-zinc-100 font-semibold text-5xl"> <Card.Description className="text-zinc-800 dark:text-zinc-100 font-semibold text-5xl">
{numberFormat(card.total)} {numberFormat(card.metric)}
</Card.Description> </Card.Description>
</Card> </Card>
))} ))}
@ -57,7 +57,7 @@ export default function Dashboard({cards}: { cards: CardProps[] }) {
export const getStaticProps: GetStaticProps = async () => { export const getStaticProps: GetStaticProps = async () => {
return { return {
props: { props: {
cards: (await dashboard()) cards: await dashboard()
} }
} }
} }