From b0cba6774aa4a4da1309fae74f7af8642a23e982 Mon Sep 17 00:00:00 2001 From: AKHIL Date: Thu, 16 Jul 2026 13:51:28 +0530 Subject: [PATCH] UI --- apps/desktop/scripts/release-local.sh | 5 +- apps/web/src/app/page.tsx | 25 ++++---- .../components/download-desktop-button.tsx | 63 +++---------------- 3 files changed, 24 insertions(+), 69 deletions(-) diff --git a/apps/desktop/scripts/release-local.sh b/apps/desktop/scripts/release-local.sh index ff582ba5..2dab55e8 100755 --- a/apps/desktop/scripts/release-local.sh +++ b/apps/desktop/scripts/release-local.sh @@ -120,8 +120,11 @@ node -e ' echo "▸ [5/5] Publishing to ${PUBLIC_REPO} ..." gh release create "$TAG" --repo "$PUBLIC_REPO" \ --title "MyDevTools $TAG" --notes "MyDevTools desktop $TAG" +# MyDevTools.dmg (version-less copy) keeps the website's download button URL +# stable: .../releases/latest/download/MyDevTools.dmg always serves the newest. +cp "$DMG" "$OUT/MyDevTools.dmg" gh release upload "$TAG" --repo "$PUBLIC_REPO" --clobber \ - "$DMG" "$TARGZ" "$SIG" "$LATEST" + "$DMG" "$OUT/MyDevTools.dmg" "$TARGZ" "$SIG" "$LATEST" echo "" echo "✅ Published v$VERSION. Installed apps will offer the update on next launch." diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsx index 12f4808b..57bb87b0 100644 --- a/apps/web/src/app/page.tsx +++ b/apps/web/src/app/page.tsx @@ -31,7 +31,9 @@ import { Users, Building2, Check, + Download as DownloadIcon, } from "lucide-react"; +import { AppleGlyph, DMG_URL } from "@/components/download-desktop-button"; import { sidebarData } from "@/components/sidebar/data/sidebar-data"; import { homepageFaqItems } from "@/lib/seo/structured-data"; import MdtAurora from "@/components/mdt-aurora"; @@ -352,32 +354,27 @@ export default function Page() { className="flex flex-col sm:flex-row items-center justify-center gap-3 pt-2" > - + + Download for macOS + + - - Explore Platform - {/* Stats row */} {[ { value: "80+", label: "Built-in Tools" }, { value: "AES-256", label: "Encrypted Sync" }, - { value: "Free", label: "To Get Started" }, ].map((s, i) => (
diff --git a/apps/web/src/components/download-desktop-button.tsx b/apps/web/src/components/download-desktop-button.tsx index 85d96185..8fcfe325 100644 --- a/apps/web/src/components/download-desktop-button.tsx +++ b/apps/web/src/components/download-desktop-button.tsx @@ -1,25 +1,16 @@ -"use client"; - -import { useEffect, useState } from "react"; -import { Download, Loader2 } from "lucide-react"; +import { Download } from "lucide-react"; import { Button } from "@/components/ui/button"; /** - * "Download for macOS" button. Reads the latest published GitHub release via the - * API and links straight to its universal .dmg asset, so the link stays current - * across releases without editing the site. Falls back to the releases page if - * the API is unreachable or no asset is found yet. + * GitHub's permanent "latest release" redirect — always serves the newest DMG. + * release-local.sh uploads a version-less MyDevTools.dmg to every release. */ -// Public releases-mirror repo (source repo is private, so its release assets -// aren't publicly downloadable). CI mirrors the DMG + latest.json here. -const REPO = "mydevtools-tech/mydevtools-releases"; -const RELEASES_PAGE = `https://github.com/${REPO}/releases/latest`; - -type Asset = { name: string; browser_download_url: string }; +export const DMG_URL = + "https://github.com/mydevtools-tech/mydevtools-releases/releases/latest/download/MyDevTools.dmg"; /** Minimal Apple logo (lucide has no Apple icon in this version). */ -function AppleGlyph({ className }: { className?: string }) { +export function AppleGlyph({ className }: { className?: string }) { return ( @@ -34,53 +25,17 @@ export function DownloadDesktopButton({ size?: "default" | "sm" | "lg"; className?: string; }) { - const [dmgUrl, setDmgUrl] = useState(null); - const [version, setVersion] = useState(null); - const [loading, setLoading] = useState(true); - - useEffect(() => { - let active = true; - fetch(`https://api.github.com/repos/${REPO}/releases/latest`, { - headers: { Accept: "application/vnd.github+json" }, - }) - .then((r) => (r.ok ? r.json() : Promise.reject(new Error(String(r.status))))) - .then((d) => { - if (!active) return; - const assets: Asset[] = Array.isArray(d.assets) ? d.assets : []; - const dmg = - assets.find((a) => /universal.*\.dmg$/i.test(a.name)) || - assets.find((a) => a.name.toLowerCase().endsWith(".dmg")); - setDmgUrl(dmg?.browser_download_url ?? null); - setVersion(typeof d.tag_name === "string" ? d.tag_name : null); - }) - .catch(() => { - /* offline / rate-limited / no release yet — fall back to releases page */ - }) - .finally(() => { - if (active) setLoading(false); - }); - return () => { - active = false; - }; - }, []); - - const href = dmgUrl ?? RELEASES_PAGE; - return (

- {version ? `${version} · ` : ""}Universal (Apple Silicon & Intel) · macOS 12+ + Universal (Apple Silicon & Intel) · macOS 12+

);