import type { DesktopBridge, DesktopUpdateState } from "@t3tools/contracts"; import { ArrowRightIcon } from "lucide-react"; import { getDesktopUpdateDownloadedVersion, getDesktopUpdateReleaseUrl, } from "./desktopUpdate.logic"; import { toastManager } from "./ui/toast"; type DesktopUpdateShell = Pick; export async function openDesktopUpdateReleaseNotes( shell: DesktopUpdateShell | undefined, releaseUrl: string, ): Promise { try { if (shell && (await shell.openExternal(releaseUrl))) return; } catch { // Surface rejected IPC calls through the same user-visible fallback. } toastManager.add({ type: "error", title: "Unable to open release notes" }); } function ReleaseNotesLink({ shell, releaseUrl, }: { shell: DesktopUpdateShell; releaseUrl: string; }) { return ( ); } export function showDesktopUpdateDownloadedToast( shell: DesktopUpdateShell, state: DesktopUpdateState, ): void { const releaseUrl = getDesktopUpdateReleaseUrl(getDesktopUpdateDownloadedVersion(state)); toastManager.add({ type: "success", title: "Update downloaded", description: ( <> Restart the app from the update button to install it. {releaseUrl ? : null} ), }); }