diff options
| author | Adam <[email protected]> | 2025-12-09 06:12:04 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-12-09 06:12:09 -0600 |
| commit | 20662e21014216dfb42690d52b900d43666892fc (patch) | |
| tree | 8dd9f9e8088b5a44d02533728a1a218efdb1ba92 /packages/desktop/src/context | |
| parent | 0a357be160d672791bb99a36fc7d7c1299d5493d (diff) | |
| download | opencode-20662e21014216dfb42690d52b900d43666892fc.tar.gz opencode-20662e21014216dfb42690d52b900d43666892fc.zip | |
wip(desktop): progress
Diffstat (limited to 'packages/desktop/src/context')
| -rw-r--r-- | packages/desktop/src/context/platform.tsx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/desktop/src/context/platform.tsx b/packages/desktop/src/context/platform.tsx new file mode 100644 index 000000000..21be49cbd --- /dev/null +++ b/packages/desktop/src/context/platform.tsx @@ -0,0 +1,25 @@ +import { createSimpleContext } from "@opencode-ai/ui/context" + +export type Platform = { + /** Platform discriminator */ + platform: "web" | "tauri" + + /** Open native directory picker dialog (Tauri only) */ + openDirectoryPickerDialog?(opts?: { title?: string; multiple?: boolean }): Promise<string | string[] | null> + + /** Open native file picker dialog (Tauri only) */ + openFilePickerDialog?(opts?: { title?: string; multiple?: boolean }): Promise<string | string[] | null> + + /** Save file picker dialog (Tauri only) */ + saveFilePickerDialog?(opts?: { title?: string; defaultPath?: string }): Promise<string | null> + + /** Open a URL in the default browser */ + openLink(url: string): void +} + +export const { use: usePlatform, provider: PlatformProvider } = createSimpleContext({ + name: "Platform", + init: (props: { value: Platform }) => { + return props.value + }, +}) |
