diff --git a/src/pages/NewsletterPage.tsx b/src/pages/NewsletterPage.tsx index 205cf3d..3987341 100644 --- a/src/pages/NewsletterPage.tsx +++ b/src/pages/NewsletterPage.tsx @@ -3,6 +3,7 @@ import { useSeoMeta } from '@unhead/react'; import { Layout } from '@/components/Layout'; import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; +import { Textarea } from '@/components/ui/textarea'; import { Link } from 'react-router-dom'; import { Skeleton } from '@/components/ui/skeleton'; import { @@ -249,7 +250,7 @@ function NostrPreviewModal({ issue: NewsletterIssue; open: boolean; onClose: () => void; - onConfirm: () => void; + onConfirm: (text: string) => void; isPending: boolean; }) { const { user } = useCurrentUser(); @@ -260,16 +261,16 @@ function NostrPreviewModal({ const now = new Date(); const timeStr = now.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' }); - // Render the nostrText with hashtags highlighted and URL as a link-style span + const [editing, setEditing] = useState(false); + const [editedText, setEditedText] = useState(issue.nostrText); + + const currentText = editing ? editedText : issue.nostrText; + const renderPreviewText = (text: string) => { return text.split('\n').map((line, i) => { const parts = line.split(/(\s+)/).map((word, j) => { - if (word.startsWith('#')) { - return {word}; - } - if (word.startsWith('https://')) { - return {word}; - } + if (word.startsWith('#')) return {word}; + if (word.startsWith('https://')) return {word}; return {word}; }); return

{parts}

; @@ -282,64 +283,92 @@ function NostrPreviewModal({ - Preview — Drop #{String(issue.number).padStart(3, '0')} + {editing ? 'Edit' : 'Preview'} — Drop #{String(issue.number).padStart(3, '0')} - This is how the note will appear on most Nostr clients. Formatting varies by client. + {editing + ? 'Edit the note text below. Changes only affect this publish — the source file stays unchanged.' + : 'This is how the note will appear on most Nostr clients. Formatting varies by client.'} - {/* Mock Nostr post card */} -
- {/* Post header */} -
- - - - {displayName.slice(0, 2).toUpperCase()} - - -
-

{displayName}

-

{timeStr} · via skate-spots.org

+ {editing ? ( + /* ── Edit mode ── */ +
+