diff --git a/ui/src/styles/components.css b/ui/src/styles/components.css index 896334fa93e..af4d8126b7d 100644 --- a/ui/src/styles/components.css +++ b/ui/src/styles/components.css @@ -126,6 +126,36 @@ user-select: all; } +.login-gate__command { + display: flex; + align-items: center; + gap: 8px; + margin: 4px 0 2px; + padding: 5px 8px 5px 10px; + background: var(--bg); + border: 1px solid var(--border); + border-radius: var(--radius); + color: var(--fg); + cursor: copy; +} + +.login-gate__command:hover { + border-color: var(--accent); +} + +.login-gate__command:focus-visible { + outline: 2px solid var(--accent); + outline-offset: 2px; +} + +.login-gate__command code { + flex: 1; + margin: 0; + padding: 0; + background: transparent; + border: 0; +} + .login-gate__docs { margin-top: 10px; font-size: 11px; diff --git a/ui/src/ui/chat/copy-as-markdown.ts b/ui/src/ui/chat/copy-as-markdown.ts index 7081fd1959f..f5b31b3284e 100644 --- a/ui/src/ui/chat/copy-as-markdown.ts +++ b/ui/src/ui/chat/copy-as-markdown.ts @@ -92,6 +92,10 @@ function createCopyButton(options: CopyButtonOptions): TemplateResult { `; } -export function renderCopyAsMarkdownButton(markdown: string): TemplateResult { - return createCopyButton({ text: () => markdown, label: COPY_LABEL }); +export function renderCopyButton(text: string, label = COPY_LABEL): TemplateResult { + return createCopyButton({ text: () => text, label }); +} + +export function renderCopyAsMarkdownButton(markdown: string): TemplateResult { + return renderCopyButton(markdown, COPY_LABEL); } diff --git a/ui/src/ui/views/connect-command.ts b/ui/src/ui/views/connect-command.ts new file mode 100644 index 00000000000..a609577072e --- /dev/null +++ b/ui/src/ui/views/connect-command.ts @@ -0,0 +1,38 @@ +import { html } from "lit"; +import { renderCopyButton } from "../chat/copy-as-markdown.ts"; + +async function copyCommand(command: string) { + try { + await navigator.clipboard.writeText(command); + } catch { + // Best effort only; the explicit copy button provides visible feedback. + } +} + +export function renderConnectCommand(command: string) { + return html` +
${command}
+ ${renderCopyButton(command, "Copy command")}
+ openclaw gateway runopenclaw dashboard --no-openopenclaw gateway runopenclaw dashboard --no-open
+ ${t("overview.connection.step1")}
+ ${renderConnectCommand("openclaw gateway run")}
+