Complete stabilization pass bringing all 3 stacks to green: Frontend (apps/web/): - Fix TypeScript nullability in useSeason.ts, useTimeOfDay.ts hooks - Disable no-undef in ESLint config (TypeScript handles it; JSX misidentified) - Rename 306 story imports from @storybook/react to @storybook/react-vite - Fix conditional hook call in useMediaQuery.ts useIsTablet - Move useQuery to top of LoginPage.tsx component - Remove useless try/catch in GearFormModal.tsx - Fix stale closure in ResetPasswordPage.tsx handleChange - Make Storybook decorators (withRouter, withQueryClient, withToast, withAudio) no-ops since global StorybookDecorator already provides these — prevents nested Router / duplicate provider crashes in vitest-browser - Fix nested MemoryRouter in 3 page stories (TrackDetail, PlaylistDetail, UserProfile) - Update i18n initialization in test setup (await init before changeLanguage) - Update ~30 test assertions from English to French to match i18n translations - Update test assertions to match SUMI V3 design changes (shadow vs border) - Fix remaining story type errors (PlayerError, PlaylistBatchActions, TrackFilters, VirtualizedChatMessages) Backend (veza-backend-api/): - Fix response_test.go RespondWithAppError signature (2 args, not 3) - Fix TestErrorContractAuthEndpoints expected error codes (ErrCodeUnauthorized vs ErrCodeInvalidCredentials) - Fix TestTrackHandler_GetTrackLikes_Success missing auth middleware setup - Fix TestPlaybackAnalyticsService_GetTrackStats k-anonymity threshold (needs 5 unique users, not 1) - Replace NOW() PostgreSQL function with time.Now() parameter in marketplace service for SQLite test compatibility - Add missing AutoMigrate entries in marketplace_test.go (ProductImage, ProductPreview, ProductLicense, ProductReview) Results: - Frontend TypeCheck: 617 errors -> 0 errors - Frontend ESLint: 349 errors -> 0 errors - Frontend Vitest: 196 failing tests -> 1 skipped (3396/3397 passing) - Backend go vet: 1 error -> 0 errors - Backend tests: 5 failing -> all 13 packages passing - Rust: 150/150 tests passing (unchanged) - Storybook audit: 0 errors across 1244 stories Triage report: docs/TRIAGE_REPORT.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
162 lines
5.9 KiB
TypeScript
162 lines
5.9 KiB
TypeScript
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<Playlist>) => void;
|
|
onDelete: () => void;
|
|
}
|
|
|
|
export const EditPlaylistModal: React.FC<EditPlaylistModalProps> = ({
|
|
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 (
|
|
<div className="fixed inset-0 z-[var(--sumi-z-popover)] flex items-center justify-center p-4">
|
|
<div
|
|
className="absolute inset-0 bg-background/90 backdrop-blur-sm"
|
|
onClick={() => setShowDeleteConfirm(false)}
|
|
></div>
|
|
<div className="relative w-full max-w-sm bg-muted shadow-[0_0_12px_rgba(220,38,38,0.15)] rounded-xl shadow-2xl animate-scaleIn p-6 text-center">
|
|
<h3 className="text-xl font-bold text-foreground mb-2">
|
|
Delete "{playlist.title}"?
|
|
</h3>
|
|
<p className="text-sm text-muted-foreground mb-6">
|
|
This action cannot be undone.
|
|
</p>
|
|
<div className="flex gap-4 justify-center">
|
|
<Button variant="ghost" onClick={() => setShowDeleteConfirm(false)}>
|
|
Cancel
|
|
</Button>
|
|
<Button
|
|
variant="primary"
|
|
className="bg-destructive hover:bg-destructive border-destructive"
|
|
onClick={handleDelete}
|
|
>
|
|
Delete
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="fixed inset-0 z-[var(--sumi-z-modal)] flex items-center justify-center p-4">
|
|
<div
|
|
className="absolute inset-0 bg-background/90 backdrop-blur-sm"
|
|
onClick={onClose}
|
|
></div>
|
|
<div className="relative w-full max-w-lg bg-muted rounded-xl shadow-2xl animate-scaleIn overflow-hidden">
|
|
<div className="p-4 border-b border-border bg-card flex justify-between items-center">
|
|
<h3 className="font-bold text-foreground">Edit Details</h3>
|
|
<button onClick={onClose}>
|
|
<X className="w-5 h-5 text-muted-foreground hover:text-foreground" />
|
|
</button>
|
|
</div>
|
|
|
|
<div className="p-6 flex flex-col md:flex-row gap-6">
|
|
<div className="w-40 h-40 bg-card shadow-[0_0_8px_rgba(26,26,30,0.05)] rounded-lg flex flex-col items-center justify-center relative group overflow-hidden flex-shrink-0">
|
|
<img
|
|
src={playlist.cover_url}
|
|
className="w-full h-full object-cover opacity-60 group-hover:opacity-40 transition-opacity"
|
|
/>
|
|
<div className="absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100">
|
|
<ImageIcon className="w-8 h-8 text-foreground" />
|
|
</div>
|
|
</div>
|
|
|
|
<div className="flex-1 space-y-4">
|
|
<Input
|
|
placeholder="Playlist Name"
|
|
value={name}
|
|
onChange={(e) => setName(e.target.value)}
|
|
/>
|
|
|
|
<textarea
|
|
className="w-full bg-muted border border-border rounded-lg p-4 text-foreground focus:border-border outline-none focus-visible:ring-2 focus-visible:ring-ring text-sm resize-none h-24"
|
|
placeholder="Description"
|
|
value={description}
|
|
onChange={(e) => setDescription(e.target.value)}
|
|
/>
|
|
|
|
<div className="space-y-2">
|
|
<div
|
|
className="flex items-center justify-between p-2 rounded hover:bg-white/5 cursor-pointer"
|
|
onClick={() => setIsPublic(!isPublic)}
|
|
>
|
|
<div className="flex items-center gap-4">
|
|
{isPublic ? (
|
|
<Globe className="w-4 h-4 text-muted-foreground" />
|
|
) : (
|
|
<Lock className="w-4 h-4 text-warning" />
|
|
)}
|
|
<div className="text-sm">
|
|
<div className="text-foreground font-bold">
|
|
{isPublic ? 'Public' : 'Private'}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div
|
|
className={`w-8 h-4 rounded-full relative transition-colors ${isPublic ? 'bg-primary' : 'bg-muted'}`}
|
|
>
|
|
<div
|
|
className={`absolute top-0.5 w-3 h-3 bg-white rounded-full transition-all ${isPublic ? 'left-4.5' : 'left-0.5'}`}
|
|
></div>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Collaborative toggle removed as it's not in the type */}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="p-4 border-t border-border bg-card flex justify-between items-center">
|
|
<Button
|
|
variant="ghost"
|
|
className="text-destructive hover:bg-destructive/10"
|
|
onClick={() => setShowDeleteConfirm(true)}
|
|
>
|
|
Delete Playlist
|
|
</Button>
|
|
<div className="flex gap-4">
|
|
<Button variant="ghost" onClick={onClose}>
|
|
Cancel
|
|
</Button>
|
|
<Button variant="primary" onClick={handleSubmit}>
|
|
Save
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|