fix(desktop): Revert provider icon on select model dialog (#8245)
This commit is contained in:
@@ -7,8 +7,6 @@ import { Button } from "@opencode-ai/ui/button"
|
|||||||
import { Tag } from "@opencode-ai/ui/tag"
|
import { Tag } from "@opencode-ai/ui/tag"
|
||||||
import { Dialog } from "@opencode-ai/ui/dialog"
|
import { Dialog } from "@opencode-ai/ui/dialog"
|
||||||
import { List } from "@opencode-ai/ui/list"
|
import { List } from "@opencode-ai/ui/list"
|
||||||
import { ProviderIcon } from "@opencode-ai/ui/provider-icon"
|
|
||||||
import type { IconName } from "@opencode-ai/ui/icons/provider"
|
|
||||||
import { DialogSelectProvider } from "./dialog-select-provider"
|
import { DialogSelectProvider } from "./dialog-select-provider"
|
||||||
import { DialogManageModels } from "./dialog-manage-models"
|
import { DialogManageModels } from "./dialog-manage-models"
|
||||||
|
|
||||||
@@ -37,12 +35,6 @@ const ModelList: Component<{
|
|||||||
filterKeys={["provider.name", "name", "id"]}
|
filterKeys={["provider.name", "name", "id"]}
|
||||||
sortBy={(a, b) => a.name.localeCompare(b.name)}
|
sortBy={(a, b) => a.name.localeCompare(b.name)}
|
||||||
groupBy={(x) => x.provider.name}
|
groupBy={(x) => x.provider.name}
|
||||||
groupHeader={(group) => (
|
|
||||||
<div class="flex items-center gap-x-3">
|
|
||||||
<ProviderIcon data-slot="list-item-extra-icon" id={group.items[0].provider.id as IconName} />
|
|
||||||
<span>{group.category}</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
sortGroupsBy={(a, b) => {
|
sortGroupsBy={(a, b) => {
|
||||||
if (a.category === "Recent" && b.category !== "Recent") return -1
|
if (a.category === "Recent" && b.category !== "Recent") return -1
|
||||||
if (b.category === "Recent" && a.category !== "Recent") return 1
|
if (b.category === "Recent" && a.category !== "Recent") return 1
|
||||||
@@ -60,8 +52,7 @@ const ModelList: Component<{
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{(i) => (
|
{(i) => (
|
||||||
<div class="w-full flex items-center gap-x-3 pl-1 text-13-regular">
|
<div class="w-full flex items-center gap-x-2 text-13-regular">
|
||||||
<ProviderIcon data-slot="list-item-extra-icon" id={i.provider.id as IconName} />
|
|
||||||
<span class="truncate">{i.name}</span>
|
<span class="truncate">{i.name}</span>
|
||||||
<Show when={i.provider.id === "opencode" && (!i.cost || i.cost?.input === 0)}>
|
<Show when={i.provider.id === "opencode" && (!i.cost || i.cost?.input === 0)}>
|
||||||
<Tag>Free</Tag>
|
<Tag>Free</Tag>
|
||||||
|
|||||||
@@ -10,15 +10,9 @@ export interface ListSearchProps {
|
|||||||
autofocus?: boolean
|
autofocus?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListGroup<T> {
|
|
||||||
category: string
|
|
||||||
items: T[]
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ListProps<T> extends FilteredListProps<T> {
|
export interface ListProps<T> extends FilteredListProps<T> {
|
||||||
class?: string
|
class?: string
|
||||||
children: (item: T) => JSX.Element
|
children: (item: T) => JSX.Element
|
||||||
groupHeader?: (group: ListGroup<T>) => JSX.Element
|
|
||||||
emptyMessage?: string
|
emptyMessage?: string
|
||||||
onKeyEvent?: (event: KeyboardEvent, item: T | undefined) => void
|
onKeyEvent?: (event: KeyboardEvent, item: T | undefined) => void
|
||||||
onMove?: (item: T | undefined) => void
|
onMove?: (item: T | undefined) => void
|
||||||
@@ -122,7 +116,7 @@ export function List<T>(props: ListProps<T> & { ref?: (ref: ListRef) => void })
|
|||||||
setScrollRef,
|
setScrollRef,
|
||||||
})
|
})
|
||||||
|
|
||||||
function GroupHeader(groupProps: { category: string; children?: JSX.Element }): JSX.Element {
|
function GroupHeader(groupProps: { category: string }): JSX.Element {
|
||||||
const [stuck, setStuck] = createSignal(false)
|
const [stuck, setStuck] = createSignal(false)
|
||||||
const [header, setHeader] = createSignal<HTMLDivElement | undefined>(undefined)
|
const [header, setHeader] = createSignal<HTMLDivElement | undefined>(undefined)
|
||||||
|
|
||||||
@@ -144,7 +138,7 @@ export function List<T>(props: ListProps<T> & { ref?: (ref: ListRef) => void })
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div data-slot="list-header" data-stuck={stuck()} ref={setHeader}>
|
<div data-slot="list-header" data-stuck={stuck()} ref={setHeader}>
|
||||||
{groupProps.children ?? groupProps.category}
|
{groupProps.category}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -191,7 +185,7 @@ export function List<T>(props: ListProps<T> & { ref?: (ref: ListRef) => void })
|
|||||||
{(group) => (
|
{(group) => (
|
||||||
<div data-slot="list-group">
|
<div data-slot="list-group">
|
||||||
<Show when={group.category}>
|
<Show when={group.category}>
|
||||||
<GroupHeader category={group.category}>{props.groupHeader?.(group)}</GroupHeader>
|
<GroupHeader category={group.category} />
|
||||||
</Show>
|
</Show>
|
||||||
<div data-slot="list-items">
|
<div data-slot="list-items">
|
||||||
<For each={group.items}>
|
<For each={group.items}>
|
||||||
|
|||||||
Reference in New Issue
Block a user