check existing song url before navigating

This commit is contained in:
2025-10-03 14:52:16 +02:00
parent 680cc4852d
commit 9772a99e39
10 changed files with 113 additions and 32 deletions
+30
View File
@@ -0,0 +1,30 @@
import { useCallback } from "react";
import { useGlobal } from "reactn";
import { Routes } from "../navigation";
import { navigate } from "../navigation/NavigationService";
const useNavigateToMusicDetails = () => {
const [, setTooltip] = useGlobal("_tooltip");
return useCallback(
({ projectId, songUrl }) => {
if (!projectId) {
return false;
}
if (songUrl != null && songUrl !== "") {
navigate(Routes.MusicDetails, { projectId });
return true;
}
setTooltip({
type: "error",
text: "Les paroles pour cette musique n'ont pas été générées",
});
return false;
},
[setTooltip]
);
};
export default useNavigateToMusicDetails;