mirror of
https://github.com/Jellify-Music/App.git
synced 2026-03-03 08:29:15 -06:00
itemdetail stuff
This commit is contained in:
@@ -67,7 +67,7 @@ export default function Track({
|
||||
onLongPress={() => {
|
||||
navigation.push("Details", {
|
||||
item: track,
|
||||
isModal: false
|
||||
isNested: false
|
||||
})
|
||||
}}
|
||||
paddingVertical={"$2"}
|
||||
@@ -150,7 +150,7 @@ export default function Track({
|
||||
<Icon small name="dots-vertical" onPress={() => {
|
||||
navigation.push("Details", {
|
||||
item: track,
|
||||
isModal: false
|
||||
isNested: false
|
||||
});
|
||||
}} />
|
||||
|
||||
|
||||
@@ -8,24 +8,32 @@ import BlurhashedImage from "../Global/helpers/blurhashed-image";
|
||||
import { Text } from "../Global/helpers/text";
|
||||
import { Colors } from "../../enums/colors";
|
||||
import FavoriteButton from "../Global/components/favorite-button";
|
||||
import { useEffect } from "react";
|
||||
import { trigger } from "react-native-haptic-feedback";
|
||||
|
||||
export default function ItemDetail({
|
||||
item,
|
||||
navigation,
|
||||
isModal = false
|
||||
isNested
|
||||
} : {
|
||||
item: BaseItemDto,
|
||||
navigation: NativeStackNavigationProp<StackParamList>,
|
||||
isModal: boolean
|
||||
isNested?: boolean | undefined
|
||||
}) : React.JSX.Element {
|
||||
|
||||
let options: React.JSX.Element | undefined = undefined;
|
||||
|
||||
useEffect(() => {
|
||||
trigger("impactMedium");
|
||||
}, [
|
||||
item
|
||||
]);
|
||||
|
||||
const { width } = useSafeAreaFrame();
|
||||
|
||||
switch (item.Type) {
|
||||
case "Audio": {
|
||||
options = TrackOptions({ item, navigation, isModal });
|
||||
options = TrackOptions({ item, navigation, isNested });
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -72,17 +80,13 @@ export default function ItemDetail({
|
||||
onPress={() => {
|
||||
if (item.ArtistItems) {
|
||||
|
||||
if (isModal)
|
||||
navigation.navigate("Artist", {
|
||||
artist: item.ArtistItems[0]
|
||||
})
|
||||
|
||||
else {
|
||||
if (isNested)
|
||||
navigation.goBack();
|
||||
navigation.push("Artist", {
|
||||
artist: item.ArtistItems[0]
|
||||
});
|
||||
}
|
||||
|
||||
navigation.goBack();
|
||||
navigation.push("Artist", {
|
||||
artist: item.ArtistItems[0]
|
||||
});
|
||||
}
|
||||
}}>
|
||||
{ item.Artists?.join(", ") ?? "Unknown Artist"}
|
||||
|
||||
@@ -8,11 +8,11 @@ import { XStack } from "tamagui";
|
||||
export default function TrackOptions({
|
||||
item,
|
||||
navigation,
|
||||
isModal = false,
|
||||
isNested
|
||||
} : {
|
||||
item: BaseItemDto,
|
||||
navigation: NativeStackNavigationProp<StackParamList>,
|
||||
isModal: boolean
|
||||
isNested: boolean | undefined// Whether this is nested in the player modal
|
||||
}) : React.JSX.Element {
|
||||
|
||||
const { data: album, isSuccess } = useItem(item.AlbumId ?? "")
|
||||
@@ -24,17 +24,13 @@ export default function TrackOptions({
|
||||
name="music-box"
|
||||
onPress={() => {
|
||||
|
||||
if (isModal) {
|
||||
navigation.navigate("Album", {
|
||||
album
|
||||
});
|
||||
} else {
|
||||
|
||||
if (isNested)
|
||||
navigation.goBack();
|
||||
navigation.push("Album", {
|
||||
album
|
||||
});
|
||||
}
|
||||
|
||||
navigation.goBack();
|
||||
navigation.push("Album", {
|
||||
album
|
||||
});
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -15,7 +15,7 @@ export default function DetailsScreen({
|
||||
<ItemDetail
|
||||
item={route.params.item}
|
||||
navigation={navigation}
|
||||
isModal={route.params.isModal}
|
||||
isNested={route.params.isNested}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -132,7 +132,7 @@ export default function PlayerScreen({ navigation }: { navigation: NativeStackNa
|
||||
onPress={() => {
|
||||
navigation.navigate("Details", {
|
||||
item: nowPlaying!.item,
|
||||
isModal: true
|
||||
isNested: true
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -35,7 +35,7 @@ export type StackParamList = {
|
||||
};
|
||||
Details: {
|
||||
item: BaseItemDto,
|
||||
isModal: boolean
|
||||
isNested: boolean | undefined
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user