From 39de74320cbbff9f1912362994889a1be5a375b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Tue, 7 Jul 2026 22:17:48 -0400 Subject: [PATCH] Rebuild download section in adaline style - adaline heading + version/count line + three platform cards with Reicon download icons (components/sections) - preserve all business logic verbatim: the /api/download-stats count fetch with seeded fallback, and every asset link routed through getTrackedDownloadHref (/api/download?asset=...) so downloads stay counted and the real R2 URLs remain behind the server redirect --- landing/app/page.tsx | 2 +- landing/components/download-section.tsx | 105 ------------------ .../components/sections/download-section.tsx | 81 ++++++++++++++ 3 files changed, 82 insertions(+), 106 deletions(-) delete mode 100644 landing/components/download-section.tsx create mode 100644 landing/components/sections/download-section.tsx diff --git a/landing/app/page.tsx b/landing/app/page.tsx index 47b6d6f1..a35c9b51 100644 --- a/landing/app/page.tsx +++ b/landing/app/page.tsx @@ -1,4 +1,4 @@ -import { DownloadSection } from "../components/download-section"; +import { DownloadSection } from "../components/sections/download-section"; import { FAQ } from "../components/sections/faq"; import { Features } from "../components/sections/features"; import { Footer } from "../components/footer"; diff --git a/landing/components/download-section.tsx b/landing/components/download-section.tsx deleted file mode 100644 index dc5bbd1c..00000000 --- a/landing/components/download-section.tsx +++ /dev/null @@ -1,105 +0,0 @@ -"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} - - - ))} -
-
- ))} -
-
-
- ); -} diff --git a/landing/components/sections/download-section.tsx b/landing/components/sections/download-section.tsx new file mode 100644 index 00000000..6ef7f3cf --- /dev/null +++ b/landing/components/sections/download-section.tsx @@ -0,0 +1,81 @@ +"use client"; + +import { useEffect, useState } from "react"; +import { Download } from "reicon-react/icons/Download"; +import { Container } from "../ui/container"; +import { Reveal } from "../ui/reveal"; +import { SectionHeading } from "../ui/section-heading"; +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 ( +
+ + + + + + +

+ Version {releaseVersion} · {downloadCount.toLocaleString("en-US")} downloads +

+
+ + + {platformDownloads.map((platform) => ( +
+

{platform.title}

+

{platform.note}

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