-
- {songLists.length} song list{songLists.length !== 1 ? 's' : ''} available
-
-
- {/* Debug info */}
-
- Song lists loaded: {songListCount}
-
-
- {/* Song Lists */}
-
- {songListCount === 0 ? (
-
-
-
Loading song lists...
-
Please wait while song lists are being loaded
-
- ) : songLists.length === 0 ? (
-
-
-
No song lists available
-
Song lists will appear here when they're available
-
- ) : (
-
- {songLists.map((songList) => (
- handleSongListClick(songList.key!)}>
-
-
-
- {songList.title}
-
-
- {songList.songs.length} song{songList.songs.length !== 1 ? 's' : ''}
-
-
-
- View Songs
-
-
- ))}
-
- {/* Infinite scroll trigger */}
- {hasMore && (
-
-
-
- Loading more song lists...
-
-
- )}
-
- )}
-
+
+
+ {songLists.length} song list{songLists.length !== 1 ? 's' : ''} available
+
+
+ {/* Debug info */}
+
+ Song lists loaded: {songListCount}
-
+
+ {/* Song Lists */}
+
+ {songListCount === 0 ? (
+
+
+
Loading song lists...
+
Please wait while song lists are being loaded
+
+ ) : songLists.length === 0 ? (
+
+
+
No song lists available
+
Song lists will appear here when they're available
+
+ ) : (
+
+ {songLists.map((songList) => (
+ handleSongListClick(songList.key!)}>
+
+
+
+ {songList.title}
+
+
+ {songList.songs.length} song{songList.songs.length !== 1 ? 's' : ''}
+
+
+
+ View Songs
+
+
+ ))}
+
+ {/* Infinite scroll trigger */}
+ {hasMore && (
+
+
+
+ Loading more song lists...
+
+
+ )}
+
+ )}
+
+
{/* Song List Modal */}
@@ -178,8 +176,8 @@ const SongLists: React.FC = () => {
-
-
+ {/* Remove IonContent, use a div instead */}
+
{finalSelectedList?.songs.map((songListSong: SongListSong, idx) => {
const availableSongs = checkSongAvailability(songListSong);
@@ -212,7 +210,7 @@ const SongLists: React.FC = () => {
{isAvailable ? (
{availableSongs.map((song: Song, sidx) => (
-
+
{song.title}
@@ -250,7 +248,7 @@ const SongLists: React.FC = () => {
);
})}
-
+
>
);
diff --git a/src/features/TopPlayed/Top100.tsx b/src/features/TopPlayed/Top100.tsx
index ee9c145..7ee4f71 100644
--- a/src/features/TopPlayed/Top100.tsx
+++ b/src/features/TopPlayed/Top100.tsx
@@ -1,14 +1,17 @@
import React from 'react';
import { IonHeader, IonToolbar, IonTitle, IonChip, IonIcon } from '@ionic/react';
+import { trophy } from 'ionicons/icons';
import { InfiniteScrollList } from '../../components/common';
import { useTopPlayed } from '../../hooks';
import { useAppSelector } from '../../redux';
import { selectTopPlayed } from '../../redux';
+import type { TopPlayed, Song } from '../../types';
+
+const Top100: React.FC = () => {
+ console.log('Top100 component - RENDERING START');
-const TopPlayed: React.FC = () => {
const {
topPlayedItems,
- hasMore,
loadMore,
handleAddToQueue,
handleToggleFavorite,
@@ -17,18 +20,110 @@ const TopPlayed: React.FC = () => {
const topPlayed = useAppSelector(selectTopPlayed);
const topPlayedCount = Object.keys(topPlayed).length;
- // Debug logging
- console.log('TopPlayed component - top played count:', topPlayedCount);
- console.log('TopPlayed component - top played items:', topPlayedItems);
+ console.log('Top100 component - Redux data:', { topPlayedCount, topPlayedItems: topPlayedItems.length });
- const renderExtraContent = (item: any, index: number) => (
-
- );
+ // Mock data for testing
+ const mockTopPlayedItems: TopPlayed[] = [
+ {
+ key: 'mock-1',
+ title: 'Bohemian Rhapsody',
+ artist: 'Queen',
+ count: 156
+ },
+ {
+ key: 'mock-2',
+ title: 'Sweet Caroline',
+ artist: 'Neil Diamond',
+ count: 142
+ },
+ {
+ key: 'mock-3',
+ title: 'Don\'t Stop Believin\'',
+ artist: 'Journey',
+ count: 128
+ },
+ {
+ key: 'mock-4',
+ title: 'Livin\' on a Prayer',
+ artist: 'Bon Jovi',
+ count: 115
+ },
+ {
+ key: 'mock-5',
+ title: 'Wonderwall',
+ artist: 'Oasis',
+ count: 98
+ },
+ {
+ key: 'mock-6',
+ title: 'Hotel California',
+ artist: 'Eagles',
+ count: 87
+ },
+ {
+ key: 'mock-7',
+ title: 'Stairway to Heaven',
+ artist: 'Led Zeppelin',
+ count: 76
+ },
+ {
+ key: 'mock-8',
+ title: 'Imagine',
+ artist: 'John Lennon',
+ count: 65
+ },
+ {
+ key: 'mock-9',
+ title: 'Hey Jude',
+ artist: 'The Beatles',
+ count: 54
+ },
+ {
+ key: 'mock-10',
+ title: 'Yesterday',
+ artist: 'The Beatles',
+ count: 43
+ }
+ ];
+
+ // Convert TopPlayed items to Song format for consistent UI
+ const songItems: Song[] = mockTopPlayedItems.map((item: TopPlayed) => ({
+ ...item,
+ path: '', // TopPlayed doesn't have path
+ disabled: false,
+ favorite: false,
+ }));
+
+ // Use mock data for now
+ const displayItems = songItems;
+ const displayCount = songItems.length;
+ const displayHasMore = false; // No more mock data to load
+
+ console.log('Top100 component - Mock data:', {
+ displayItems: displayItems.length,
+ displayCount,
+ displayHasMore,
+ firstItem: displayItems[0]
+ });
+
+ console.log('Top100 component - About to render JSX');
+
+ // Wrapper functions to handle type conversion
+ const handleAddToQueueWrapper = (song: Song) => {
+ console.log('Top100 component - Add to Queue clicked:', song);
+ const topPlayedItem = mockTopPlayedItems.find(item => item.key === song.key);
+ if (topPlayedItem) {
+ handleAddToQueue(topPlayedItem);
+ }
+ };
+
+ const handleToggleFavoriteWrapper = (song: Song) => {
+ console.log('Top100 component - Remove clicked:', song);
+ const topPlayedItem = mockTopPlayedItems.find(item => item.key === song.key);
+ if (topPlayedItem) {
+ handleToggleFavorite(topPlayedItem);
+ }
+ };
return (
<>
@@ -37,33 +132,41 @@ const TopPlayed: React.FC = () => {
Top 100 Played
- {topPlayedItems.length}
+ {displayItems.length}
-
-
-
+
(
+
+
+
+ #{index + 1}
+
+
+ {item.count} play{item.count !== 1 ? 's' : ''}
+
+
+ )}
+ />
>
);
};
-export default TopPlayed;
\ No newline at end of file
+export default Top100;
\ No newline at end of file