import React, { useState } from 'react'; import { Button } from '../../ui/button'; import { Input } from '../../ui/input'; import { X, Lock, Globe } from 'lucide-react'; import { useToast } from '../../../components/feedback/ToastProvider'; interface SaveQueueAsPlaylistModalProps { onClose: () => void; onSave: (name: string, isPublic: boolean) => void | Promise; } export const SaveQueueAsPlaylistModal: React.FC< SaveQueueAsPlaylistModalProps > = ({ onClose, onSave }) => { const { addToast } = useToast(); const [name, setName] = useState(''); const [isPublic, setIsPublic] = useState(false); const [saving, setSaving] = useState(false); const handleSubmit = async () => { if (!name) { addToast('Please name your playlist', 'error'); return; } setSaving(true); try { await onSave(name, isPublic); onClose(); } catch (err) { addToast( err instanceof Error ? err.message : 'Failed to save playlist', 'error', ); } finally { setSaving(false); } }; return (

Save Queue as Playlist

setName(e.target.value)} autoFocus placeholder="My Queue Session" />
setIsPublic(!isPublic)} >
{isPublic ? ( ) : ( )}
{isPublic ? 'Public Playlist' : 'Private Playlist'}
{isPublic ? 'Visible on your profile' : 'Only visible to you'}
); };