import Head from 'next/head' import {GetStaticProps} from 'next' import useSWR from 'swr' import {SimpleLayout} from '@/components/SimpleLayout' import {Card} from '@/components/Card' import {numberFormat} from '@/lib/numberFormat' import fetcher from '@/lib/fetcher' import {getTotalFollowers, getTotalRepos, getTotalStars} from '@/lib/github' type DashboardProps = { totalRepos: number totalFollowers: number totalStars: number } export default function Dashboard({totalRepos, totalFollowers, totalStars}: DashboardProps) { const {data} = useSWR('/api/views/', fetcher) const totalArticleViews = Number(data?.views) return ( <> Dashboard - Ryan Freeman ) } export const getStaticProps: GetStaticProps = async () => { const [totalRepos, totalFollowers] = await Promise.all([ getTotalRepos(), getTotalFollowers() ]) const totalStars = await getTotalStars(totalRepos) return { props: { totalRepos, totalFollowers, totalStars } } }