diff --git a/app/listings/new/page.tsx b/app/listings/new/page.tsx index a3277be..3f72b02 100644 --- a/app/listings/new/page.tsx +++ b/app/listings/new/page.tsx @@ -59,6 +59,7 @@ export default function NewListingPage() { const [loading, setLoading] = useState(false); const [isAuthed, setIsAuthed] = useState(false); const [aiResponse, setAiResponse] = useState(''); + const [copyStatus, setCopyStatus] = useState<'idle' | 'copied' | 'error'>('idle'); useEffect(() => { setCurrentLocale(uiLocale as Locale); @@ -192,6 +193,18 @@ export default function NewListingPage() { } } + async function copyAiPrompt() { + try { + if (!navigator?.clipboard) throw new Error('clipboard unavailable'); + await navigator.clipboard.writeText(aiPrompt); + setCopyStatus('copied'); + setTimeout(() => setCopyStatus('idle'), 1500); + } catch (err) { + setCopyStatus('error'); + setTimeout(() => setCopyStatus('idle'), 2000); + } + } + function parseImages(): ImageInput[] { return selectedImages.map((img) => ({ data: img.dataUrl, @@ -306,7 +319,7 @@ export default function NewListingPage() { } return ( -
+

{t('createListingTitle')}