'use client'; import React, { useState } from 'react'; import { Check, Edit3, Trash2, Send, ExternalLink, Eye, Calendar, Sparkles, MessageSquare, AlertCircle } from 'lucide-react'; import { InfoTooltip } from './InfoTooltip'; export interface RawPostData { id: string; message_id: number; original_text: string | null; post_url: string; media_type: string; media_url: string | null; views: number; reactions: number; posted_at: string; } export interface DraftItem { id: string; raw_post_id: string; ai_generated_text: string; current_text: string; status: string; brand_target: string; created_at: string; raw_post?: RawPostData; } interface DraftCardProps { draft: DraftItem; onApprove: (id: string) => void; onEditApprove: (id: string, text: string) => void; onReject: (id: string, reason?: string) => void; } export const DraftCard: React.FC = ({ draft, onApprove, onEditApprove, onReject, }) => { const [isEditing, setIsEditing] = useState(false); const [editedText, setEditedText] = useState(draft.current_text); const [rejectReason, setRejectReason] = useState(''); const [showRejectModal, setShowRejectModal] = useState(false); const rawPost = draft.raw_post; const handleSaveEdit = () => { onEditApprove(draft.id, editedText); setIsEditing(false); }; const handleConfirmReject = () => { onReject(draft.id, rejectReason || 'نامناسب برای کانال برند'); setShowRejectModal(false); }; return (
{/* Top Bar */}
Agent B Draft برند مقصد: {draft.brand_target}
{rawPost && ( <>
{rawPost.views.toLocaleString()}
{new Date(rawPost.posted_at).toLocaleDateString('fa-IR')}
مشاهده پست منبع )}
{/* Main Grid: Source Post vs Rewritten Copy */}
{/* Source Content Preview (4 cols) */}
محتوای منبع (کانال اصلی)
{/* Media Preview */} {rawPost?.media_url && (
{rawPost.media_type === 'photo' ? ( Media preview ) : (
)}
{rawPost?.original_text || '(بدون متن - فقط مدیا)'}
شناسه پیام: {rawPost?.message_id} مدیا: {rawPost?.media_type}
{/* AI Persian Copy / Inline Editor (7 cols) */}
کپی فارسی اختصاصی تلگرام (عامیانه و جذاب)
{isEditing ? (