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 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"
}
]

View File

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