'use client'; import { useState } from 'react'; import type { VideoSource } from '@/lib/types'; interface SourceManagerProps { sources: VideoSource[]; onToggle: (id: string) => void; onDelete: (id: string) => void; onReorder: (id: string, direction: 'up' | 'down') => void; onEdit?: (source: VideoSource) => void; defaultIds: string[]; } export function SourceManager({ sources, onToggle, onDelete, onReorder, onEdit, defaultIds }: SourceManagerProps) { const [editingId, setEditingId] = useState(null); const handleToggle = (id: string) => { onToggle(id); }; const handleDelete = (id: string) => { onDelete(id); }; const handlePriorityChange = (id: string, direction: 'up' | 'down') => { onReorder(id, direction); }; return (
{sources.map((source, index) => (
{/* Toggle Switch */} {/* Source Info */}
{source.name}
{source.baseUrl}
{/* Controls */}
{/* Priority Controls */} {/* Edit Button - Only for custom sources */} {onEdit && !defaultIds.includes(source.id) && ( )} {/* Delete Button */}
))}
); }