import React, { useState } from 'react'; import { Button } from '../../ui/button'; import { Input } from '../../ui/input'; import { X, Lock, Globe, Image as ImageIcon } from 'lucide-react'; import { useToast } from '../../../components/feedback/ToastProvider'; import { Playlist } from '../../../types'; interface EditPlaylistModalProps { playlist: Playlist; onClose: () => void; onSave: (data: Partial) => void; onDelete: () => void; } export const EditPlaylistModal: React.FC = ({ playlist, onClose, onSave, onDelete, }) => { const { addToast } = useToast(); const [name, setName] = useState(playlist.title); const [description, setDescription] = useState(playlist.description || ''); const [isPublic, setIsPublic] = useState(playlist.is_public ?? true); const [showDeleteConfirm, setShowDeleteConfirm] = useState(false); const handleSubmit = () => { if (!name) { addToast('Playlist name cannot be empty', 'error'); return; } onSave({ title: name, description, is_public: isPublic }); onClose(); }; const handleDelete = () => { onDelete(); onClose(); }; if (showDeleteConfirm) { return (
setShowDeleteConfirm(false)} >

Delete "{playlist.title}"?

This action cannot be undone.

); } return (

Edit Details

setName(e.target.value)} />