summaryrefslogtreecommitdiffhomepage
path: root/packages/tauri
diff options
context:
space:
mode:
authorBrendan Allan <[email protected]>2025-12-08 13:43:36 +0800
committerBrendan Allan <[email protected]>2025-12-08 13:43:36 +0800
commitd531dff8d3f5c60df2e5c08e8bd04bf9a234dbc3 (patch)
tree7c38fd75c3e6f04307b78abe7a93c8321e041143 /packages/tauri
parent923bf36593e517196a332ddce2ffe5f2fd216f5e (diff)
downloadopencode-d531dff8d3f5c60df2e5c08e8bd04bf9a234dbc3.tar.gz
opencode-d531dff8d3f5c60df2e5c08e8bd04bf9a234dbc3.zip
Export DesktopInterface from desktop and add PlatformContext
Diffstat (limited to 'packages/tauri')
-rw-r--r--packages/tauri/index.html2
-rw-r--r--packages/tauri/src-tauri/src/lib.rs2
-rw-r--r--packages/tauri/src/index.ts1
-rw-r--r--packages/tauri/src/index.tsx21
-rw-r--r--packages/tauri/tsconfig.json5
5 files changed, 27 insertions, 4 deletions
diff --git a/packages/tauri/index.html b/packages/tauri/index.html
index 898aec67a..0ac3d566d 100644
--- a/packages/tauri/index.html
+++ b/packages/tauri/index.html
@@ -23,6 +23,6 @@
</script>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
- <script src="/src/index.ts" type="module"></script>
+ <script src="/src/index.tsx" type="module"></script>
</body>
</html>
diff --git a/packages/tauri/src-tauri/src/lib.rs b/packages/tauri/src-tauri/src/lib.rs
index bada4dee2..1809d2f8b 100644
--- a/packages/tauri/src-tauri/src/lib.rs
+++ b/packages/tauri/src-tauri/src/lib.rs
@@ -4,7 +4,7 @@ use std::{
sync::{Arc, Mutex},
time::{Duration, Instant},
};
-use tauri::{App, AppHandle, Manager, RunEvent, WebviewUrl, WebviewWindow};
+use tauri::{AppHandle, Manager, RunEvent, WebviewUrl, WebviewWindow};
use tauri_plugin_dialog::{DialogExt, MessageDialogButtons, MessageDialogResult};
use tauri_plugin_shell::process::{CommandChild, CommandEvent};
use tauri_plugin_shell::ShellExt;
diff --git a/packages/tauri/src/index.ts b/packages/tauri/src/index.ts
deleted file mode 100644
index b9060d628..000000000
--- a/packages/tauri/src/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-import "@opencode-ai/desktop"
diff --git a/packages/tauri/src/index.tsx b/packages/tauri/src/index.tsx
new file mode 100644
index 000000000..9371b4826
--- /dev/null
+++ b/packages/tauri/src/index.tsx
@@ -0,0 +1,21 @@
+// @refresh reload
+import { render } from "solid-js/web"
+import { DesktopInterface, PlatformProvider, Platform } from "@opencode-ai/desktop"
+
+const root = document.getElementById("root")
+if (import.meta.env.DEV && !(root instanceof HTMLElement)) {
+ throw new Error(
+ "Root element not found. Did you forget to add it to your index.html? Or maybe the id attribute got misspelled?",
+ )
+}
+
+const platform: Platform = {}
+
+render(
+ () => (
+ <PlatformProvider value={platform}>
+ <DesktopInterface />
+ </PlatformProvider>
+ ),
+ root!,
+)
diff --git a/packages/tauri/tsconfig.json b/packages/tauri/tsconfig.json
index 75abdef26..cf73096e5 100644
--- a/packages/tauri/tsconfig.json
+++ b/packages/tauri/tsconfig.json
@@ -17,7 +17,10 @@
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
- "noFallthroughCasesInSwitch": true
+ "noFallthroughCasesInSwitch": true,
+
+ "jsx": "preserve",
+ "jsxImportSource": "solid-js"
},
"include": ["src"]
}