9 changed files with 64 additions and 92 deletions
@ -1,35 +0,0 @@
@@ -1,35 +0,0 @@
|
||||
import { Button } from '@/components/ui/button' |
||||
import { Check, Copy, Link } from 'lucide-react' |
||||
import { useState } from 'react' |
||||
import { toast } from 'sonner' |
||||
import SaveRelayDropdownMenu from '../SaveRelayDropdownMenu' |
||||
|
||||
export default function RelayPageControls({ url }: { url: string }) { |
||||
const [copiedUrl, setCopiedUrl] = useState(false) |
||||
const [copiedShareableUrl, setCopiedShareableUrl] = useState(false) |
||||
|
||||
const handleCopyUrl = () => { |
||||
navigator.clipboard.writeText(url) |
||||
setCopiedUrl(true) |
||||
setTimeout(() => setCopiedUrl(false), 2000) |
||||
} |
||||
|
||||
const handleCopyShareableUrl = () => { |
||||
navigator.clipboard.writeText(`https://jumble.social/?r=${url}`) |
||||
setCopiedShareableUrl(true) |
||||
toast.success('Shareable URL copied to clipboard') |
||||
setTimeout(() => setCopiedShareableUrl(false), 2000) |
||||
} |
||||
|
||||
return ( |
||||
<> |
||||
<Button variant="ghost" size="titlebar-icon" onClick={handleCopyShareableUrl}> |
||||
{copiedShareableUrl ? <Check /> : <Link />} |
||||
</Button> |
||||
<Button variant="ghost" size="titlebar-icon" onClick={handleCopyUrl}> |
||||
{copiedUrl ? <Check /> : <Copy />} |
||||
</Button> |
||||
<SaveRelayDropdownMenu urls={[url]} atTitlebar /> |
||||
</> |
||||
) |
||||
} |
||||
Loading…
Reference in new issue