diff options
| author | Dax <[email protected]> | 2026-03-05 10:02:30 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-05 15:02:30 +0000 |
| commit | 4da199697b73d29d9704628de4f3b46a89a69596 (patch) | |
| tree | 1b36e5065329f54517fe40e635836da9bb67f4b8 | |
| parent | 9cccaa693a796fb5b2fdfa1534b553ce407dc93e (diff) | |
| download | opencode-4da199697b73d29d9704628de4f3b46a89a69596.tar.gz opencode-4da199697b73d29d9704628de4f3b46a89a69596.zip | |
feat(tui): add onClick handler to InlineTool and Task components (#16187)
| -rw-r--r-- | packages/opencode/src/cli/cmd/tui/routes/session/index.tsx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx index 11d30ff78..d3a4ff81e 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -1625,11 +1625,14 @@ function InlineTool(props: { spinner?: boolean children: JSX.Element part: ToolPart + onClick?: () => void }) { const [margin, setMargin] = createSignal(0) const { theme } = useTheme() const ctx = use() const sync = useSync() + const renderer = useRenderer() + const [hover, setHover] = createSignal(false) const permission = createMemo(() => { const callID = sync.data.permission[ctx.sessionID]?.at(0)?.tool?.callID @@ -1639,6 +1642,7 @@ function InlineTool(props: { const fg = createMemo(() => { if (permission()) return theme.warning + if (hover() && props.onClick) return theme.text if (props.complete) return theme.textMuted return theme.text }) @@ -1656,6 +1660,12 @@ function InlineTool(props: { <box marginTop={margin()} paddingLeft={3} + onMouseOver={() => props.onClick && setHover(true)} + onMouseOut={() => setHover(false)} + onMouseUp={() => { + if (renderer.getSelection()?.getSelectedText()) return + props.onClick?.() + }} renderBefore={function () { const el = this as BoxRenderable const parent = el.parent @@ -1999,6 +2009,11 @@ function Task(props: ToolProps<typeof TaskTool>) { complete={props.input.description} pending="Delegating..." part={props.part} + onClick={() => { + if (props.metadata.sessionId) { + navigate({ type: "session", sessionID: props.metadata.sessionId }) + } + }} > {content()} </InlineTool> |
