GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(dialog-select-server): add icon button for server removal (#8053) · coty/opencode@b3a1360

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • app/src/components
      • dialog-select-server.tsx
    • ui/src/hooks
      • use-filtered-list.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/app/src/components/dialog-select-server.tsx‎

Copy file name to clipboardExpand all lines: packages/app/src/components/dialog-select-server.tsx
+31-13Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Dialog } from "@opencode-ai/ui/dialog"
55
import { List } from "@opencode-ai/ui/list"
66
import { TextField } from "@opencode-ai/ui/text-field"
77
import { Button } from "@opencode-ai/ui/button"
8+
import { IconButton } from "@opencode-ai/ui/icon-button"
89
import { normalizeServerUrl, serverDisplayName, useServer } from "@/context/server"
910
import { usePlatform } from "@/context/platform"
1011
import { createOpencodeClient } from "@opencode-ai/sdk/v2/client"
@@ -116,6 +117,10 @@ export function DialogSelectServer() {
116117
select(value, true)
117118
}
118119

120+
async function handleRemove(url: string) {
121+
server.remove(url)
122+
}
123+
119124
return (
120125
<Dialog title="Servers" description="Switch which OpenCode server this app connects to.">
121126
<div class="flex flex-col gap-4 pb-4">
@@ -130,20 +135,33 @@ export function DialogSelectServer() {
130135
}}
131136
>
132137
{(i) => (
133-
<div
134-
class="flex items-center gap-2 min-w-0 flex-1"
135-
classList={{ "opacity-50": store.status[i]?.healthy === false }}
136-
>
138+
<div class="flex items-center gap-2 min-w-0 flex-1 group/item">
137139
<div
138-
classList={{
139-
"size-1.5 rounded-full shrink-0": true,
140-
"bg-icon-success-base": store.status[i]?.healthy === true,
141-
"bg-icon-critical-base": store.status[i]?.healthy === false,
142-
"bg-border-weak-base": store.status[i] === undefined,
143-
}}
144-
/>
145-
<span class="truncate">{serverDisplayName(i)}</span>
146-
<span class="text-text-weak">{store.status[i]?.version}</span>
140+
class="flex items-center gap-2 min-w-0 flex-1"
141+
classList={{ "opacity-50": store.status[i]?.healthy === false }}
142+
>
143+
<div
144+
classList={{
145+
"size-1.5 rounded-full shrink-0": true,
146+
"bg-icon-success-base": store.status[i]?.healthy === true,
147+
"bg-icon-critical-base": store.status[i]?.healthy === false,
148+
"bg-border-weak-base": store.status[i] === undefined,
149+
}}
150+
/>
151+
<span class="truncate">{serverDisplayName(i)}</span>
152+
<span class="text-text-weak">{store.status[i]?.version}</span>
153+
</div>
154+
<Show when={current() !== i && server.list.includes(i)}>
155+
<IconButton
156+
icon="circle-x"
157+
variant="ghost"
158+
class="bg-transparent transition-opacity shrink-0 hover:scale-110"
159+
onClick={(e) => {
160+
e.stopPropagation()
161+
handleRemove(i)
162+
}}
163+
/>
164+
</Show>
147165
</div>
148166
)}
149167
</List>
Collapse file

‎packages/ui/src/hooks/use-filtered-list.tsx‎

Copy file name to clipboardExpand all lines: packages/ui/src/hooks/use-filtered-list.tsx
+11-4Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,17 @@ export function useFilteredList<T>(props: FilteredListProps<T>) {
2222
const empty: Group[] = []
2323

2424
const [grouped, { refetch }] = createResource(
25-
() => ({
26-
filter: store.filter,
27-
items: typeof props.items === "function" ? undefined : props.items,
28-
}),
25+
() => {
26+
// When items is a function (not async filter function), call it to track changes
27+
const itemsValue = typeof props.items === "function"
28+
? (props.items as () => T[])() // Call synchronous function to track it
29+
: props.items
30+
31+
return {
32+
filter: store.filter,
33+
items: itemsValue,
34+
}
35+
},
2936
async ({ filter, items }) => {
3037
const needle = filter?.toLowerCase()
3138
const all = (items ?? (await (props.items as (filter: string) => T[] | Promise<T[]>)(needle))) || []

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.