diff --git a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx index c0a2a28..34ed141 100644 --- a/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx +++ b/apps/mobile/app/(app)/(tabs)/home/album/[id].tsx @@ -4,6 +4,11 @@ import { memo, useCallback, useEffect, useMemo } from "react" import { FlatList, Pressable, StyleSheet, Text, View } from "react-native" import { Ionicons } from "@expo/vector-icons" +import { + CollectionDivider, + collectionInset, + DiscHeader, +} from "@/components/collection-list" import { CoverImage } from "@/components/cover-image" import { @@ -66,21 +71,34 @@ export default function AlbumScreen() { } }, [album]) - const renderTrack = useCallback( - ({ item, index }: { item: BrowseAlbumTrack; index: number }) => - album ? ( + const listItems = useMemo(() => albumListItems(album?.tracks ?? []), [album]) + + const renderItem = useCallback( + ({ item }: { item: AlbumListItem }) => { + if (item.type === "disc") { + return + } + return album ? ( - ) : null, - [album, handleAlbumTrackAction, isSongFavorite, palette, playFromSong, songIds] + ) : null + }, + [ + album, + handleAlbumTrackAction, + isSongFavorite, + palette, + playFromSong, + songIds, + ] ) if (album === undefined || !config || !settled) { @@ -154,79 +172,129 @@ export default function AlbumScreen() { /> track.id} + data={listItems} + keyExtractor={albumListItemKey} style={{ flex: 1, backgroundColor: palette.background }} contentContainerStyle={{ paddingBottom: contentBottomInset }} contentInsetAdjustmentBehavior="automatic" indicatorStyle={palette.isDark ? "white" : "black"} ListHeaderComponent={ - - - - {album.title} - - push(`/artist/${album.artist.id}`)}> - - {album.artist.name} - - - {metadata ? ( - - {metadata} - - ) : null} - - void toggleAlbumFavorite(album.id)} - hitSlop={8} - style={[styles.iconAction, { backgroundColor: palette.surface }]} - > - - -