import Link from 'next/link'; import { VerticalLine } from '../line'; import { PlusLine } from '../line'; import { HorizontalLine } from '../line'; import { Section } from '../section'; import { Button } from '../ui/button'; import { WorldMap } from '../world-map'; function shortNumber(num: number) { if (num < 1e3) return num; if (num >= 1e3 && num < 1e6) return `${+(num / 1e3).toFixed(1)}K`; if (num >= 1e6 && num < 1e9) return `${+(num / 1e6).toFixed(1)}M`; if (num >= 1e9 && num < 1e12) return `${+(num / 1e9).toFixed(1)}B`; if (num >= 1e12) return `${+(num / 1e12).toFixed(1)}T`; } export async function Stats() { const { projectsCount, eventsCount, eventsLast24hCount } = await fetch( `${process.env.NEXT_PUBLIC_API_URL}/misc/stats`, ) .then((res) => res.json()) .catch(() => ({ projectsCount: 0, eventsCount: 0, eventsLast24hCount: 0, })); return ( ); } export function StatsPure({ projectCount, eventCount, last24hCount, }: { projectCount: number; eventCount: number; last24hCount: number }) { return ( {/* Map */} {/* Gradient over Map */} Active projects {projectCount} Total events {shortNumber(eventCount)} Events last 24 h {shortNumber(last24hCount)} Get the analytics you deserve Try it for free ); }
Get the analytics you deserve