From 7159db6690ea0bcddde4c1a84bd181d5db2f51bd Mon Sep 17 00:00:00 2001 From: Violet Caulfield Date: Thu, 2 Jan 2025 04:43:27 -0600 Subject: [PATCH] navigate from player to artist --- components/Player/component.tsx | 16 ++++++++++++++-- helpers/mappings.ts | 1 + types/JellifyTrack.ts | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/components/Player/component.tsx b/components/Player/component.tsx index 0d722cdc..700a7f4b 100644 --- a/components/Player/component.tsx +++ b/components/Player/component.tsx @@ -10,8 +10,10 @@ import { queryConfig } from "../../api/queries/query.config"; import { Text } from "../Global/text"; import { SafeAreaView } from "react-native-safe-area-context"; import { playPauseButton } from "./helpers/buttons"; +import { BottomTabNavigationEventMap } from "@react-navigation/bottom-tabs"; +import { NavigationHelpers, ParamListBase } from "@react-navigation/native"; -export default function Player(): React.JSX.Element { +export default function Player({ navigation }: { navigation : NavigationHelpers }): React.JSX.Element { const { apiClient } = useApiClientContext(); const { queue, playbackState, nowPlaying, play, pause } = usePlayerContext(); @@ -44,7 +46,17 @@ export default function Player(): React.JSX.Element { {nowPlaying?.title ?? "Untitled Track"} - {nowPlaying?.artist ?? "Unknown Artist"} + { + navigation.goBack(); + navigation.navigate("Artist", { + artistName: nowPlaying?.artist, + artistId: nowPlaying?.ArtistId + }) + }} + > + {nowPlaying?.artist ?? "Unknown Artist"} diff --git a/helpers/mappings.ts b/helpers/mappings.ts index b3a64fd9..830b6043 100644 --- a/helpers/mappings.ts +++ b/helpers/mappings.ts @@ -35,6 +35,7 @@ export function mapDtoToTrack(api: Api, sessionId: string, item: BaseItemDto, qu duration: item.RunTimeTicks, ItemId: item.Id!, + ArtistId: item.ParentId, AlbumId: item.AlbumId!, QueuingType: queuingType ?? QueuingType.DirectlyQueued } as JellifyTrack diff --git a/types/JellifyTrack.ts b/types/JellifyTrack.ts index b268a42c..bee2de7c 100644 --- a/types/JellifyTrack.ts +++ b/types/JellifyTrack.ts @@ -21,6 +21,7 @@ export interface JellifyTrack extends Track { isLiveStream?: boolean | undefined; ItemId: string; + ArtistId: string; AlbumId: string; Year?: number | null | undefined; IndexNumber?: number | null | undefined;