feat: add copy buttons with toast notifications to OAuth dialog

- Add CopyButton component onCopy callback for custom actions
- Add device code display and copy button in OAuthCallbackDialog
- Add URL copy button next to Open Authorization Page button
- Add authorization code input copy button
- Show toast notifications: "Code copied to clipboard" and "URL copied to clipboard"
- Extract device/user code from instructions using regex pattern
This commit is contained in:
Chris Scott committed 2026-04-15 16:28:32 -04:00
1 parent 0836e324a3
commit d19ebdd9e0
2 files changed
+58 -11

No files matched your search

+5 -1
View File
@@ -8,6 +8,7 @@ interface CopyButtonProps {
className?: string
iconSize?: 'sm' | 'md'
variant?: 'default' | 'ghost'
onCopy?: () => void
}
export function CopyButton({
@@ -15,7 +16,8 @@ export function CopyButton({
title = 'Copy',
className = '',
iconSize = 'md',
variant = 'default'
variant = 'default',
onCopy
}: CopyButtonProps) {
const [copied, setCopied] = useState(false)
@@ -25,6 +27,7 @@ export function CopyButton({
await navigator.clipboard.writeText(content)
setCopied(true)
setTimeout(() => setCopied(false), 2000)
onCopy?.()
} catch {
const textArea = document.createElement('textarea')
textArea.value = content
@@ -37,6 +40,7 @@ export function CopyButton({
if (successful) {
setCopied(true)
setTimeout(() => setCopied(false), 2000)
onCopy?.()
}
} finally {
document.body.removeChild(textArea)