veza/apps/web/src/components/library/playlists/SaveQueueAsPlaylistModal.tsx

92 lines
3.1 KiB
TypeScript
Raw Normal View History

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;
}
export const SaveQueueAsPlaylistModal: React.FC<
SaveQueueAsPlaylistModalProps
> = ({ onClose, onSave }) => {
const { addToast } = useToast();
const [name, setName] = useState('');
const [isPublic, setIsPublic] = useState(false);
const handleSubmit = () => {
if (!name) {
addToast('Please name your playlist', 'error');
return;
}
onSave(name, isPublic);
onClose();
};
return (
<div className="fixed inset-0 z-[100] flex items-center justify-center p-4">
<div
className="absolute inset-0 bg-kodo-void/90 backdrop-blur-sm"
onClick={onClose}
></div>
<div className="relative w-full max-w-md bg-kodo-graphite border border-border rounded-xl shadow-2xl animate-scaleIn">
<div className="p-4 border-b border-border bg-kodo-ink flex justify-between items-center">
<h3 className="font-bold text-white">Save Queue as Playlist</h3>
<button onClick={onClose}>
<X className="w-5 h-5 text-muted-foreground hover:text-white" />
</button>
</div>
<div className="p-6 space-y-4">
<Input
label="Playlist Name"
value={name}
onChange={(e) => setName(e.target.value)}
autoFocus
placeholder="My Queue Session"
/>
<div
className="flex items-center justify-between p-4 bg-kodo-ink rounded border border-border cursor-pointer hover:border-border"
onClick={() => setIsPublic(!isPublic)}
>
<div className="flex items-center gap-4">
{isPublic ? (
aesthetic-improvements: reduce decorative cyan in player, library, and views (80/20 rule, batch 12) - Player: VisualizerSettingsModal decorative icon (1 instance) - Library: QueueView decorative artist text, AutoMetadataDetectionModal decorative icon and loading spinner border and fileName text and detected key text, SaveQueueAsPlaylistModal decorative icon, EditPlaylistModal decorative icon, PlaylistsView loading spinner, CreatePlaylistModal decorative icon (7 instances) - Views: StudioView decorative icon, FileDetailsView decorative icon, GearView decorative icons and order number text, ProfileView loading spinner and social icons, AnalyticsView loading spinner and decorative chart legend dot and chart bars and device icon and revenue text, DiscoverView loading spinner and decorative icon and weekly mix text, FileManagerView decorative music icons (14 instances) - Total: ~22 files, ~22 instances replaced - Preserved: Active/selected states (LyricsPanel autoScroll active state, VisualizerSettingsModal selected mode, PlayerControls shuffle/repeatMode/showVisualizer active states, MiniPlayer isQueueOpen active state, AddToPlaylistModal selected playlist, PlaylistDetailView dragged item, StudioView active tab, SearchBar focused state, CheckoutView checkbox accents - focus/interaction, SearchPageView radio button accent - focus/interaction, FileManagerView selected files checkmarks - active states, ProfileView social links - functional links, LiveView links - functional links), primary actions, design system variants - Action 11.3.1.3 in progress (twelfth batch: player, library, and views components)
2026-01-16 10:30:07 +00:00
<Globe className="w-5 h-5 text-kodo-steel" />
) : (
<Lock className="w-5 h-5 text-kodo-gold" />
)}
<div>
<div className="text-sm font-bold text-white">
{isPublic ? 'Public Playlist' : 'Private Playlist'}
</div>
<div className="text-xs text-muted-foreground">
{isPublic ? 'Visible on your profile' : 'Only visible to you'}
</div>
</div>
</div>
<div
className={`w-10 h-5 rounded-full relative transition-colors ${isPublic ? 'bg-primary' : 'bg-muted'}`}
>
<div
className={`absolute top-1 w-3 h-3 bg-white rounded-full transition-all ${isPublic ? 'left-6' : 'left-1'}`}
></div>
</div>
</div>
</div>
<div className="p-4 border-t border-border bg-kodo-ink flex justify-end gap-4">
<Button variant="ghost" onClick={onClose}>
Cancel
</Button>
<Button variant="primary" onClick={handleSubmit}>
Save Playlist
</Button>
</div>
</div>
</div>
);
};