mirror of
https://github.com/Open-Dev-Society/OpenStock.git
synced 2026-10-12 04:19:29 +08:00
- Landing at / (app moved to /dashboard) with a live NYSE session dial and the real product preview; About, Help, Architecture and Terms made public and rebuilt. - /sponsor page with monthly tiers, one-time and custom options, prefilled GitHub Sponsors checkout links, and a sponsors band (open slots, previous sponsors) on every public page. Siray moved to previous sponsors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 lines
789 B
TypeScript
20 lines
789 B
TypeScript
import { cache } from "react";
|
|
|
|
// Real repo numbers for the public site, refreshed daily. Null hides the stat instead of guessing.
|
|
export const getRepoStats = cache(async () => {
|
|
try {
|
|
const res = await fetch('https://api.github.com/repos/Open-Dev-Society/OpenStock', {
|
|
next: { revalidate: 86400 },
|
|
signal: AbortSignal.timeout(4000),
|
|
});
|
|
if (!res.ok) return null;
|
|
const repo = await res.json();
|
|
return { stars: repo.stargazers_count as number, forks: repo.forks_count as number, license: repo.license?.spdx_id as string | undefined };
|
|
} catch {
|
|
return null;
|
|
}
|
|
});
|
|
|
|
export const formatCount = (n: number) =>
|
|
new Intl.NumberFormat('en-US', { notation: 'compact', maximumFractionDigits: 1 }).format(n);
|