'use client'; import { useState, useEffect, use } from 'react'; import Link from 'next/link'; import { getPromptBySlug } from '@/lib/actions/promptActions'; import { ArrowLeft, Copy, Check, Sparkles, Tag, Share2 } from 'lucide-react'; export default function PromptDetailPage({ params }: { params: Promise<{ locale: string; slug: string }> }) { const { locale, slug } = use(params); const [prompt, setPrompt] = useState(null); const [loading, setLoading] = useState(true); const [copied, setCopied] = useState(false); const [copiedLink, setCopiedLink] = useState(false); useEffect(() => { async function loadData() { setLoading(true); const res = await getPromptBySlug(slug); setPrompt(res); setLoading(false); } loadData(); }, [slug]); const handleCopyPrompt = async () => { if (!prompt) return; try { await navigator.clipboard.writeText(prompt.content); setCopied(true); setTimeout(() => setCopied(false), 2000); } catch (err) { console.error('Copy error:', err); } }; const handleShare = async () => { try { await navigator.clipboard.writeText(window.location.href); setCopiedLink(true); setTimeout(() => setCopiedLink(false), 2000); } catch (err) { console.error('Share error:', err); } }; if (loading) { return (

Loading prompt...

); } if (!prompt) { return (

Prompt Not Found

← Back to Prompts Library
); } return (
{/* Navigation & Share Bar */}
Back to Prompts
{/* Header Banner */}
{prompt.category} {prompt.tags?.map((t: string) => ( #{t} ))}

{prompt.title}

{prompt.description}

{/* Full Prompt Container */}

AI System Prompt Content

{prompt.content}
); }