import React, { useState } from 'react'; import { GeneratedContent, WizardState } from '../types'; import { Copy, Check, Instagram, Image as ImageIcon, MessageSquare, Edit2, RefreshCw, X } from 'lucide-react'; import TripMap from './TripMap'; interface StepResultProps { content: GeneratedContent; onRegenerate: (slideCount: number, feedback: string) => void; isRegenerating: boolean; // We need to access the wizard state to check for trip data // But standard props here only have content. // Ideally, StepResult should receive `data` too, but for now I'll check if I can pass it from App.tsx or infer it. // Wait, I can't access `data` unless I modify App.tsx to pass it to StepResult. // Let's assume the parent updates the props. // Actually, I'll modify the StepResultProps in this file, but I also need to modify App.tsx to pass 'data'. // However, looking at App.tsx, StepResult is rendered inside App.tsx. I can pass `data` there easily. // But wait, the previous code block for StepResult didn't show 'data' in props. // I will add `tripData` to the props. } // Extending interface to include tripData optionally passed from parent // Note: I will update App.tsx to pass this prop. interface ExtendedStepResultProps extends StepResultProps { tripData?: WizardState['tripData']; } const StepResult: React.FC = ({ content, onRegenerate, isRegenerating, tripData }) => { const [copiedSection, setCopiedSection] = useState(null); const [copiedSlideIndex, setCopiedSlideIndex] = useState(null); // Edit Mode State const [isEditing, setIsEditing] = useState(false); const [slideCount, setSlideCount] = useState(content.slides.length || 12); const [feedback, setFeedback] = useState(""); const copyToClipboard = (text: string, sectionId: string) => { navigator.clipboard.writeText(text); setCopiedSection(sectionId); setTimeout(() => setCopiedSection(null), 2000); }; const copySlideText = (text: string, index: number) => { navigator.clipboard.writeText(text); setCopiedSlideIndex(index); setTimeout(() => setCopiedSlideIndex(null), 2000); }; const handleApplyChanges = () => { onRegenerate(slideCount, feedback); setIsEditing(false); // Close edit panel on submit, assumes success or loading state handles visual feedback }; return (
{/* Top Header with Edit Button */}

Tw贸j Vibe Gotowy! 馃帀

Oto kompletna struktura Twojego posta. Skopiuj i publikuj.

{!isEditing && !isRegenerating && ( )}
{/* Edit Panel (Conditional) */} {(isEditing || isRegenerating) && (
{isRegenerating && (

Nanusz臋 poprawki...

)}

Wprowad藕 poprawki

{!isRegenerating && ( )}
{/* Slider */}
setSlideCount(parseInt(e.target.value))} className="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-[#EA4420]" />
3 (Minimum) 20 (Maksimum)
{/* Feedback Textarea */}