diff --git a/app/(auth)/artists/[artistId]/page.tsx b/app/(auth)/artists/[artistId]/page.tsx index bc2fa5f9..4a60fb06 100644 --- a/app/(auth)/artists/[artistId]/page.tsx +++ b/app/(auth)/artists/[artistId]/page.tsx @@ -84,7 +84,7 @@ export default function page() { useEffect(() => { navigation.setOptions({ - title: albums?.Items?.[0].AlbumArtist, + title: albums?.Items?.[0]?.AlbumArtist || "", }); }, [albums]); diff --git a/components/music/SongsList.tsx b/components/music/SongsList.tsx index 8b5d2ca7..4d576f3c 100644 --- a/components/music/SongsList.tsx +++ b/components/music/SongsList.tsx @@ -1,9 +1,6 @@ -import { TouchableOpacity, View, ViewProps } from "react-native"; -import { Text } from "@/components/common/Text"; import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models"; -import ArtistPoster from "../ArtistPoster"; -import { runtimeTicksToMinutes, runtimeTicksToSeconds } from "@/utils/time"; import { useRouter } from "expo-router"; +import { View, ViewProps } from "react-native"; import { SongsListItem } from "./SongsListItem"; interface Props extends ViewProps { diff --git a/components/music/SongsListItem.tsx b/components/music/SongsListItem.tsx index 53abcba8..d2688b5d 100644 --- a/components/music/SongsListItem.tsx +++ b/components/music/SongsListItem.tsx @@ -1,27 +1,20 @@ -import { - TouchableOpacity, - TouchableOpacityProps, - View, - ViewProps, -} from "react-native"; import { Text } from "@/components/common/Text"; -import index from "@/app/(auth)/(tabs)/home"; -import { runtimeTicksToSeconds } from "@/utils/time"; -import { router } from "expo-router"; -import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models"; -import { getStreamUrl } from "@/utils/jellyfin/media/getStreamUrl"; -import { useAtom } from "jotai"; import { apiAtom, userAtom } from "@/providers/JellyfinProvider"; +import { usePlayback } from "@/providers/PlaybackProvider"; +import { getStreamUrl } from "@/utils/jellyfin/media/getStreamUrl"; import { chromecastProfile } from "@/utils/profiles/chromecast"; +import ios from "@/utils/profiles/ios"; +import { runtimeTicksToSeconds } from "@/utils/time"; +import { useActionSheet } from "@expo/react-native-action-sheet"; +import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models"; import { getMediaInfoApi } from "@jellyfin/sdk/lib/utils/api"; +import { useAtom } from "jotai"; +import { TouchableOpacity, TouchableOpacityProps, View } from "react-native"; import CastContext, { PlayServicesState, useCastDevice, useRemoteMediaClient, } from "react-native-google-cast"; -import { currentlyPlayingItemAtom, playingAtom } from "../CurrentlyPlayingBar"; -import { useActionSheet } from "@expo/react-native-action-sheet"; -import ios from "@/utils/profiles/ios"; interface Props extends TouchableOpacityProps { collectionId: string; @@ -42,12 +35,12 @@ export const SongsListItem: React.FC = ({ const [api] = useAtom(apiAtom); const [user] = useAtom(userAtom); const castDevice = useCastDevice(); - const [, setCp] = useAtom(currentlyPlayingItemAtom); - const [, setPlaying] = useAtom(playingAtom); const client = useRemoteMediaClient(); const { showActionSheetWithOptions } = useActionSheet(); + const { setCurrentlyPlayingState } = usePlayback(); + const openSelect = () => { if (!castDevice?.deviceId) { play("device"); @@ -73,7 +66,7 @@ export const SongsListItem: React.FC = ({ case cancelButtonIndex: break; } - }, + } ); }; @@ -118,11 +111,10 @@ export const SongsListItem: React.FC = ({ } }); } else { - setCp({ + setCurrentlyPlayingState({ item, - playbackUrl: url, + url, }); - setPlaying(true); } };