playbacks record

This commit is contained in:
2025-10-06 10:31:03 +02:00
parent 45b7571c14
commit 3cfe079e9f
7 changed files with 73 additions and 37 deletions
+14 -4
View File
@@ -1,6 +1,6 @@
import { useIsFocused } from "@react-navigation/native";
import { Image as ExpoImage } from "expo-image";
import React, { useEffect } from "react";
import React, { useCallback, useEffect } from "react";
import { ActivityIndicator, Alert, Text, View } from "react-native";
import useMinuit from "react-native-minuit/src/hooks/useMinuit.js";
import { background, icons } from "../../assets";
@@ -22,7 +22,7 @@ const PouchReady = () => {
const isGenerating = selectedProject?.coverStatus === "GENERATING";
const isFocused = useIsFocused();
const generateCover = async () => {
const generateCover = useCallback(async () => {
if (!selectedProjectId) return;
try {
await setIsLoading(true);
@@ -37,7 +37,7 @@ const PouchReady = () => {
} finally {
setIsLoading(false);
}
};
}, [selectedProjectId, setIsLoading]);
async function validateCover() {
try {
@@ -62,6 +62,16 @@ const PouchReady = () => {
!selectedProject?.cover?.generatedBackground &&
selectedProject?.coverStatus !== "GENERATING"
) {
if (isWeb) {
if (typeof window !== "undefined") {
const shouldGenerate = window.confirm("Générer une pochette ?");
if (shouldGenerate) {
generateCover();
}
}
return;
}
Alert.alert("Attention", "Générer une pochette ?", [
{
text: "Oui",
@@ -72,7 +82,7 @@ const PouchReady = () => {
},
]);
}
}, [selectedProject, isFocused]);
}, [generateCover, isFocused, selectedProject]);
return (
<Page backgroundImg={background.studioBG2} headerType="NONE">