This commit is contained in:
Thomas Camlong
2025-04-17 15:42:07 +02:00
parent 16d6e34c3f
commit ad849b8deb
5 changed files with 114 additions and 88 deletions

View File

@@ -1,6 +1,6 @@
import { HeroSection } from "@/components/hero"
import { RecentlyAddedIcons } from "@/components/recently-added-icons"
import { BASE_URL } from "@/constants"
import { BASE_URL, REPO_NAME, REPO_PATH } from "@/constants"
import { getRecentlyAddedIcons, getTotalIcons } from "@/lib/api"
import type { Metadata } from "next"
@@ -37,13 +37,21 @@ export async function generateMetadata(): Promise<Metadata> {
}
}
async function getGitHubStars() {
const response = await fetch(`https://api.github.com/repos/${REPO_NAME}`)
const data = await response.json()
console.log(`GitHub stars: ${data.stargazers_count}`)
return data.stargazers_count
}
export default async function Home() {
const { totalIcons } = await getTotalIcons()
const recentIcons = await getRecentlyAddedIcons(10)
const stars = await getGitHubStars()
return (
<div className="flex flex-col min-h-screen">
<HeroSection totalIcons={totalIcons} />
<HeroSection totalIcons={totalIcons} stars={stars} />
<RecentlyAddedIcons icons={recentIcons} />
</div>
)