feat: 💨

This commit is contained in:
codytseng 2025-08-28 22:58:47 +08:00
parent 3878b84f4c
commit 35df916a19
17 changed files with 183 additions and 208 deletions

View file

@ -0,0 +1,35 @@
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 />
</>
)
}