"use client"; import { useEffect, useState } from "react"; import DynamicMapContainer from "@/components/ui/DynamicMapContainer"; import { Eyebrow, H3, P } from "@/components/Texts"; type StatKey = "cores" | "nodes" | "ssd" | "countries"; type StatsData = Record; const STAT_API_URL = "https://stats.grid.tf/api/stats-summary"; const DEFAULT_STATS: StatsData = { cores: "31,669", nodes: "1157", ssd: "4,199,303", countries: "41", }; const STAT_CARDS: Array<{ key: StatKey; title: string; description: string }> = [ { key: "ssd", title: "SSD CAPACITY", description: "Total GB of storage (SSD, HDD, & RAM) on the grid.", }, { key: "cores", title: "CORES", description: "Total Central Processing Unit cores available on the grid.", }, { key: "nodes", title: "NODES", description: "Total number of nodes on the grid.", }, { key: "countries", title: "COUNTRIES", description: "Total number of countries with active nodes.", }, ]; export function HomeMap() { const [stats, setStats] = useState(DEFAULT_STATS); const [isLoading, setIsLoading] = useState(true); useEffect(() => { let isMounted = true; const formatValue = (value: unknown, fallback: string) => { if (typeof value === "number") { return value.toLocaleString(); } if (typeof value === "string" && value.trim().length) { const numeric = Number(value); return Number.isNaN(numeric) ? value : numeric.toLocaleString(); } return fallback; }; async function fetchStats() { try { const response = await fetch(STAT_API_URL); if (!response.ok) { throw new Error(`Request failed with ${response.status}`); } const data = await response.json(); if (!isMounted) return; setStats({ cores: formatValue(data?.cores, DEFAULT_STATS.cores), nodes: formatValue(data?.nodes, DEFAULT_STATS.nodes), ssd: formatValue(data?.ssd, DEFAULT_STATS.ssd), countries: formatValue(data?.countries, DEFAULT_STATS.countries), }); } catch (error) { console.error("[HomeMap] Failed to load stats", error); } finally { if (isMounted) { setIsLoading(false); } } } fetchStats(); return () => { isMounted = false; }; }, []); return (
{/* ✅ Top horizontal line with spacing */}
PROJECT MYCELIUM IS LIVE.

Host a Node, Grow the Network

Mycelium runs on nodes hosted by people and organizations around the world. Each node adds compute, storage, and bandwidth, expanding the network’s capacity and resilience.

You can share your idle resources and earn rewards when they are used. Configure it once. Your node takes over from there.

{/* ✅ Match same side margins */}
{STAT_CARDS.map(({ key, title, description }) => (
{title}
{isLoading ? "…" : stats[key]}

{description}

))}
{/* ✅ Bottom horizontal line with spacing */}
); }