diff --git a/packages/desktop/src/components/dialog-connect-provider.tsx b/packages/desktop/src/components/dialog-connect-provider.tsx index 0d6737815..789a5d3b7 100644 --- a/packages/desktop/src/components/dialog-connect-provider.tsx +++ b/packages/desktop/src/components/dialog-connect-provider.tsx @@ -1,24 +1,24 @@ +import type { ProviderAuthAuthorization } from "@opencode-ai/sdk/v2/client" +import { Button } from "@opencode-ai/ui/button" +import { useDialog } from "@opencode-ai/ui/context/dialog" +import { Dialog } from "@opencode-ai/ui/dialog" +import { Icon } from "@opencode-ai/ui/icon" +import { IconButton } from "@opencode-ai/ui/icon-button" +import type { IconName } from "@opencode-ai/ui/icons/provider" +import { List, type ListRef } from "@opencode-ai/ui/list" +import { ProviderIcon } from "@opencode-ai/ui/provider-icon" +import { Spinner } from "@opencode-ai/ui/spinner" +import { TextField } from "@opencode-ai/ui/text-field" +import { showToast } from "@opencode-ai/ui/toast" +import { iife } from "@opencode-ai/util/iife" import { createMemo, Match, onCleanup, onMount, Switch } from "solid-js" import { createStore, produce } from "solid-js/store" -import { useDialog } from "@opencode-ai/ui/context/dialog" -import { useGlobalSync } from "@/context/global-sync" -import { useGlobalSDK } from "@/context/global-sdk" -import { usePlatform } from "@/context/platform" -import { ProviderAuthAuthorization } from "@opencode-ai/sdk/v2/client" -import { Dialog } from "@opencode-ai/ui/dialog" -import { List, ListRef } from "@opencode-ai/ui/list" -import { Button } from "@opencode-ai/ui/button" -import { IconButton } from "@opencode-ai/ui/icon-button" -import { TextField } from "@opencode-ai/ui/text-field" -import { Spinner } from "@opencode-ai/ui/spinner" -import { Icon } from "@opencode-ai/ui/icon" -import { showToast } from "@opencode-ai/ui/toast" -import { ProviderIcon } from "@opencode-ai/ui/provider-icon" -import { IconName } from "@opencode-ai/ui/icons/provider" -import { iife } from "@opencode-ai/util/iife" import { Link } from "@/components/link" -import { DialogSelectProvider } from "./dialog-select-provider" +import { useGlobalSDK } from "@/context/global-sdk" +import { useGlobalSync } from "@/context/global-sync" +import { usePlatform } from "@/context/platform" import { DialogSelectModel } from "./dialog-select-model" +import { DialogSelectProvider } from "./dialog-select-provider" export function DialogConnectProvider(props: { provider: string }) { const dialog = useDialog() @@ -154,7 +154,9 @@ export function DialogConnectProvider(props: { provider: string }) {
Select login method for {provider().name}.
(listRef = ref)} + ref={(ref) => { + listRef = ref + }} items={methods} key={(m) => m?.label} onSelect={async (method, index) => { @@ -163,7 +165,7 @@ export function DialogConnectProvider(props: { provider: string }) { }} > {(i) => ( -
+
@@ -175,7 +177,7 @@ export function DialogConnectProvider(props: { provider: string }) {
-
+
Authorization in progress...
@@ -183,7 +185,7 @@ export function DialogConnectProvider(props: { provider: string }) {
-
+
Authorization failed: {store.error}
diff --git a/packages/desktop/src/components/dialog-manage-models.tsx b/packages/desktop/src/components/dialog-manage-models.tsx index 5765a8e1a..66d125288 100644 --- a/packages/desktop/src/components/dialog-manage-models.tsx +++ b/packages/desktop/src/components/dialog-manage-models.tsx @@ -1,16 +1,15 @@ -import { Component } from "solid-js" -import { useLocal } from "@/context/local" -import { popularProviders } from "@/hooks/use-providers" import { Dialog } from "@opencode-ai/ui/dialog" import { List } from "@opencode-ai/ui/list" import { Switch } from "@opencode-ai/ui/switch" +import type { Component } from "solid-js" +import { useLocal } from "@/context/local" +import { popularProviders } from "@/hooks/use-providers" export const DialogManageModels: Component = () => { const local = useLocal() return ( `${x?.provider?.id}:${x?.id}`} @@ -27,16 +26,24 @@ export const DialogManageModels: Component = () => { }} onSelect={(x) => { if (!x) return - const visible = local.model.visible({ modelID: x.id, providerID: x.provider.id }) + const visible = local.model.visible({ + modelID: x.id, + providerID: x.provider.id, + }) local.model.setVisibility({ modelID: x.id, providerID: x.provider.id }, !visible) }} > {(i) => ( -
+
{i.name}
e.stopPropagation()}> { local.model.setVisibility({ modelID: i.id, providerID: i.provider.id }, checked) }} diff --git a/packages/desktop/src/components/dialog-select-file.tsx b/packages/desktop/src/components/dialog-select-file.tsx index 61c518719..b27afdc8b 100644 --- a/packages/desktop/src/components/dialog-select-file.tsx +++ b/packages/desktop/src/components/dialog-select-file.tsx @@ -1,12 +1,12 @@ -import { useLocal } from "@/context/local" -import { Dialog } from "@opencode-ai/ui/dialog" -import { List } from "@opencode-ai/ui/list" -import { FileIcon } from "@opencode-ai/ui/file-icon" -import { getDirectory, getFilename } from "@opencode-ai/util/path" -import { useLayout } from "@/context/layout" import { useDialog } from "@opencode-ai/ui/context/dialog" +import { Dialog } from "@opencode-ai/ui/dialog" +import { FileIcon } from "@opencode-ai/ui/file-icon" +import { List } from "@opencode-ai/ui/list" +import { getDirectory, getFilename } from "@opencode-ai/util/path" import { useParams } from "@solidjs/router" import { createMemo } from "solid-js" +import { useLayout } from "@/context/layout" +import { useLocal } from "@/context/local" export function DialogSelectFile() { const layout = useLayout() @@ -18,7 +18,6 @@ export function DialogSelectFile() { return ( {(i) => (
-
+
diff --git a/packages/desktop/src/components/dialog-select-model-unpaid.tsx b/packages/desktop/src/components/dialog-select-model-unpaid.tsx index 77e493d3c..efe528435 100644 --- a/packages/desktop/src/components/dialog-select-model-unpaid.tsx +++ b/packages/desktop/src/components/dialog-select-model-unpaid.tsx @@ -1,15 +1,15 @@ -import { Component, onCleanup, onMount, Show } from "solid-js" -import { useLocal } from "@/context/local" -import { useDialog } from "@opencode-ai/ui/context/dialog" -import { popularProviders, useProviders } from "@/hooks/use-providers" import { Button } from "@opencode-ai/ui/button" -import { Tag } from "@opencode-ai/ui/tag" +import { useDialog } from "@opencode-ai/ui/context/dialog" import { Dialog } from "@opencode-ai/ui/dialog" -import { List, ListRef } from "@opencode-ai/ui/list" +import type { IconName } from "@opencode-ai/ui/icons/provider" +import { List, type ListRef } from "@opencode-ai/ui/list" import { ProviderIcon } from "@opencode-ai/ui/provider-icon" -import { IconName } from "@opencode-ai/ui/icons/provider" -import { DialogSelectProvider } from "./dialog-select-provider" +import { Tag } from "@opencode-ai/ui/tag" +import { type Component, onCleanup, onMount, Show } from "solid-js" +import { useLocal } from "@/context/local" +import { popularProviders, useProviders } from "@/hooks/use-providers" import { DialogConnectProvider } from "./dialog-connect-provider" +import { DialogSelectProvider } from "./dialog-select-provider" export const DialogSelectModelUnpaid: Component = () => { const local = useLocal() @@ -64,7 +64,7 @@ export const DialogSelectModelUnpaid: Component = () => {
Add more models from popular providers
x?.id} items={providers.popular} activeIcon="plus-small" @@ -79,7 +79,7 @@ export const DialogSelectModelUnpaid: Component = () => { }} > {(i) => ( -
+
= (props) => { } > `${x.provider.id}:${x.id}`} @@ -61,7 +60,7 @@ export const DialogSelectModel: Component<{ provider?: string }> = (props) => { }} > {(i) => ( -
+
{i.name} Free diff --git a/packages/desktop/src/components/dialog-select-provider.tsx b/packages/desktop/src/components/dialog-select-provider.tsx index 52fac7073..52832ff45 100644 --- a/packages/desktop/src/components/dialog-select-provider.tsx +++ b/packages/desktop/src/components/dialog-select-provider.tsx @@ -15,7 +15,6 @@ export const DialogSelectProvider: Component = () => { return ( x?.id} @@ -38,7 +37,7 @@ export const DialogSelectProvider: Component = () => { }} > {(i) => ( -
+
props.options.filter((x) => !x.id.startsWith("suggested.") || !x.disabled)}