'use client' import { useState } from 'react' import type { SeedURL, Category } from '../types' import SeedModal from './SeedModal' export default function SeedsTab({ seeds, allSeeds, categories, searchQuery, setSearchQuery, selectedCategory, setSelectedCategory, onToggleEnabled, onDelete, onSaved, }: { seeds: SeedURL[] allSeeds: SeedURL[] categories: Category[] searchQuery: string setSearchQuery: (q: string) => void selectedCategory: string setSelectedCategory: (cat: string) => void onToggleEnabled: (id: string) => void onDelete: (id: string) => void onSaved: () => void }) { const [showAddModal, setShowAddModal] = useState(false) const [editingSeed, setEditingSeed] = useState(null) const filteredSeeds = seeds.filter(seed => { const matchesCategory = selectedCategory === 'all' || seed.category === selectedCategory const matchesSearch = seed.name.toLowerCase().includes(searchQuery.toLowerCase()) || seed.url.toLowerCase().includes(searchQuery.toLowerCase()) return matchesCategory && matchesSearch }) return (
{/* Header with filters */}
setSearchQuery(e.target.value)} />
{/* Category Quick Stats */}
{categories.map(cat => { const count = allSeeds.filter(s => s.category === cat.name).length return ( ) })}
{/* Seeds Table */}
{filteredSeeds.map(seed => ( ))}
Status Name URL Kategorie Trust Dokumente Aktionen
{seed.name}
{seed.description}
{seed.url.replace(/^https?:\/\/(www\.)?/, '').slice(0, 30)}... {categories.find(c => c.name === seed.category)?.icon || '📁'} {categories.find(c => c.name === seed.category)?.display_name || seed.category} = 0.4 ? 'bg-green-100 text-green-700' : seed.trustBoost >= 0.2 ? 'bg-yellow-100 text-yellow-700' : 'bg-slate-100 text-slate-700' }`}> +{seed.trustBoost.toFixed(2)} {seed.documentCount?.toLocaleString() || '-'}
{filteredSeeds.length === 0 && (
Keine Seed-URLs gefunden
)} {/* Modals */} {(showAddModal || editingSeed) && ( { setShowAddModal(false) setEditingSeed(null) }} onSaved={onSaved} /> )}
) }