GeezerVison is showing github.com — fix(app): fallback to synthetic icon for unknown provider IDs (#15295) · dotneB/opencode@971bd30
File treeExpand file treeCollapse file tree Open diff view settings enterprise/src/routes/share
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/dialog-connect-provider.tsx +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -4,7 +4,6 @@ import { useDialog } from "@opencode-ai/ui/context/dialog" | 4 | 4 | import { Dialog } from "@opencode-ai/ui/dialog" | 5 | 5 | import { Icon } from "@opencode-ai/ui/icon" | 6 | 6 | import { IconButton } from "@opencode-ai/ui/icon-button" | 7 | | -import type { IconName } from "@opencode-ai/ui/icons/provider" | 8 | 7 | import { List, type ListRef } from "@opencode-ai/ui/list" | 9 | 8 | import { ProviderIcon } from "@opencode-ai/ui/provider-icon" | 10 | 9 | import { Spinner } from "@opencode-ai/ui/spinner" | @@ -447,7 +446,7 @@ export function DialogConnectProvider(props: { provider: string }) { | 447 | 446 | > | 448 | 447 | <div class="flex flex-col gap-6 px-2.5 pb-3"> | 449 | 448 | <div class="px-2.5 flex gap-4 items-center"> | 450 | | - <ProviderIcon id={props.provider as IconName} class="size-5 shrink-0 icon-strong-base" /> | | 449 | + <ProviderIcon id={props.provider} class="size-5 shrink-0 icon-strong-base" /> | 451 | 450 | <div class="text-16-medium text-text-strong"> | 452 | 451 | <Switch> | 453 | 452 | <Match when={props.provider === "anthropic" && method()?.label?.toLowerCase().includes("max")}> | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/dialog-select-model-unpaid.tsx +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { Button } from "@opencode-ai/ui/button" | 2 | 2 | import { useDialog } from "@opencode-ai/ui/context/dialog" | 3 | 3 | import { Dialog } from "@opencode-ai/ui/dialog" | 4 | | -import type { IconName } from "@opencode-ai/ui/icons/provider" | 5 | 4 | import { List, type ListRef } from "@opencode-ai/ui/list" | 6 | 5 | import { ProviderIcon } from "@opencode-ai/ui/provider-icon" | 7 | 6 | import { Tag } from "@opencode-ai/ui/tag" | @@ -95,7 +94,7 @@ export const DialogSelectModelUnpaid: Component = () => { | 95 | 94 | > | 96 | 95 | {(i) => ( | 97 | 96 | <div class="w-full flex items-center gap-x-3"> | 98 | | - <ProviderIcon data-slot="list-item-extra-icon" id={i.id as IconName} /> | | 97 | + <ProviderIcon data-slot="list-item-extra-icon" id={i.id} /> | 99 | 98 | <span>{i.name}</span> | 100 | 99 | <Show when={i.id === "opencode"}> | 101 | 100 | <div class="text-14-regular text-text-weak">{language.t("dialog.provider.opencode.tagline")}</div> | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/dialog-select-provider.tsx +1-7Lines changed: 1 addition & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,18 +5,12 @@ import { Dialog } from "@opencode-ai/ui/dialog" | 5 | 5 | import { List } from "@opencode-ai/ui/list" | 6 | 6 | import { Tag } from "@opencode-ai/ui/tag" | 7 | 7 | import { ProviderIcon } from "@opencode-ai/ui/provider-icon" | 8 | | -import { iconNames, type IconName } from "@opencode-ai/ui/icons/provider" | 9 | 8 | import { DialogConnectProvider } from "./dialog-connect-provider" | 10 | 9 | import { useLanguage } from "@/context/language" | 11 | 10 | import { DialogCustomProvider } from "./dialog-custom-provider" | 12 | 11 |
| 13 | 12 | const CUSTOM_ID = "_custom" | 14 | 13 |
| 15 | | -function icon(id: string): IconName { | 16 | | - if (iconNames.includes(id as IconName)) return id as IconName | 17 | | - return "synthetic" | 18 | | -} | 19 | | - | 20 | 14 | export const DialogSelectProvider: Component = () => { | 21 | 15 | const dialog = useDialog() | 22 | 16 | const providers = useProviders() | @@ -69,7 +63,7 @@ export const DialogSelectProvider: Component = () => { | 69 | 63 | > | 70 | 64 | {(i) => ( | 71 | 65 | <div class="px-1.25 w-full flex items-center gap-x-3"> | 72 | | - <ProviderIcon data-slot="list-item-extra-icon" id={icon(i.id)} /> | | 66 | + <ProviderIcon data-slot="list-item-extra-icon" id={i.id} /> | 73 | 67 | <span>{i.name}</span> | 74 | 68 | <Show when={i.id === "opencode"}> | 75 | 69 | <div class="text-14-regular text-text-weak">{language.t("dialog.provider.opencode.tagline")}</div> | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/prompt-input.tsx +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,7 +23,6 @@ import { Button } from "@opencode-ai/ui/button" | 23 | 23 | import { DockShellForm, DockTray } from "@opencode-ai/ui/dock-surface" | 24 | 24 | import { Icon } from "@opencode-ai/ui/icon" | 25 | 25 | import { ProviderIcon } from "@opencode-ai/ui/provider-icon" | 26 | | -import type { IconName } from "@opencode-ai/ui/icons/provider" | 27 | 26 | import { Tooltip, TooltipKeybind } from "@opencode-ai/ui/tooltip" | 28 | 27 | import { IconButton } from "@opencode-ai/ui/icon-button" | 29 | 28 | import { Select } from "@opencode-ai/ui/select" | @@ -1398,7 +1397,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => { | 1398 | 1397 | > | 1399 | 1398 | <Show when={local.model.current()?.provider?.id}> | 1400 | 1399 | <ProviderIcon | 1401 | | - id={local.model.current()!.provider.id as IconName} | | 1400 | + id={local.model.current()!.provider.id} | 1402 | 1401 | class="size-4 shrink-0 opacity-40 group-hover:opacity-100 transition-opacity duration-150" | 1403 | 1402 | style={{ "will-change": "opacity", transform: "translateZ(0)" }} | 1404 | 1403 | /> | @@ -1428,7 +1427,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => { | 1428 | 1427 | > | 1429 | 1428 | <Show when={local.model.current()?.provider?.id}> | 1430 | 1429 | <ProviderIcon | 1431 | | - id={local.model.current()!.provider.id as IconName} | | 1430 | + id={local.model.current()!.provider.id} | 1432 | 1431 | class="size-4 shrink-0 opacity-40 group-hover:opacity-100 transition-opacity duration-150" | 1433 | 1432 | style={{ "will-change": "opacity", transform: "translateZ(0)" }} | 1434 | 1433 | /> | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/settings-models.tsx +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -4,7 +4,6 @@ import { Switch } from "@opencode-ai/ui/switch" | 4 | 4 | import { Icon } from "@opencode-ai/ui/icon" | 5 | 5 | import { IconButton } from "@opencode-ai/ui/icon-button" | 6 | 6 | import { TextField } from "@opencode-ai/ui/text-field" | 7 | | -import type { IconName } from "@opencode-ai/ui/icons/provider" | 8 | 7 | import { type Component, For, Show } from "solid-js" | 9 | 8 | import { useLanguage } from "@/context/language" | 10 | 9 | import { useModels } from "@/context/models" | @@ -98,7 +97,7 @@ export const SettingsModels: Component = () => { | 98 | 97 | {(group) => ( | 99 | 98 | <div class="flex flex-col gap-1"> | 100 | 99 | <div class="flex items-center gap-2 pb-2"> | 101 | | - <ProviderIcon id={group.category as IconName} class="size-5 shrink-0 icon-strong-base" /> | | 100 | + <ProviderIcon id={group.category} class="size-5 shrink-0 icon-strong-base" /> | 102 | 101 | <span class="text-14-medium text-text-strong">{group.items[0].provider.name}</span> | 103 | 102 | </div> | 104 | 103 | <div class="bg-surface-raised-base px-4 rounded-lg"> | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/components/settings-providers.tsx +3-9Lines changed: 3 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3,7 +3,6 @@ import { useDialog } from "@opencode-ai/ui/context/dialog" | 3 | 3 | import { ProviderIcon } from "@opencode-ai/ui/provider-icon" | 4 | 4 | import { Tag } from "@opencode-ai/ui/tag" | 5 | 5 | import { showToast } from "@opencode-ai/ui/toast" | 6 | | -import { iconNames, type IconName } from "@opencode-ai/ui/icons/provider" | 7 | 6 | import { popularProviders, useProviders } from "@/hooks/use-providers" | 8 | 7 | import { createMemo, type Component, For, Show } from "solid-js" | 9 | 8 | import { useLanguage } from "@/context/language" | @@ -33,11 +32,6 @@ export const SettingsProviders: Component = () => { | 33 | 32 | const globalSync = useGlobalSync() | 34 | 33 | const providers = useProviders() | 35 | 34 |
| 36 | | - const icon = (id: string): IconName => { | 37 | | - if (iconNames.includes(id as IconName)) return id as IconName | 38 | | - return "synthetic" | 39 | | - } | 40 | | - | 41 | 35 | const connected = createMemo(() => { | 42 | 36 | return providers | 43 | 37 | .connected() | @@ -154,7 +148,7 @@ export const SettingsProviders: Component = () => { | 154 | 148 | {(item) => ( | 155 | 149 | <div class="group flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"> | 156 | 150 | <div class="flex items-center gap-3 min-w-0"> | 157 | | - <ProviderIcon id={icon(item.id)} class="size-5 shrink-0 icon-strong-base" /> | | 151 | + <ProviderIcon id={item.id} class="size-5 shrink-0 icon-strong-base" /> | 158 | 152 | <span class="text-14-medium text-text-strong truncate">{item.name}</span> | 159 | 153 | <Tag>{type(item)}</Tag> | 160 | 154 | </div> | @@ -185,7 +179,7 @@ export const SettingsProviders: Component = () => { | 185 | 179 | <div class="flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"> | 186 | 180 | <div class="flex flex-col min-w-0"> | 187 | 181 | <div class="flex items-center gap-x-3"> | 188 | | - <ProviderIcon id={icon(item.id)} class="size-5 shrink-0 icon-strong-base" /> | | 182 | + <ProviderIcon id={item.id} class="size-5 shrink-0 icon-strong-base" /> | 189 | 183 | <span class="text-14-medium text-text-strong">{item.name}</span> | 190 | 184 | <Show when={item.id === "opencode"}> | 191 | 185 | <span class="text-14-regular text-text-weak"> | @@ -228,7 +222,7 @@ export const SettingsProviders: Component = () => { | 228 | 222 | > | 229 | 223 | <div class="flex flex-col min-w-0"> | 230 | 224 | <div class="flex flex-wrap items-center gap-x-3 gap-y-1"> | 231 | | - <ProviderIcon id={icon("synthetic")} class="size-5 shrink-0 icon-strong-base" /> | | 225 | + <ProviderIcon id="synthetic" class="size-5 shrink-0 icon-strong-base" /> | 232 | 226 | <span class="text-14-medium text-text-strong">{language.t("provider.custom.title")}</span> | 233 | 227 | <Tag>{language.t("settings.providers.tag.custom")}</Tag> | 234 | 228 | </div> | |
Collapse file Copy file name to clipboardExpand all lines: packages/enterprise/src/routes/share/[shareID].tsx +3-5Lines changed: 3 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,7 +23,6 @@ import { MessageNav } from "@opencode-ai/ui/message-nav" | 23 | 23 | import { preloadMultiFileDiff, PreloadMultiFileDiffResult } from "@pierre/diffs/ssr" | 24 | 24 | import { FileSSR } from "@opencode-ai/ui/file-ssr" | 25 | 25 | import { clientOnly } from "@solidjs/start" | 26 | | -import { type IconName } from "@opencode-ai/ui/icons/provider" | 27 | 26 | import { Meta, Title } from "@solidjs/meta" | 28 | 27 | import { Base64 } from "js-base64" | 29 | 28 |
| @@ -268,10 +267,9 @@ export default function () { | 268 | 267 | </div> | 269 | 268 | <div class="flex gap-4 items-center"> | 270 | 269 | <div class="flex gap-2 items-center"> | 271 | | - <ProviderIcon | 272 | | - id={provider() as IconName} | 273 | | - class="size-3.5 shrink-0 text-icon-strong-base" | 274 | | - /> | | 270 | + <Show when={provider()}> | | 271 | + <ProviderIcon id={provider()!} class="size-3.5 shrink-0 text-icon-strong-base" /> | | 272 | + </Show> | 275 | 273 | <div class="text-12-regular text-text-base">{model()?.name ?? modelID()}</div> | 276 | 274 | </div> | 277 | 275 | <div class="text-12-regular text-text-weaker"> | |
Collapse file Copy file name to clipboard +4-3Lines changed: 4 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import type { Component, JSX } from "solid-js" | 2 | 2 | import { splitProps } from "solid-js" | 3 | 3 | import sprite from "./provider-icons/sprite.svg" | 4 | | -import type { IconName } from "./provider-icons/types" | | 4 | +import { iconNames, type IconName } from "./provider-icons/types" | 5 | 5 |
| 6 | 6 | export type ProviderIconProps = JSX.SVGElementTags["svg"] & { | 7 | | - id: IconName | | 7 | + id: string | 8 | 8 | } | 9 | 9 |
| 10 | 10 | export const ProviderIcon: Component<ProviderIconProps> = (props) => { | 11 | 11 | const [local, rest] = splitProps(props, ["id", "class", "classList"]) | | 12 | + const resolved = iconNames.includes(local.id as IconName) ? local.id : "synthetic" | 12 | 13 | return ( | 13 | 14 | <svg | 14 | 15 | data-component="provider-icon" | @@ -18,7 +19,7 @@ export const ProviderIcon: Component<ProviderIconProps> = (props) => { | 18 | 19 | [local.class ?? ""]: !!local.class, | 19 | 20 | }} | 20 | 21 | > | 21 | | - <use href={`${sprite}#${local.id}`} /> | | 22 | + <use href={`${sprite}#${resolved}`} /> | 22 | 23 | </svg> | 23 | 24 | ) | 24 | 25 | } |
|