From 074d5814ba3d2cb298ce094f3df161518cc624c1 Mon Sep 17 00:00:00 2001 From: shadcn Date: Thu, 10 Nov 2022 18:56:09 +0400 Subject: [PATCH] feat: add footer --- app/(marketing)/page.tsx | 57 ++++++++++++++++++++++++++++++++++++++-- package.json | 1 + yarn.lock | 5 ++++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/app/(marketing)/page.tsx b/app/(marketing)/page.tsx index bcd0f38..8597400 100644 --- a/app/(marketing)/page.tsx +++ b/app/(marketing)/page.tsx @@ -1,15 +1,34 @@ import Link from "next/link" +import { toWords } from "number-to-words" import { Icons } from "@/components/icons" -export default function IndexPage() { +async function getGitHubStars(): Promise { + const response = await fetch("https://api.github.com/repos/shadcn/taxonomy", { + next: { + revalidate: 60, + }, + }) + + if (!response?.ok) { + return null + } + + const json = await response.json() + + return toWords(json["stargazers_count"]) +} + +export default async function IndexPage() { + const stars = await getGitHubStars() + return ( <>
Follow development on Twitter @@ -147,6 +166,40 @@ export default function IndexPage() {

+
+
+

+ Proudly Open Source +

+

+ Taxonomy is open source and powered by open source software. The + code is available on{" "} + + GitHub + + . I copied this footer from{" "} + + dub.sh + +

+
+

+ {stars} stars on GitHub +

+
+
+
+
) } diff --git a/package.json b/package.json index 3d37e2a..5294d44 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "next-mdx-remote": "^4.1.0", "node-cache": "^5.1.2", "nodemailer": "^6.8.0", + "number-to-words": "^1.2.4", "postmark": "^3.0.14", "prop-types": "^15.8.1", "react": "^18.2.0", diff --git a/yarn.lock b/yarn.lock index 3e33872..06c10d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2821,6 +2821,11 @@ normalize-range@^0.1.2: resolved "https://registry.yarnpkg.com/normalize-range/-/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942" integrity sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA== +number-to-words@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/number-to-words/-/number-to-words-1.2.4.tgz#e0f124de9628f8d86c4eeb89bac6c07699264501" + integrity sha512-/fYevVkXRcyBiZDg6yzZbm0RuaD6i0qRfn8yr+6D0KgBMOndFPxuW10qCHpzs50nN8qKuv78k8MuotZhcVX6Pw== + oauth@^0.9.15: version "0.9.15" resolved "https://registry.yarnpkg.com/oauth/-/oauth-0.9.15.tgz#bd1fefaf686c96b75475aed5196412ff60cfb9c1"