diff --git a/packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx b/packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx index 5cc114f92f0..d976485319f 100644 --- a/packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx @@ -5,6 +5,7 @@ import { DialogSelect } from "@tui/ui/dialog-select" import { useDialog } from "@tui/ui/dialog" import { useSDK } from "../context/sdk" import { DialogPrompt } from "../ui/dialog-prompt" +import { Link } from "../ui/link" import { useTheme } from "../context/theme" import { TextAttributes } from "@opentui/core" import type { ProviderAuthAuthorization } from "@opencode-ai/sdk/v2" @@ -128,7 +129,7 @@ function AutoMethod(props: AutoMethodProps) { esc - {props.authorization.url} + {props.authorization.instructions} Waiting for authorization... @@ -170,7 +171,7 @@ function CodeMethod(props: CodeMethodProps) { description={() => ( {props.authorization.instructions} - {props.authorization.url} + Invalid code diff --git a/packages/opencode/src/cli/cmd/tui/ui/link.tsx b/packages/opencode/src/cli/cmd/tui/ui/link.tsx new file mode 100644 index 00000000000..1f798c54cca --- /dev/null +++ b/packages/opencode/src/cli/cmd/tui/ui/link.tsx @@ -0,0 +1,29 @@ +import type { JSX } from "solid-js" +import type { RGBA } from "@opentui/core" +import open from "open" + +export interface LinkProps { + href: string + children?: JSX.Element | string + fg?: RGBA +} + +/** + * Link component that renders clickable hyperlinks. + * Clicking anywhere on the link text opens the URL in the default browser. + */ +export function Link(props: LinkProps) { + const displayText = props.children ?? props.href + + return ( + { + open(props.href).catch(() => {}) + }} + > + {displayText} + + ) +}