Add formatter status display to TUI status dialog (#3701)

This commit is contained in:
Yuku Kotani
2025-11-02 00:14:39 +09:00
committed by GitHub
parent 1bc3c98ae7
commit 2fe7d13e69
6 changed files with 128 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
import { TextAttributes } from "@opentui/core"
import { useTheme } from "../context/theme"
import { useSync } from "@tui/context/sync"
import { For, Match, Switch, Show } from "solid-js"
import { For, Match, Switch, Show, createMemo } from "solid-js"
export type DialogStatusProps = {}
@@ -9,6 +9,8 @@ export function DialogStatus() {
const sync = useSync()
const { theme } = useTheme()
const enabledFormatters = createMemo(() => sync.data.formatter.filter((f) => f.enabled))
return (
<box paddingLeft={2} paddingRight={2} gap={1} paddingBottom={1}>
<box flexDirection="row" justifyContent="space-between">
@@ -73,6 +75,28 @@ export function DialogStatus() {
</For>
</box>
)}
<Show when={enabledFormatters().length > 0} fallback={<text>No Formatters</text>}>
<box>
<text>{enabledFormatters().length} Formatters</text>
<For each={enabledFormatters()}>
{(item) => (
<box flexDirection="row" gap={1}>
<text
flexShrink={0}
style={{
fg: theme.success,
}}
>
</text>
<text wrapMode="word">
<b>{item.name}</b>
</text>
</box>
)}
</For>
</box>
</Show>
</box>
)
}