import { TextAttributes } from "@opentui/core" import { useTheme } from "../context/theme" import { useSync } from "@tui/context/sync" import { For, Match, Switch, Show, createMemo } from "solid-js" export type DialogStatusProps = {} export function DialogStatus() { const sync = useSync() const { theme } = useTheme() const enabledFormatters = createMemo(() => sync.data.formatter.filter((f) => f.enabled)) const plugins = createMemo(() => { const list = sync.data.config.plugin ?? [] const result = list.map((value) => { if (value.startsWith("file://")) { const path = value.substring("file://".length) const parts = path.split("/") const filename = parts.pop() || path if (!filename.includes(".")) return { name: filename } const basename = filename.split(".")[0] if (basename === "index") { const dirname = parts.pop() const name = dirname || basename return { name } } return { name: basename } } const index = value.lastIndexOf("@") if (index <= 0) return { name: value, version: "latest" } const name = value.substring(0, index) const version = value.substring(index + 1) return { name, version } }) return result.toSorted((a, b) => a.name.localeCompare(b.name)) }) return ( Status esc 0} fallback={No MCP Servers}> {Object.keys(sync.data.mcp).length} MCP Servers {([key, item]) => ( )[item.status], }} > • {key}{" "} Connected {(val) => val().error} Disabled in configuration Needs authentication (run: opencode mcp auth {key}) {(val) => (val() as { error: string }).error} )} {sync.data.lsp.length > 0 && ( {sync.data.lsp.length} LSP Servers {(item) => ( {item.id} {item.root} )} )} 0} fallback={No Formatters}> {enabledFormatters().length} Formatters {(item) => ( {item.name} )} 0} fallback={No Plugins}> {plugins().length} Plugins {(item) => ( {item.name} {item.version && @{item.version}} )} ) }