diff --git a/src/components/dashboard/DashboardLoadingStates.tsx b/src/components/dashboard/DashboardLoadingStates.tsx index 9f35776..465e387 100644 --- a/src/components/dashboard/DashboardLoadingStates.tsx +++ b/src/components/dashboard/DashboardLoadingStates.tsx @@ -2,12 +2,7 @@ import { AppLayout } from '@/components/AppLayout' import { DashboardHeader } from '@/components/dashboard/DashboardHeader' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' -interface LoadingSkeletonProps { - title: string - description: string -} - -export function LoadingSkeleton({ title, description }: LoadingSkeletonProps) { +export function LoadingSkeleton() { return ( { - const handleCreditsChanged = (data: { credits_after: number }) => { + const handleCreditsChanged = (...args: unknown[]) => { + const data = args[0] as { credits_after: number } setCredits(data.credits_after) } diff --git a/src/components/player/CompactPlayer.tsx b/src/components/player/CompactPlayer.tsx index aed9c02..7a959e9 100644 --- a/src/components/player/CompactPlayer.tsx +++ b/src/components/player/CompactPlayer.tsx @@ -51,7 +51,8 @@ export function CompactPlayer({ className }: CompactPlayerProps) { // Listen for player state updates useEffect(() => { - const handlePlayerState = (newState: PlayerState) => { + const handlePlayerState = (...args: unknown[]) => { + const newState = args[0] as PlayerState setState(newState) } diff --git a/src/components/player/Player.tsx b/src/components/player/Player.tsx index 62774cd..8d541b8 100644 --- a/src/components/player/Player.tsx +++ b/src/components/player/Player.tsx @@ -99,7 +99,8 @@ export function Player({ className, onPlayerModeChange }: PlayerProps) { // Listen for player state updates useEffect(() => { - const handlePlayerState = (newState: PlayerState) => { + const handlePlayerState = (...args: unknown[]) => { + const newState = args[0] as PlayerState setState(newState) } diff --git a/src/components/playlists/PlaylistRow.tsx b/src/components/playlists/PlaylistRow.tsx index 619806e..ae2279a 100644 --- a/src/components/playlists/PlaylistRow.tsx +++ b/src/components/playlists/PlaylistRow.tsx @@ -2,7 +2,7 @@ import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { TableCell, TableRow } from '@/components/ui/table' import type { Playlist } from '@/lib/api/services/playlists' -import { formatDate, formatDateDistanceToNow } from '@/utils/format-date' +import { formatDateDistanceToNow } from '@/utils/format-date' import { formatDuration } from '@/utils/format-duration' import { Calendar, Clock, Edit, Music, Play, User } from 'lucide-react' diff --git a/src/components/playlists/playlist-edit/PlaylistDetailsCard.tsx b/src/components/playlists/playlist-edit/PlaylistDetailsCard.tsx index a4803b8..6b85328 100644 --- a/src/components/playlists/playlist-edit/PlaylistDetailsCard.tsx +++ b/src/components/playlists/playlist-edit/PlaylistDetailsCard.tsx @@ -117,7 +117,13 @@ export function PlaylistDetailsCard({ {/* Edit/Save/Cancel buttons */}
- {isEditMode ? ( + {playlist.is_main ? ( +
+

+ Main playlist details cannot be edited +

+
+ ) : isEditMode ? (
- + {onRemoveSound && !isMainPlaylist && ( + + )}
) } \ No newline at end of file diff --git a/src/components/playlists/playlist-edit/SortableTableRow.tsx b/src/components/playlists/playlist-edit/SortableTableRow.tsx index dd50eca..6966c5f 100644 --- a/src/components/playlists/playlist-edit/SortableTableRow.tsx +++ b/src/components/playlists/playlist-edit/SortableTableRow.tsx @@ -12,8 +12,9 @@ interface SortableTableRowProps { index: number onMoveSoundUp: (index: number) => void onMoveSoundDown: (index: number) => void - onRemoveSound: (soundId: number) => void + onRemoveSound?: (soundId: number) => void totalSounds: number + isMainPlaylist?: boolean } export function SortableTableRow({ @@ -23,6 +24,7 @@ export function SortableTableRow({ onMoveSoundDown, onRemoveSound, totalSounds, + isMainPlaylist = false, }: SortableTableRowProps) { const { attributes, @@ -97,15 +99,17 @@ export function SortableTableRow({ > - + {onRemoveSound && !isMainPlaylist && ( + + )} diff --git a/src/lib/events.ts b/src/lib/events.ts index b946500..5b3dcd0 100644 --- a/src/lib/events.ts +++ b/src/lib/events.ts @@ -2,7 +2,7 @@ * Simple event emitter for cross-component communication */ -type EventHandler = (...args: unknown[]) => void +export type EventHandler = (...args: unknown[]) => void class EventEmitter { private events: Map = new Map() diff --git a/src/pages/DashboardPage.tsx b/src/pages/DashboardPage.tsx index 5685b86..26b250d 100644 --- a/src/pages/DashboardPage.tsx +++ b/src/pages/DashboardPage.tsx @@ -158,7 +158,7 @@ export function DashboardPage() { }, [fetchTopSounds]) if (loading) { - return + return } if (error || !soundboardStatistics || !trackStatistics) { diff --git a/src/pages/PlaylistEditPage.tsx b/src/pages/PlaylistEditPage.tsx index a37059b..0f07bc6 100644 --- a/src/pages/PlaylistEditPage.tsx +++ b/src/pages/PlaylistEditPage.tsx @@ -282,6 +282,11 @@ export function PlaylistEditPage() { } const handleAddSoundToPlaylist = async (soundId: number) => { + if (playlist?.is_main) { + toast.error('Cannot add sounds to the main playlist') + return + } + try { // Add at the end - backend should handle position gaps automatically const position = sounds.length @@ -328,6 +333,11 @@ export function PlaylistEditPage() { } const handleRemoveSound = async (soundId: number) => { + if (playlist?.is_main) { + toast.error('Cannot remove sounds from the main playlist') + return + } + try { // Find the sound being removed const removedSound = sounds.find(s => s.id === soundId) @@ -417,6 +427,12 @@ export function PlaylistEditPage() { const activeId = active.id as string const overId = over.id as string + // Prevent adding sounds to main playlist + if (playlist?.is_main && activeId.startsWith('available-sound-')) { + toast.error('Cannot add sounds to the main playlist') + return + } + // Handle adding sound from available list to playlist if ( activeId.startsWith('available-sound-') && @@ -585,22 +601,24 @@ export function PlaylistEditPage() { Playlist Sounds ({sounds.length})
- + {!playlist.is_main && ( + + )}
+ ) : playlist.is_main ? ( + // Main playlist: Only show sounds in read-only mode with reordering + sounds.length === 0 ? ( +
+ +

No sounds in main playlist

+

+ Main playlist sounds are managed automatically +

+
+ ) : ( +
+ `table-sound-${sound.id}`)} + strategy={verticalListSortingStrategy} + > + + + + +
+
+
+
+
+
+ # +
+
+ Name + Duration + Type + Plays + Actions +
+
+ + {sounds.map((sound, index) => ( + + ))} + +
+
+
+ ) ) : isAddMode ? ( // Add Mode: Split layout with simplified playlist and available sounds
@@ -785,6 +857,7 @@ export function PlaylistEditPage() { onMoveSoundDown={handleMoveSoundDown} onRemoveSound={handleRemoveSound} totalSounds={sounds.length} + isMainPlaylist={false} /> ))} diff --git a/src/pages/SoundsPage.tsx b/src/pages/SoundsPage.tsx index 9116a75..938b981 100644 --- a/src/pages/SoundsPage.tsx +++ b/src/pages/SoundsPage.tsx @@ -141,7 +141,8 @@ export function SoundsPage() { // Listen for sound_played events and update play_count useEffect(() => { - const handleSoundPlayed = (eventData: SoundPlayedEventData) => { + const handleSoundPlayed = (...args: unknown[]) => { + const eventData = args[0] as SoundPlayedEventData setSounds(prevSounds => prevSounds.map(sound => sound.id === eventData.sound_id