summaryrefslogtreecommitdiffhomepage
path: root/packages/tauri/src
diff options
context:
space:
mode:
authorAdam <[email protected]>2025-12-09 06:12:04 -0600
committerAdam <[email protected]>2025-12-09 06:12:09 -0600
commit20662e21014216dfb42690d52b900d43666892fc (patch)
tree8dd9f9e8088b5a44d02533728a1a218efdb1ba92 /packages/tauri/src
parent0a357be160d672791bb99a36fc7d7c1299d5493d (diff)
downloadopencode-20662e21014216dfb42690d52b900d43666892fc.tar.gz
opencode-20662e21014216dfb42690d52b900d43666892fc.zip
wip(desktop): progress
Diffstat (limited to 'packages/tauri/src')
-rw-r--r--packages/tauri/src/index.tsx40
1 files changed, 37 insertions, 3 deletions
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 (
<PlatformProvider value={platform}>
- <DesktopInterface />
+ <App />
</PlatformProvider>
)
}, root!)