2026-01-07 09:31:02 +00:00
|
|
|
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 '../../../context/ToastContext';
|
|
|
|
|
|
|
|
|
|
interface SaveQueueAsPlaylistModalProps {
|
|
|
|
|
onClose: () => void;
|
|
|
|
|
onSave: (name: string, isPublic: boolean) => void;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
export const SaveQueueAsPlaylistModal: React.FC<
|
|
|
|
|
SaveQueueAsPlaylistModalProps
|
|
|
|
|
> = ({ onClose, onSave }) => {
|
2026-01-07 09:31:02 +00:00
|
|
|
const { addToast } = useToast();
|
|
|
|
|
const [name, setName] = useState('');
|
|
|
|
|
const [isPublic, setIsPublic] = useState(false);
|
|
|
|
|
|
|
|
|
|
const handleSubmit = () => {
|
2026-01-13 18:47:57 +00:00
|
|
|
if (!name) {
|
|
|
|
|
addToast('Please name your playlist', 'error');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
onSave(name, isPublic);
|
|
|
|
|
onClose();
|
2026-01-07 09:31:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="fixed inset-0 z-[100] flex items-center justify-center p-4">
|
2026-01-13 18:47:57 +00:00
|
|
|
<div
|
|
|
|
|
className="absolute inset-0 bg-kodo-void/90 backdrop-blur-sm"
|
|
|
|
|
onClick={onClose}
|
|
|
|
|
></div>
|
2026-01-07 09:31:02 +00:00
|
|
|
<div className="relative w-full max-w-md bg-kodo-graphite border border-kodo-steel rounded-xl shadow-2xl animate-scaleIn">
|
|
|
|
|
<div className="p-4 border-b border-kodo-steel bg-kodo-ink flex justify-between items-center">
|
|
|
|
|
<h3 className="font-bold text-white">Save Queue as Playlist</h3>
|
2026-01-13 18:47:57 +00:00
|
|
|
<button onClick={onClose}>
|
2026-01-16 00:59:31 +00:00
|
|
|
<X className="w-5 h-5 text-kodo-content-dim hover:text-white" />
|
2026-01-13 18:47:57 +00:00
|
|
|
</button>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="p-6 space-y-4">
|
2026-01-13 18:47:57 +00:00
|
|
|
<Input
|
|
|
|
|
label="Playlist Name"
|
|
|
|
|
value={name}
|
|
|
|
|
onChange={(e) => setName(e.target.value)}
|
|
|
|
|
autoFocus
|
|
|
|
|
placeholder="My Queue Session"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<div
|
2026-01-16 00:59:31 +00:00
|
|
|
className="flex items-center justify-between p-3 bg-kodo-ink rounded border border-kodo-steel cursor-pointer hover:border-kodo-steel"
|
2026-01-13 18:47:57 +00:00
|
|
|
onClick={() => setIsPublic(!isPublic)}
|
|
|
|
|
>
|
|
|
|
|
<div className="flex items-center gap-3">
|
|
|
|
|
{isPublic ? (
|
|
|
|
|
<Globe className="w-5 h-5 text-kodo-cyan" />
|
|
|
|
|
) : (
|
|
|
|
|
<Lock className="w-5 h-5 text-kodo-gold" />
|
|
|
|
|
)}
|
|
|
|
|
<div>
|
|
|
|
|
<div className="text-sm font-bold text-white">
|
|
|
|
|
{isPublic ? 'Public Playlist' : 'Private Playlist'}
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
2026-01-16 00:59:31 +00:00
|
|
|
<div className="text-xs text-kodo-content-dim">
|
2026-01-13 18:47:57 +00:00
|
|
|
{isPublic ? 'Visible on your profile' : 'Only visible to you'}
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
2026-01-13 18:47:57 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
2026-01-16 00:59:31 +00:00
|
|
|
className={`w-10 h-5 rounded-full relative transition-colors ${isPublic ? 'bg-kodo-cyan' : 'bg-kodo-steel'}`}
|
2026-01-13 18:47:57 +00:00
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
className={`absolute top-1 w-3 h-3 bg-white rounded-full transition-all ${isPublic ? 'left-6' : 'left-1'}`}
|
|
|
|
|
></div>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
2026-01-13 18:47:57 +00:00
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="p-4 border-t border-kodo-steel bg-kodo-ink flex justify-end gap-3">
|
2026-01-13 18:47:57 +00:00
|
|
|
<Button variant="ghost" onClick={onClose}>
|
|
|
|
|
Cancel
|
|
|
|
|
</Button>
|
|
|
|
|
<Button variant="primary" onClick={handleSubmit}>
|
|
|
|
|
Save Playlist
|
|
|
|
|
</Button>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|