From 63d388e78294092102f15e2f4450e1c86cf6027a Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Sat, 17 Oct 2026 18:22:33 -0400 Subject: [PATCH] feat(mobile): Apple Music-style track lists with per-disc sections (#32) --- .../app/(app)/(tabs)/home/album/[id].tsx | 249 ++++++++++++------ .../app/(app)/(tabs)/home/playlist/[id].tsx | 100 ++++--- .../(app)/(tabs)/home/playlist/favorites.tsx | 59 +++-- apps/mobile/components/collection-list.tsx | 46 ++++ apps/mobile/components/player.tsx | 63 ++++- 5 files changed, 351 insertions(+), 166 deletions(-) create mode 100644 apps/mobile/components/collection-list.tsx 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 }]} - > - - -