import { Ionicons } from '@expo/vector-icons';
import { useRouter } from 'expo-router';
import { FlatList, Image, Pressable, Text, View, useWindowDimensions } from 'react-native';
import type { Album } from '~/types';
import { useTheme } from '~/utils/themeContext';
import { EmptyState } from './EmptyState';
interface AlbumGridProps {
albums: Album[];
}
export function AlbumGrid({ albums }: AlbumGridProps) {
const router = useRouter();
const { colors } = useTheme();
const { width } = useWindowDimensions();
const itemSize = (width - 48) / 2;
if (albums.length === 0) {
return (
);
}
return (
item.name}
numColumns={2}
contentContainerStyle={{ padding: 12, paddingBottom: 100 }}
columnWrapperStyle={{ gap: 12 }}
ItemSeparatorComponent={() => }
renderItem={({ item }) => (
router.push(`/album/${encodeURIComponent(item.name)}`)}
style={{ width: itemSize }}
>
{item.coverArtPath ? (
) : (
)}
{item.name}
{item.artist || 'Unbekannt'} ยท {item.songCount} Songs
)}
/>
);
}