import { useState } from 'react'; import { ArrowLeft, Send, User, Clock, ThumbsUp } from 'lucide-react'; import { ForumThread } from './ThreadCard'; import { useTelegram } from '../../hooks/useTelegram'; export interface ForumReply { id: string; content: string; author: string; authorAddress?: string; createdAt: Date; likes: number; userLiked?: boolean; } interface ThreadViewProps { thread: ForumThread; replies: ForumReply[]; onBack: () => void; onReply: (content: string) => void; onLikeReply: (replyId: string) => void; isConnected: boolean; } export function ThreadView({ thread, replies, onBack, onReply, onLikeReply, isConnected }: ThreadViewProps) { const { hapticImpact, showBackButton, hideBackButton, isTelegram } = useTelegram(); const [replyContent, setReplyContent] = useState(''); const [isSubmitting, setIsSubmitting] = useState(false); // Setup Telegram back button useState(() => { if (isTelegram) { showBackButton(onBack); return () => hideBackButton(); } }); const formatDate = (date: Date) => { return date.toLocaleDateString('tr-TR', { day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit' }); }; const handleSubmitReply = async () => { if (!replyContent.trim() || isSubmitting) return; setIsSubmitting(true); if (isTelegram) { hapticImpact('medium'); } try { await onReply(replyContent); setReplyContent(''); } finally { setIsSubmitting(false); } }; return (
{thread.content}
{reply.content}