"use client"; import { useEffect, useState } from "react"; import { motion } from "framer-motion"; import { platformDownloads, releaseVersion } from "./release-links.generated"; import { DOWNLOAD_COUNT_SEED, getTrackedDownloadHref } from "../lib/downloads"; export function DownloadSection() { const [downloadCount, setDownloadCount] = useState(DOWNLOAD_COUNT_SEED); useEffect(() => { let cancelled = false; async function loadDownloadCount() { try { const response = await fetch("/api/download-stats", { cache: "no-store" }); if (!response.ok) { throw new Error(`Failed to fetch download count: ${response.status}`); } const data = await response.json() as { downloads?: number }; if (!cancelled && typeof data.downloads === "number") { setDownloadCount(data.downloads); } } catch { // Keep the seeded count visible when the dynamic endpoint is unavailable. } } void loadDownloadCount(); return () => { cancelled = true; }; }, []); return (

Download

Install the Right Build for Your Machine

Version {releaseVersion} ยท {downloadCount.toLocaleString("en-US")} downloads

{platformDownloads.map((download, index) => (

{download.title}

{download.note}

{download.assets.map((asset) => ( {asset.label} ))}
))}
); }