fixes
This commit is contained in:
@@ -354,11 +354,7 @@ const ShareModal = ({ payload }) => {
|
||||
return (
|
||||
<AppActionSheet id="Share" webModal={isWeb} onClose={closeSheet}>
|
||||
{isWeb ? (
|
||||
<View
|
||||
ref={modalRef}
|
||||
collapsable={false}
|
||||
style={styles.webContainer}
|
||||
>
|
||||
<View ref={modalRef} collapsable={false} style={styles.webContainer}>
|
||||
<View style={styles.webHeader}>
|
||||
<Text style={styles.webHeading}>{heading}</Text>
|
||||
<Pressable
|
||||
@@ -394,13 +390,13 @@ const ShareModal = ({ payload }) => {
|
||||
</Text>
|
||||
</Pressable>
|
||||
|
||||
<Pressable
|
||||
{/* <Pressable
|
||||
onPress={onSystemShare}
|
||||
style={[styles.webActionButton, styles.webSecondaryButton]}
|
||||
>
|
||||
<Feather name="share-2" size={16} color={Palette.white} />
|
||||
<Text style={styles.webActionLabel}>Partager</Text>
|
||||
</Pressable>
|
||||
</Pressable> */}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
@@ -2,28 +2,51 @@ import { useCallback } from "react";
|
||||
import { useGlobal } from "reactn";
|
||||
import { Routes } from "../navigation";
|
||||
import { navigate } from "../navigation/NavigationService";
|
||||
import { useUser } from "../providers/UserDataProvider";
|
||||
import { getStageAction } from "../utils/projectStages";
|
||||
|
||||
const useNavigateToMusicDetails = () => {
|
||||
const [, setTooltip] = useGlobal("_tooltip");
|
||||
const { selectProject, userProjects = [], currentUID } = useUser();
|
||||
|
||||
return useCallback(
|
||||
({ projectId, songUrl }) => {
|
||||
({ projectId, songUrl, project = null }) => {
|
||||
if (!projectId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const resolvedProject =
|
||||
project?.id === projectId
|
||||
? project
|
||||
: userProjects.find((p) => p?.id === projectId) || project || null;
|
||||
const isOwner =
|
||||
resolvedProject?.userId && currentUID
|
||||
? resolvedProject.userId === currentUID
|
||||
: false;
|
||||
|
||||
if (songUrl != null && songUrl !== "") {
|
||||
if (isOwner) {
|
||||
selectProject?.(projectId);
|
||||
}
|
||||
navigate(Routes.MusicDetails, { projectId });
|
||||
return true;
|
||||
}
|
||||
|
||||
if (resolvedProject && isOwner) {
|
||||
selectProject?.(projectId);
|
||||
const stageAction = getStageAction("beatmaker", resolvedProject);
|
||||
const targetRoute = stageAction?.route || Routes.Compose;
|
||||
navigate(targetRoute, stageAction?.params);
|
||||
return true;
|
||||
}
|
||||
|
||||
setTooltip({
|
||||
type: "error",
|
||||
text: "Les paroles pour cette musique n'ont pas été générées",
|
||||
text: "Cette musique n'est pas encore disponible",
|
||||
});
|
||||
return false;
|
||||
},
|
||||
[setTooltip]
|
||||
[currentUID, selectProject, setTooltip, userProjects]
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ const HitParade = () => {
|
||||
navigateToMusicDetails({
|
||||
projectId: item.id,
|
||||
songUrl: item?.songUrl,
|
||||
project: item,
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -118,6 +119,7 @@ const HitParade = () => {
|
||||
navigateToMusicDetails({
|
||||
projectId: item.id,
|
||||
songUrl: item?.songUrl,
|
||||
project: item,
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -138,6 +140,7 @@ const HitParade = () => {
|
||||
navigateToMusicDetails({
|
||||
projectId: item.id,
|
||||
songUrl: item?.songUrl,
|
||||
project: item,
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -205,6 +208,7 @@ const HitParade = () => {
|
||||
navigateToMusicDetails({
|
||||
projectId: randomSong.id,
|
||||
songUrl: randomSong?.songUrl,
|
||||
project: randomSong,
|
||||
});
|
||||
}, [navigateToMusicDetails, topSongs]);
|
||||
|
||||
|
||||
@@ -152,6 +152,7 @@ export default function AllMyList() {
|
||||
navigateToMusicDetails({
|
||||
projectId: item.id,
|
||||
songUrl: item?.songUrl,
|
||||
project: item,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -208,6 +208,7 @@ const AllMyPlaylist = ({ route }) => {
|
||||
navigateToMusicDetails({
|
||||
projectId: p.id,
|
||||
songUrl: p?.songUrl,
|
||||
project: p,
|
||||
})
|
||||
}
|
||||
onPressMore={(posTop) => {
|
||||
|
||||
@@ -92,6 +92,7 @@ const PlaylistDetails = () => {
|
||||
navigateToMusicDetails({
|
||||
projectId: p.id,
|
||||
songUrl: p?.songUrl,
|
||||
project: p,
|
||||
})
|
||||
}
|
||||
onPressMore={(posTop) => {
|
||||
|
||||
@@ -62,6 +62,7 @@ const LikedMusic = () => {
|
||||
navigateToMusicDetails({
|
||||
projectId: item.id,
|
||||
songUrl: item?.songUrl,
|
||||
project: item,
|
||||
})
|
||||
}
|
||||
>
|
||||
|
||||
@@ -46,6 +46,7 @@ const MyMusic = () => {
|
||||
navigateToMusicDetails({
|
||||
projectId: p.id,
|
||||
songUrl: p?.songUrl,
|
||||
project: p,
|
||||
})
|
||||
}
|
||||
onPressMore={(posTop) => {
|
||||
|
||||
@@ -48,6 +48,7 @@ const SearchResultsList = ({
|
||||
const didNavigate = navigateToMusicDetails({
|
||||
projectId: project?.id,
|
||||
songUrl: project?.songUrl,
|
||||
project,
|
||||
});
|
||||
|
||||
if (didNavigate) {
|
||||
|
||||
@@ -702,7 +702,7 @@ const RecordPlayback = ({ route }) => {
|
||||
<Page
|
||||
style={{ flex: 1 }}
|
||||
width={"100%"}
|
||||
maxWidth={2000}
|
||||
maxWidth={800}
|
||||
containerStyle={{ margin: 0, padding: 0, backgroundColor: Palette.black }}
|
||||
headerType="NONE"
|
||||
>
|
||||
|
||||
@@ -212,6 +212,7 @@ const Profile = () => {
|
||||
navigateToMusicDetails({
|
||||
projectId: item.id,
|
||||
songUrl: item?.songUrl,
|
||||
project: item,
|
||||
})
|
||||
}
|
||||
onPressMore={(posTop) => {
|
||||
|
||||
@@ -58,17 +58,17 @@ const WritingLyrics = () => {
|
||||
gap: 12,
|
||||
}}
|
||||
>
|
||||
<BorderGradientButton
|
||||
maxWidth={500}
|
||||
onPress={() => createAndNavigate({ hasLyrics: true })}
|
||||
containerStyle={{ alignSelf: "center", width: "100%" }}
|
||||
/>
|
||||
<GradientButton
|
||||
maxWidth={500}
|
||||
containerStyle={{ alignSelf: "center", width: "100%" }}
|
||||
title="Écrire des paroles avec une IA"
|
||||
onPress={() => createAndNavigate({ hasLyrics: false })}
|
||||
/>
|
||||
<BorderGradientButton
|
||||
maxWidth={500}
|
||||
onPress={() => createAndNavigate({ hasLyrics: true })}
|
||||
containerStyle={{ alignSelf: "center", width: "100%" }}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</Page>
|
||||
|
||||
Reference in New Issue
Block a user