import React, { useState } from 'react'; import { Trash2, Plus, CheckCircle2, ExternalLink, FileText, Globe, Landmark, MapPin } from 'lucide-react'; import { Competitor } from '../types'; interface StepReviewProps { competitors: Competitor[]; // Flattened list for overall count and manual management categorizedCompetitors: { localCompetitors: Competitor[]; nationalCompetitors: Competitor[]; internationalCompetitors: Competitor[]; } | null; onRemove: (id: string) => void; onAdd: (name: string) => void; onConfirm: () => void; hasResults?: boolean; onShowReport?: () => void; } export const StepReview: React.FC = ({ competitors, categorizedCompetitors, onRemove, onAdd, onConfirm, hasResults, onShowReport }) => { console.log("StepReview Props:", { competitors, categorizedCompetitors }); const [newCompany, setNewCompany] = useState(''); const handleAdd = (e: React.FormEvent) => { e.preventDefault(); if (newCompany.trim()) { onAdd(newCompany.trim()); setNewCompany(''); } }; const renderCompetitorList = (comps: Competitor[], category: string) => { // Filter out competitors that have been removed from the main list const activeIds = new Set(competitors.map(c => c.id)); const activeComps = comps.filter(c => activeIds.has(c.id)); if (!activeComps || activeComps.length === 0) { return (
  • Keine {category} Konkurrenten gefunden.
  • ); } return activeComps.map((comp) => (
  • {comp.name} {comp.url && ( )}
    {comp.description && (

    {comp.description}

    )}
  • )); }; return (

    Confirm Target List

    Review the identified companies before starting the deep tech audit.

    {competitors.length} Companies
    {/* Local Competitors */}

    Lokale Konkurrenten

      {categorizedCompetitors?.localCompetitors && renderCompetitorList(categorizedCompetitors.localCompetitors, 'lokale')}
    {/* National Competitors */}

    Nationale Konkurrenten

      {categorizedCompetitors?.nationalCompetitors && renderCompetitorList(categorizedCompetitors.nationalCompetitors, 'nationale')}
    {/* International Competitors */}

    Internationale Konkurrenten

      {categorizedCompetitors?.internationalCompetitors && renderCompetitorList(categorizedCompetitors.internationalCompetitors, 'internationale')}
    {/* Manual Additions */}

    Manuelle Ergänzungen

    setNewCompany(e.target.value)} placeholder="Add another company manually..." className="flex-1 px-4 py-2 rounded-lg border border-slate-300 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 outline-none" />
    {competitors.length > 0 && (
      {competitors.filter(comp => !categorizedCompetitors?.localCompetitors?.some(c => c.id === comp.id) && !categorizedCompetitors?.nationalCompetitors?.some(c => c.id === comp.id) && !categorizedCompetitors?.internationalCompetitors?.some(c => c.id === comp.id)) .map((comp) => (
    • {comp.name} {comp.url && ( )}
      {comp.description && (

      {comp.description}

      )}
    • ))}
    )}
    {/* Sticky Footer CTA */}
    {hasResults && onShowReport && ( )}
    ); };