import * as React from "react"; import websitePackage from "../package.json"; declare const __DESKTOP_VERSION__: string | undefined; export const desktopVersion = typeof __DESKTOP_VERSION__ !== "undefined" ? __DESKTOP_VERSION__ : websitePackage.version; export const releaseBase = `https://github.com/getpaseo/paseo/releases/download/v${desktopVersion}`; export const macAppleSiliconDownloadUrl = `${releaseBase}/Paseo-${desktopVersion}-arm64.dmg`; export const macIntelDownloadUrl = `${releaseBase}/Paseo-${desktopVersion}-x64.dmg`; export const linuxAppImageDownloadUrl = `${releaseBase}/Paseo-${desktopVersion}-x86_64.AppImage`; export const linuxDebDownloadUrl = `${releaseBase}/Paseo-${desktopVersion}-amd64.deb`; export const linuxRpmDownloadUrl = `${releaseBase}/Paseo-${desktopVersion}-x86_64.rpm`; export const appStoreUrl = "https://apps.apple.com/app/paseo-pocket-engineer/id6758887924"; export const playStoreUrl = "https://play.google.com/store/apps/details?id=sh.paseo"; export const webAppUrl = "https://app.paseo.sh"; type Platform = "mac-silicon" | "mac-intel" | "windows" | "linux"; export interface DownloadOption { platform: Platform; label: string; href: string; icon: (props: React.SVGProps) => React.ReactElement; } export const downloadOptions: DownloadOption[] = [ { platform: "mac-silicon", label: "Mac", href: macAppleSiliconDownloadUrl, icon: AppleIcon, }, { platform: "mac-intel", label: "Mac Intel", href: macIntelDownloadUrl, icon: AppleIcon, }, { platform: "windows", label: "Windows", href: `${releaseBase}/Paseo-Setup-${desktopVersion}.exe`, icon: WindowsIcon, }, { platform: "linux", label: "Linux", href: linuxAppImageDownloadUrl, icon: LinuxIcon, }, ]; export function useDetectedPlatform(): Platform { const [platform, setPlatform] = React.useState("mac-silicon"); React.useEffect(() => { const ua = navigator.userAgent.toLowerCase(); if (ua.includes("win")) { setPlatform("windows"); } else if (ua.includes("linux")) { setPlatform("linux"); } else if (ua.includes("mac")) { // Check for Apple Silicon vs Intel // navigator.platform is deprecated but still the most reliable check const isARM = /arm|aarch64/i.test(navigator.platform) || // Chrome/Edge on Apple Silicon report x86 platform but have ARM in userAgentData (navigator as unknown as { userAgentData?: { architecture?: string } }).userAgentData ?.architecture === "arm"; setPlatform(isARM ? "mac-silicon" : "mac-silicon"); // Default to Silicon for modern Macs } }, []); return platform; } export function AppleIcon(props: React.SVGProps) { return ( ); } export function AndroidIcon(props: React.SVGProps) { return ( ); } export function WindowsIcon(props: React.SVGProps) { return ( ); } export function LinuxIcon(props: React.SVGProps) { return ( ); } export function TerminalIcon(props: React.SVGProps) { return ( ); } export function GlobeIcon(props: React.SVGProps) { return ( ); }