Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(remote): Copy code button — primary variant (clear hover) + 'Copied!' feedback

enesb1c882c6464f
diff --git a/src/renderer/components/RemoteAccessDialog.tsx b/src/renderer/components/RemoteAccessDialog.tsx
index e9c3ef883..fab44cac5 100644
--- a/src/renderer/components/RemoteAccessDialog.tsx
+++ b/src/renderer/components/RemoteAccessDialog.tsx
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'
import { createPortal } from 'react-dom'
import { useEntitlement } from '../state/entitlement'
import { Button } from '@renderer/ui/Button'
+import { CopyButton } from '@renderer/ui/CopyButton'
import { Input } from '@renderer/ui/Input'
/**
@@ -93,9 +94,7 @@ export function RemoteAccessDialog({ onClose }: { onClose: () => void }): React.
onFocus={(e) => e.target.select()}
/>
<div className="remote-dialog__row">
- <Button onClick={() => window.nodeTerminal.clipboard.writeText(hostOffer)}>
- Copy code
- </Button>
+ <CopyButton text={hostOffer} label="Copy code" />
<Button onClick={() => void stopHosting()}>Stop sharing</Button>
</div>
</div>
diff --git a/src/renderer/components/settings/sections/RemoteSection.tsx b/src/renderer/components/settings/sections/RemoteSection.tsx
index 0ccca75f3..9ac9e0948 100644
--- a/src/renderer/components/settings/sections/RemoteSection.tsx
+++ b/src/renderer/components/settings/sections/RemoteSection.tsx
@@ -4,6 +4,7 @@ import { SettingsSection } from '../SettingsSection'
import { SearchableRow } from '../SearchableRow'
import { FieldRow } from '../FieldRow'
import { Button } from '@renderer/ui/Button'
+import { CopyButton } from '@renderer/ui/CopyButton'
import { Input } from '@renderer/ui/Input'
const ROWS = {
@@ -91,9 +92,7 @@ export function RemoteSection({
}
/>
<div className="flex gap-2">
- <Button onClick={() => window.nodeTerminal.clipboard.writeText(hostOffer)}>
- Copy code
- </Button>
+ <CopyButton text={hostOffer} label="Copy code" />
<Button onClick={() => void stopHosting()}>Stop sharing</Button>
</div>
</div>
diff --git a/src/renderer/ui/CopyButton.tsx b/src/renderer/ui/CopyButton.tsx
new file mode 100644
index 000000000..47258812e
--- /dev/null
+++ b/src/renderer/ui/CopyButton.tsx
@@ -0,0 +1,40 @@
+import { useEffect, useRef, useState, type ButtonHTMLAttributes } from 'react'
+import { Button } from './Button'
+
+type Variant = 'default' | 'primary' | 'ghost'
+
+/**
+ * Copy-to-clipboard button with transient "Copied!" feedback. Defaults to the primary variant
+ * so the action reads clearly and has an obvious hover state. The label flips to "Copied!" for
+ * ~1.5s after a click, then reverts.
+ */
+export function CopyButton({
+ text,
+ label = 'Copy',
+ variant = 'primary',
+ ...rest
+}: {
+ text: string
+ label?: string
+ variant?: Variant
+} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'children'>): React.JSX.Element {
+ const [copied, setCopied] = useState(false)
+ const timer = useRef<ReturnType<typeof setTimeout>>()
+
+ useEffect(() => () => clearTimeout(timer.current), [])
+
+ return (
+ <Button
+ variant={variant}
+ onClick={() => {
+ window.nodeTerminal.clipboard.writeText(text)
+ setCopied(true)
+ clearTimeout(timer.current)
+ timer.current = setTimeout(() => setCopied(false), 1500)
+ }}
+ {...rest}
+ >
+ {copied ? 'Copied!' : label}
+ </Button>
+ )
+}