|
1 | | -import { useEffect } from "react" |
2 | | -import { useRouter } from "next/router" |
3 | | -import cx from "classnames" |
| 1 | +import { useEffect } from "react"; |
| 2 | +import cx from "classnames"; |
4 | 3 |
|
5 | 4 | function kFormatter(num: number) { |
6 | | - return (Math.sign(num) * (Math.abs(num) / 1000)).toFixed(1) + "k" |
| 5 | + return (Math.sign(num) * (Math.abs(num) / 1000)).toFixed(1) + "k"; |
7 | 6 | } |
8 | 7 |
|
9 | 8 | export function Footer({ className = "" }) { |
10 | | - const router = useRouter() |
11 | | - |
12 | 9 | useEffect(() => { |
13 | 10 | fetch("https://api.github.com/repos/nextauthjs/next-auth") |
14 | 11 | .then((res) => res.json()) |
15 | 12 | .then((data) => { |
16 | | - const githubStat = document.querySelector(".github-counter")! |
17 | | - if (!githubStat) return |
18 | | - githubStat.innerHTML = kFormatter(data.stargazers_count ?? 21100) |
19 | | - }) |
20 | | - |
21 | | - // CarbonAds hydration error workaround hack |
22 | | - const carbonAdsEl = |
23 | | - document.querySelector<HTMLScriptElement>("#_carbonads_js") |
24 | | - if (carbonAdsEl) { |
25 | | - carbonAdsEl.src = |
26 | | - "https://cdn.carbonads.com/carbon.js?serve=CWYD42JY&placement=authjsdev&format=cover" |
27 | | - |
28 | | - router.events.on("routeChangeComplete", () => { |
29 | | - window._carbonads?.refresh() |
30 | | - }) |
31 | | - } |
32 | | - }, []) |
| 13 | + const githubStat = document.querySelector(".github-counter")!; |
| 14 | + if (!githubStat) return; |
| 15 | + githubStat.innerHTML = kFormatter(data.stargazers_count ?? 21100); |
| 16 | + }); |
| 17 | + }, []); |
33 | 18 | return ( |
34 | 19 | <div |
35 | 20 | className={cx( |
36 | 21 | "mx-auto flex w-full flex-col items-center gap-4 px-12 pb-20 pt-24 text-gray-600 sm:gap-12 dark:text-gray-100", |
37 | | - className |
| 22 | + className, |
38 | 23 | )} |
39 | 24 | > |
40 | 25 | <div className="flex w-full max-w-[90rem] flex-col justify-between gap-6 sm:flex-row sm:gap-0"> |
@@ -90,7 +75,7 @@ export function Footer({ className = "" }) { |
90 | 75 | Auth.js © Better Auth Inc. - {new Date().getFullYear()} |
91 | 76 | </div> |
92 | 77 | </div> |
93 | | - ) |
| 78 | + ); |
94 | 79 | } |
95 | 80 |
|
96 | | -export default Footer |
| 81 | +export default Footer; |
0 commit comments