From 20662e21014216dfb42690d52b900d43666892fc Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Tue, 9 Dec 2025 06:12:04 -0600 Subject: wip(desktop): progress --- packages/tauri/src/index.tsx | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) (limited to 'packages/tauri/src') diff --git a/packages/tauri/src/index.tsx b/packages/tauri/src/index.tsx index 61b67d264..6b9ce88e0 100644 --- a/packages/tauri/src/index.tsx +++ b/packages/tauri/src/index.tsx @@ -1,8 +1,10 @@ // @refresh reload import { render } from "solid-js/web" -import { DesktopInterface, PlatformProvider, Platform } from "@opencode-ai/desktop" +import { App, PlatformProvider, Platform } from "@opencode-ai/desktop" import { runUpdater } from "./updater" import { onMount } from "solid-js" +import { open, save } from "@tauri-apps/plugin-dialog" +import { open as shellOpen } from "@tauri-apps/plugin-shell" const root = document.getElementById("root") if (import.meta.env.DEV && !(root instanceof HTMLElement)) { @@ -11,7 +13,39 @@ if (import.meta.env.DEV && !(root instanceof HTMLElement)) { ) } -const platform: Platform = {} +const platform: Platform = { + platform: "tauri", + + async openDirectoryPickerDialog(opts) { + const result = await open({ + directory: true, + multiple: opts?.multiple ?? false, + title: opts?.title ?? "Choose a folder", + }) + return result + }, + + async openFilePickerDialog(opts) { + const result = await open({ + directory: false, + multiple: opts?.multiple ?? false, + title: opts?.title ?? "Choose a file", + }) + return result + }, + + async saveFilePickerDialog(opts) { + const result = await save({ + title: opts?.title ?? "Save file", + defaultPath: opts?.defaultPath, + }) + return result + }, + + openLink(url: string) { + shellOpen(url) + }, +} declare global { interface Window { @@ -26,7 +60,7 @@ render(() => { return ( - + ) }, root!) -- cgit v1.2.3