mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
tui: fix help dialog trigger to use command system instead of direct dialog
This commit is contained in:
parent
8eea2a6cb8
commit
0e2e8dcd5f
2 changed files with 10 additions and 4 deletions
|
|
@ -12,6 +12,7 @@ import { LocalProvider, useLocal } from "@tui/context/local"
|
|||
import { DialogModel } from "@tui/component/dialog-model"
|
||||
import { DialogStatus } from "@tui/component/dialog-status"
|
||||
import { DialogThemeList } from "@tui/component/dialog-theme-list"
|
||||
import { DialogHelp } from "./ui/dialog-help"
|
||||
import { CommandProvider, useCommandDialog } from "@tui/component/dialog-command"
|
||||
import { DialogAgent } from "@tui/component/dialog-agent"
|
||||
import { DialogSessionList } from "@tui/component/dialog-session-list"
|
||||
|
|
@ -207,6 +208,14 @@ function App() {
|
|||
},
|
||||
category: "System",
|
||||
},
|
||||
{
|
||||
title: "Help",
|
||||
value: "help.show",
|
||||
onSelect: () => {
|
||||
dialog.replace(() => <DialogHelp />)
|
||||
},
|
||||
category: "System",
|
||||
},
|
||||
])
|
||||
|
||||
createEffect(() => {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ import { useSync } from "@tui/context/sync"
|
|||
import { useTheme } from "@tui/context/theme"
|
||||
import { SplitBorder } from "@tui/component/border"
|
||||
import { useCommandDialog } from "@tui/component/dialog-command"
|
||||
import { useDialog } from "@tui/ui/dialog"
|
||||
import { DialogHelp } from "@tui/ui/dialog-help"
|
||||
import type { PromptInfo } from "./history"
|
||||
|
||||
export type AutocompleteRef = {
|
||||
|
|
@ -40,7 +38,6 @@ export function Autocomplete(props: {
|
|||
const sdk = useSDK()
|
||||
const sync = useSync()
|
||||
const command = useCommandDialog()
|
||||
const dialog = useDialog()
|
||||
const { theme } = useTheme()
|
||||
|
||||
const [store, setStore] = createStore({
|
||||
|
|
@ -251,7 +248,7 @@ export function Autocomplete(props: {
|
|||
{
|
||||
display: "/help",
|
||||
description: "show help",
|
||||
onSelect: () => dialog.replace(() => <DialogHelp />),
|
||||
onSelect: () => command.trigger("help.show"),
|
||||
},
|
||||
)
|
||||
const max = firstBy(results, [(x) => x.display.length, "desc"])?.display.length
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue