From 2d18d80ac3463f5f8ee511d55cb625eded742b30 Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Tue, 30 Dec 2025 07:35:20 -0600 Subject: chore: cleanup --- .../app/src/components/dialog-select-server.tsx | 21 +++------------------ packages/app/src/components/status-bar.tsx | 6 ++++-- 2 files changed, 7 insertions(+), 20 deletions(-) (limited to 'packages/app/src/components') diff --git a/packages/app/src/components/dialog-select-server.tsx b/packages/app/src/components/dialog-select-server.tsx index b041bbab6..78f3189b2 100644 --- a/packages/app/src/components/dialog-select-server.tsx +++ b/packages/app/src/components/dialog-select-server.tsx @@ -5,28 +5,13 @@ import { Dialog } from "@opencode-ai/ui/dialog" import { List } from "@opencode-ai/ui/list" import { TextField } from "@opencode-ai/ui/text-field" import { Button } from "@opencode-ai/ui/button" -import { useServer } from "@/context/server" +import { normalizeServerUrl, serverDisplayName, useServer } from "@/context/server" import { usePlatform } from "@/context/platform" import { createOpencodeClient } from "@opencode-ai/sdk/v2/client" import { useNavigate } from "@solidjs/router" type ServerStatus = { healthy: boolean; version?: string } -function displayName(url: string) { - return url - .replace(/^https?:\/\//, "") - .replace(/\/+$/, "") - .split("/")[0] -} - -function normalize(input: string) { - const trimmed = input.trim() - if (!trimmed) return - const withProtocol = /^https?:\/\//.test(trimmed) ? trimmed : `http://${trimmed}` - const cleaned = withProtocol.replace(/\/+$/, "") - return cleaned.replace(/^(https?:\/\/[^/]+).*/, "$1") -} - async function checkHealth(url: string, fetch?: typeof globalThis.fetch): Promise { const sdk = createOpencodeClient({ baseUrl: url, @@ -87,7 +72,7 @@ export function DialogSelectServer() { async function handleSubmit(e: SubmitEvent) { e.preventDefault() - const value = normalize(store.url) + const value = normalizeServerUrl(store.url) if (!value) return setStore("adding", true) @@ -131,7 +116,7 @@ export function DialogSelectServer() { "bg-border-weak-base": store.status[i] === undefined, }} /> - {displayName(i)} + {serverDisplayName(i)} {store.status[i]?.version} )} diff --git a/packages/app/src/components/status-bar.tsx b/packages/app/src/components/status-bar.tsx index bfc428fca..0ca403d72 100644 --- a/packages/app/src/components/status-bar.tsx +++ b/packages/app/src/components/status-bar.tsx @@ -34,10 +34,12 @@ export function StatusBar(props: ParentProps) {
+ {server.name}
-- cgit v1.2.3