"use client"; import { ny } from "@/lib/utils"; import GridPattern from "./ui/grid-pattern"; import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue } from "./ui/select"; import { Button } from "./ui/button"; import { Form, FormField, FormItem, FormLabel } from "./ui/form"; import { useForm } from "react-hook-form"; import { z } from 'zod'; import { zodResolver } from '@hookform/resolvers/zod' import { releases } from "@/lib/releases"; import { addDownload } from "@/lib/db"; const BASE_URL = "https://github.com/zen-browser/desktop/releases/latest/download"; function getDefaultPlatformBasedOnUserAgent() { let userAgent = ""; if (typeof window !== "undefined") { userAgent = window.navigator.userAgent; } if (userAgent.includes("Win")) { return "WindowsInstaller"; } if (userAgent.includes("Mac")) { // TODO: // return "MacOS"; return ""; } if (userAgent.includes("Linux")) { return "Linux"; } return ""; } const formSchema = z.object({ platform: z.string().nonempty(), }); export default function DownloadPage() { const form = useForm>({ resolver: zodResolver(formSchema), defaultValues: { platform: getDefaultPlatformBasedOnUserAgent(), }, }); const watchRelease = form.watch("platform"); const onSubmit = async (data: any) => { const platform = data.platform; addDownload(platform); console.log("Data: ", data) console.log("Platform: ", platform) console.log("Releases: ", releases) const releasesForPlatform = releases[platform]; console.log("Releases for platform: ", releasesForPlatform) const url = `${BASE_URL}/${releasesForPlatform}`; console.log("URL: ", url) window.open(url, "_blank"); } return (

Download Zen Browser

Get started with Zen Browser today. Get back to browsing the web with peace of mind.

( Select your operating system )} /> {watchRelease === "Linux" && (

Linux user?
We{"'"}ve recently added support for flatpak! You can download the flatpak version by running the following command:

flatpak install flathub io.github.zen_browser

)} {watchRelease === "MacOS" && (

Mac user?
Setting up the MacOS version of Zen Browser is a bit more involved. We{"'"}re working on making this easier, but for now you can follow these steps:

)}
); }