feat(mobile): zoom into albums and playlists on iOS

This commit is contained in:
joshuafhiggins committed 2026-11-06 11:01:26 -05:00 Verified
1 parent bc56110ef0
commit d991ffce3c
4 files changed
+106 -67

No files matched your search

@@ -9,7 +9,7 @@ import {
useAndroidScreenPalette,
} from "@/contexts/android-tab-theme"
import { MusicEntityView } from "@/components/music-entity-view"
import { Stack, useIsFocused, useLocalSearchParams } from "expo-router"
import { Link, Stack, useIsFocused, useLocalSearchParams } from "expo-router"
import { StatusBar } from "expo-status-bar"
import { memo, useCallback, useEffect, useMemo } from "react"
import { Platform, Pressable, StyleSheet, View } from "react-native"
@@ -149,6 +149,7 @@ export default function AlbumScreen() {
}}
/>
<CollectionDetailSkeleton
zoomCoverSize={220}
onLayout={onLayout}
style={backgroundStyle}
backgroundColor={
@@ -243,11 +244,15 @@ export default function AlbumScreen() {
ListHeaderComponent={
<View>
<MusicEntityView kind="album" id={album.id} style={styles.hero}>
<CoverImage
uri={coverUri}
hasCover={album.cover != null}
style={styles.cover}
/>
<Link.AppleZoomTarget>
<View collapsable={false}>
<CoverImage
uri={coverUri}
hasCover={album.cover != null}
style={styles.cover}
/>
</View>
</Link.AppleZoomTarget>
<PaletteText
tone="foreground"
style={[styles.title, { color: palette.foreground }]}
@@ -16,6 +16,7 @@ import { MusicEntityView } from "@/components/music-entity-view"
import { useMutation } from "convex/react"
import { memo, useCallback, useEffect, useMemo } from "react"
import {
Link,
Stack,
useIsFocused,
useLocalSearchParams,
@@ -117,6 +118,7 @@ export default function PlaylistScreen() {
}}
/>
<CollectionDetailSkeleton
zoomCoverSize={200}
onLayout={onLayout}
style={backgroundStyle}
backgroundColor={
@@ -517,7 +519,15 @@ const PlaylistHero = memo(function PlaylistHero({
return (
<MusicEntityView kind="playlist" id={entityId}>
<View style={styles.hero}>
<CoverImage uri={coverUri} hasCover={hasCover} style={styles.cover} />
<Link.AppleZoomTarget>
<View collapsable={false}>
<CoverImage
uri={coverUri}
hasCover={hasCover}
style={styles.cover}
/>
</View>
</Link.AppleZoomTarget>
<PaletteText
tone="foreground"
style={[styles.title, { color: palette.foreground }]}
+59 -52
View File
@@ -1,4 +1,5 @@
import { MusicEntityView } from "@/components/music-entity-view"
import { Link } from "expo-router"
import { Ionicons } from "@expo/vector-icons"
import { memo, useCallback, type ReactElement } from "react"
import {
@@ -44,35 +45,40 @@ export const AlbumCard = memo(function AlbumCard({
album: BrowseAlbum
width?: number
}) {
const { push } = useAppNavigation()
const { href } = useAppNavigation()
const { config } = useServerConfig()
const colors = useThemeColors()
const { handleAlbumAction, isAlbumFavorite } = useMediaMenuActions()
const onPress = useCallback(() => {
push(`/album/${album.id}`)
}, [push, album.id])
if (!config) return null
const card = (
<Pressable style={[styles.card, { width }]} onPress={onPress}>
<CoverImage
uri={albumCoverUrl(config.serverUrl, album.id)}
hasCover={album.cover != null}
style={{ width, height: width, borderRadius: radius.md }}
/>
<Text
style={[styles.title, { color: colors.foreground }]}
numberOfLines={2}
>
{album.title}
</Text>
<Text
style={[styles.subtitle, { color: colors.mutedForeground }]}
numberOfLines={1}
>
{album.artist.name}
</Text>
</Pressable>
<Link href={href(`/album/${album.id}`)} push asChild>
<Pressable style={StyleSheet.flatten([styles.card, { width }])}>
<Link.AppleZoom>
<View collapsable={false}>
<CoverImage
uri={albumCoverUrl(config.serverUrl, album.id)}
hasCover={album.cover != null}
style={{ width, height: width, borderRadius: radius.md }}
/>
</View>
</Link.AppleZoom>
<MusicEntityView kind="album" id={album.id} style={styles.card}>
<Text
style={[styles.title, { color: colors.foreground }]}
numberOfLines={2}
>
{album.title}
</Text>
<Text
style={[styles.subtitle, { color: colors.mutedForeground }]}
numberOfLines={1}
>
{album.artist.name}
</Text>
</MusicEntityView>
</Pressable>
</Link>
)
return (
@@ -83,9 +89,7 @@ export const AlbumCard = memo(function AlbumCard({
share={{ type: "album", albumId: album.id, title: album.title }}
onAction={(action) => void handleAlbumAction(album, action)}
>
<MusicEntityView kind="album" id={album.id}>
{card}
</MusicEntityView>
{card}
</MediaContextMenu>
)
})
@@ -142,35 +146,40 @@ export const PlaylistCard = memo(function PlaylistCard({
playlist: PlaylistSummary
width?: number
}) {
const { push } = useAppNavigation()
const { href } = useAppNavigation()
const { config } = useServerConfig()
const colors = useThemeColors()
const { handlePlaylistAction } = useMediaMenuActions()
const onPress = useCallback(() => {
push(`/playlist/${playlist.id}`)
}, [push, playlist.id])
if (!config) return null
const card = (
<Pressable style={[styles.card, { width }]} onPress={onPress}>
<CoverImage
uri={playlistCoverUrl(config.serverUrl, playlist.id)}
hasCover={playlist.cover != null}
style={{ width, height: width, borderRadius: radius.md }}
/>
<Text
style={[styles.title, { color: colors.foreground }]}
numberOfLines={2}
>
{playlist.title}
</Text>
<Text
style={[styles.subtitle, { color: colors.mutedForeground }]}
numberOfLines={1}
>
{playlist.owner}
</Text>
</Pressable>
<Link href={href(`/playlist/${playlist.id}`)} push asChild>
<Pressable style={StyleSheet.flatten([styles.card, { width }])}>
<Link.AppleZoom>
<View collapsable={false}>
<CoverImage
uri={playlistCoverUrl(config.serverUrl, playlist.id)}
hasCover={playlist.cover != null}
style={{ width, height: width, borderRadius: radius.md }}
/>
</View>
</Link.AppleZoom>
<MusicEntityView kind="playlist" id={playlist.id} style={styles.card}>
<Text
style={[styles.title, { color: colors.foreground }]}
numberOfLines={2}
>
{playlist.title}
</Text>
<Text
style={[styles.subtitle, { color: colors.mutedForeground }]}
numberOfLines={1}
>
{playlist.owner}
</Text>
</MusicEntityView>
</Pressable>
</Link>
)
return (
@@ -183,9 +192,7 @@ export const PlaylistCard = memo(function PlaylistCard({
}}
onAction={(action) => void handlePlaylistAction(playlist, action)}
>
<MusicEntityView kind="playlist" id={playlist.id}>
{card}
</MusicEntityView>
{card}
</MediaContextMenu>
)
})
+25 -8
View File
@@ -1,3 +1,4 @@
import { Link } from "expo-router"
import Reanimated from "react-native-reanimated"
import { useEffect, useRef, type ReactNode, type ComponentProps } from "react"
import {
@@ -198,18 +199,20 @@ export function HomeSkeleton() {
/** Album and playlist pages: cover, title, play buttons, then tracks. */
export function CollectionDetailSkeleton({
zoomCoverSize,
style,
round = false,
backgroundColor,
onLayout,
}: {
zoomCoverSize?: number
style?: ComponentProps<typeof Reanimated.ScrollView>["style"]
round?: boolean
backgroundColor?: string
onLayout?: () => void
}) {
const colors = useThemeColors()
const coverSize = round ? 180 : 210
const coverSize = zoomCoverSize ?? (round ? 180 : 210)
return (
<Reanimated.ScrollView
onLayout={onLayout}
@@ -223,13 +226,27 @@ export function CollectionDetailSkeleton({
accessibilityLabel="Loading"
>
<View style={styles.hero}>
<Skeleton
style={{
width: coverSize,
height: coverSize,
borderRadius: round ? coverSize / 2 : radius.lg,
}}
/>
{zoomCoverSize ? (
<Link.AppleZoomTarget>
<View collapsable={false}>
<Skeleton
style={{
width: coverSize,
height: coverSize,
borderRadius: round ? coverSize / 2 : radius.lg,
}}
/>
</View>
</Link.AppleZoomTarget>
) : (
<Skeleton
style={{
width: coverSize,
height: coverSize,
borderRadius: round ? coverSize / 2 : radius.lg,
}}
/>
)}
<TextLine width={200} height={24} />
<TextLine width={120} height={16} />
<View style={styles.actions}>