diff --git a/src/components/NoteOptions/RawEventDialog.tsx b/src/components/NoteOptions/RawEventDialog.tsx index 6155d26..ebbd0f2 100644 --- a/src/components/NoteOptions/RawEventDialog.tsx +++ b/src/components/NoteOptions/RawEventDialog.tsx @@ -8,7 +8,7 @@ import { import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area' import { Button } from '@/components/ui/button' import { Event } from 'nostr-tools' -import { WrapText } from 'lucide-react' +import { WrapText, Copy, Check } from 'lucide-react' import { useState } from 'react' import { useTranslation } from 'react-i18next' @@ -23,6 +23,17 @@ export default function RawEventDialog({ }) { const { t } = useTranslation() const [wordWrapEnabled, setWordWrapEnabled] = useState(true) + const [copied, setCopied] = useState(false) + + const handleCopy = async () => { + try { + await navigator.clipboard.writeText(JSON.stringify(event, null, 2)) + setCopied(true) + setTimeout(() => setCopied(false), 2000) + } catch (err) { + console.error('Failed to copy:', err) + } + } return ( @@ -33,15 +44,24 @@ export default function RawEventDialog({ Raw Event View the raw event data - +
+ + +