import * as m from "motion/react-m" import { useEffect, useState, type ReactNode } from "react" import type { Platform } from "./platform" import { RELEASE } from "./release" export function AppleMark() { return ( ) } export function WindowsMark() { return ( ) } export function LinuxMark() { return ( ) } function ShareMark() { return ( ) } const SEP = "\u2002\u00b7\u2002" export const PLATFORM_NAMES: Record = { mac: "Mac", "mac-intel": "Mac", "windows-x64": "Windows", "windows-arm64": "Windows", linux: "Linux", mobile: "Mac, Windows, and Linux", } export const SHORTCUTS: Record = { mac: "Option", "mac-intel": "Option", "windows-x64": "Ctrl+Space", "windows-arm64": "Ctrl+Space", linux: "Alt+Space", mobile: "a shortcut", } function useCopy(): [boolean, (text: string) => void] { const [copied, setCopied] = useState(false) useEffect(() => { if (!copied) return const timer = setTimeout(() => setCopied(false), 1600) return () => clearTimeout(timer) }, [copied]) return [ copied, (text) => { void navigator.clipboard?.writeText(text).then(() => setCopied(true)) }, ] } function Command({ text, label }: { text: string; label: string }) { const [copied, copy] = useCopy() return (
{text}
) } function Button({ href, mark, children }: { href: string; mark: ReactNode; children: ReactNode }) { return ( {mark} {children} ) } function SendLink() { const [copied, copy] = useCopy() const send = () => { const url = location.origin + import.meta.env.BASE_URL if (navigator.share) { void navigator.share({ title: "Hex", text: "Voice dictation for Mac, Windows, and Linux", url }).catch(() => {}) } else { copy(url) } } return ( {copied ? "Link copied" : "Send yourself the link"} ) } const WINDOWS_NOTE = "The installer isn\u2019t code-signed yet, so Windows may say it protected your PC. Choose More info, then Run anyway." function Primary({ platform }: { platform: Platform }) { switch (platform) { case "mac": return ( <>

Version {RELEASE.mac.version} {SEP}Apple silicon{SEP}macOS 15 or later

) case "mac-intel": return ( <> Download for Mac

Hex needs a Mac with Apple silicon and macOS 15 or later.

) case "windows-x64": case "windows-arm64": { const arm = platform === "windows-arm64" const build = arm ? RELEASE.windowsArm64 : RELEASE.windowsX64 return ( <>

Version {build.version} {SEP}Windows 10 or 11{SEP} {arm ? "ARM64" : "x64"} {SEP}beta

{WINDOWS_NOTE}

) } case "linux": return ( <>

Version {RELEASE.linux.version} {SEP}x86_64 Arch Linux{SEP}glibc 2.44 or later{SEP}beta

Paste it into a terminal. The installer checks the signed release, needs no root, and adds Hex to your app launcher.

) case "mobile": return ( <>

Hex runs on Mac, Windows, and Linux computers.

) } } interface Row { key: string mark: ReactNode name: string detail: string href?: string command?: string } function rows(platform: Platform): Row[] { const all: (Row & { platforms: Platform[] })[] = [ { key: "mac", platforms: ["mac", "mac-intel"], mark: , name: "Mac", detail: "Apple silicon, macOS 15 or later", href: RELEASE.mac.url, }, { key: "homebrew", platforms: [], mark: , name: "Homebrew", detail: "Mac", command: RELEASE.homebrew, }, { key: "windows-x64", platforms: ["windows-x64"], mark: , name: "Windows x64", detail: "Needs a GPU driver with Vulkan", href: RELEASE.windowsX64.url, }, { key: "windows-arm64", platforms: ["windows-arm64"], mark: , name: "Windows ARM64", detail: "Snapdragon PCs", href: RELEASE.windowsArm64.url, }, { key: "linux", platforms: ["linux"], mark: , name: "Linux", detail: "x86_64 Arch, glibc 2.44 or later", command: RELEASE.linux.command, }, ] return all.filter((row) => !row.platforms.includes(platform)) } export default function Download({ platform }: { platform: Platform }) { return (
Other platforms
) }