This commit is contained in:
2025-10-06 15:22:30 +02:00
parent c1af1cede9
commit 042b3d9019
11 changed files with 95 additions and 87 deletions
+33 -22
View File
@@ -1,12 +1,12 @@
import React, { useState } from "react";
import { Alert, Platform, View, Text } from "react-native";
import { PortalProvider } from "@gorhom/portal"; import { PortalProvider } from "@gorhom/portal";
import React, { useState } from "react";
import { Alert, Platform, Text } from "react-native";
import { Fonts, Style, gutters } from "../styles"; import { BlurView } from "expo-blur";
import { View } from "react-native";
import { Fonts, gutters } from "../styles";
import GradientButton from "./GradientButton";
import Overlay from "./Overlay"; import Overlay from "./Overlay";
import Button from "./Button";
const WebAlertModal = ({ title, description, options }) => { const WebAlertModal = ({ title, description, options }) => {
const [visible, setVisible] = useState(true); const [visible, setVisible] = useState(true);
@@ -26,19 +26,27 @@ const WebAlertModal = ({ title, description, options }) => {
return ( return (
<PortalProvider> <PortalProvider>
<Overlay isVisible={visible}> <Overlay isVisible={visible}>
<View <BlurView
intensity={100}
tint="dark"
style={{ style={{
...Style.containerModal, width: "60%",
maxWidth: 450,
minWidth: 300,
padding: "2.5%",
borderRadius: 12,
// ...Style.containerModal,
}} }}
> >
<Text <Text
style={{ style={{
...Fonts({ ...Fonts({
type: "mainTitle", type: "default",
style: { style: {
textAlign: "center", textAlign: "center",
marginBottom: gutters / 2, marginBottom: gutters / 2,
}, },
fontSize: 3,
}), }),
}} }}
> >
@@ -58,19 +66,22 @@ const WebAlertModal = ({ title, description, options }) => {
{description} {description}
</Text> </Text>
<Button <View style={{ flexDirection: "row", gap: 10 }}>
text={confirmOption?.text || "OK"} <GradientButton
onPress={onConfirm} title={confirmOption?.text || "OK"}
alternateAction={ onPress={onConfirm}
cancelOption containerStyle={{ flex: 1 }}
? { />
text: cancelOption.text, {cancelOption && (
onPress: () => onCancel(), <GradientButton
} title={cancelOption.text}
: null onPress={onCancel}
} colors={["#666666", "#333333"]}
/> containerStyle={{ flex: 1 }}
</View> />
)}
</View>
</BlurView>
</Overlay> </Overlay>
</PortalProvider> </PortalProvider>
); );
+4 -8
View File
@@ -1,14 +1,10 @@
import { Motion } from "@legendapp/motion"; import { Motion } from "@legendapp/motion";
import { Text, View } from "react-native";
import * as Haptics from "expo-haptics"; import * as Haptics from "expo-haptics";
import { Text, View } from "react-native";
import { isDesktop, isMobile, isNative } from "../hooks/useLayoutType";
import { Fonts, Palette } from "../styles"; import { Fonts, Palette } from "../styles";
import Style, { gutters, mainBorderRadius } from "../styles/Style"; import Style, { gutters, mainBorderRadius } from "../styles/Style";
import useLayoutType, {
isDesktop,
isMobile,
isNative,
} from "../hooks/useLayoutType";
export default ({ export default ({
type = "primary", type = "primary",
@@ -130,8 +126,8 @@ export const BaseButton = ({
backgroundColor: primaryTransparentColor, backgroundColor: primaryTransparentColor,
} }
: hasShadow : hasShadow
? { ...Style.defaultShadows } ? { ...Style.defaultShadows }
: {}), : {}),
...containerStyle, ...containerStyle,
}} }}
> >
+4 -3
View File
@@ -1,10 +1,11 @@
import { BlurView } from "expo-blur"; import { BlurView } from "expo-blur";
import { Image } from "expo-image"; import { Image } from "expo-image";
import React from "react"; import React from "react";
import { Alert, Platform, Pressable, Text } from "react-native"; import { Platform, Pressable, Text } from "react-native";
import { icons } from "../assets"; import { icons } from "../assets";
import { Palette } from "../styles"; import { Palette } from "../styles";
import { FONT_FAMILY } from "../styles/Fonts"; import { FONT_FAMILY } from "../styles/Fonts";
import alert from "./Alert";
export default function ShareBtnWeb({ style }) { export default function ShareBtnWeb({ style }) {
const handleShare = () => { const handleShare = () => {
@@ -18,11 +19,11 @@ export default function ShareBtnWeb({ style }) {
...(shareUrl ? { url: shareUrl } : {}), ...(shareUrl ? { url: shareUrl } : {}),
}) })
.catch(() => { .catch(() => {
Alert.alert("Partage", "Le partage a été annulé."); alert("Partage", "Le partage a été annulé.");
}); });
return; return;
} }
Alert.alert("Partage", "Fonctionnalité disponible prochainement."); alert("Partage", "Fonctionnalité disponible prochainement.");
}; };
return ( return (
+13 -2
View File
@@ -5,9 +5,10 @@ import React, {
useRef, useRef,
useState, useState,
} from "react"; } from "react";
import { Alert, Platform, StyleSheet, View } from "react-native"; import { Platform, StyleSheet, View } from "react-native";
import useMinuit from "react-native-minuit/src/hooks/useMinuit.js"; import useMinuit from "react-native-minuit/src/hooks/useMinuit.js";
import { background } from "../../assets"; import { background } from "../../assets";
import Alert from "../../components/Alert";
import BorderGradientButton from "../../components/BorderGradientButton"; import BorderGradientButton from "../../components/BorderGradientButton";
import FeatureCarousel from "../../components/FeatureCarousel/FeatureCarousel"; import FeatureCarousel from "../../components/FeatureCarousel/FeatureCarousel";
import GradientButton from "../../components/GradientButton"; import GradientButton from "../../components/GradientButton";
@@ -160,7 +161,7 @@ const Home = () => {
{ {
label: "Supprimer", label: "Supprimer",
onPress: () => onPress: () =>
Alert.alert( Alert(
"Confirmer la suppression", "Confirmer la suppression",
"Cette action supprimera définitivement ce projet.", "Cette action supprimera définitivement ce projet.",
[ [
@@ -303,6 +304,16 @@ const Home = () => {
onPress={handleStageAction} onPress={handleStageAction}
disabled={continueDisabled} disabled={continueDisabled}
/> />
<BorderGradientButton
containerStyle={{ width: Platform.OS === "web" ? 250 : "100%" }}
title={"Test Alert"}
onPress={() =>
Alert("Test", "Ceci est un test d'alert", [
{ text: "Annuler", style: "cancel" },
{ text: "OK", onPress: () => console.log("OK pressé") },
])
}
/>
{/* <BorderGradientButton {/* <BorderGradientButton
containerStyle={{ width: Platform.OS === "web" ? 250 : "100%" }} containerStyle={{ width: Platform.OS === "web" ? 250 : "100%" }}
title={"Continuer la création"} title={"Continuer la création"}
+3 -2
View File
@@ -1,11 +1,12 @@
import { BlurView } from "expo-blur"; import { BlurView } from "expo-blur";
import React, { useMemo, useState } from "react"; import React, { useMemo, useState } from "react";
import { Alert, FlatList, Image, Platform, Text, View } from "react-native"; import { FlatList, Image, Platform, Text, View } from "react-native";
import { responsiveHeight } from "react-native-responsive-dimensions"; import { responsiveHeight } from "react-native-responsive-dimensions";
import { useGlobal } from "reactn"; import { useGlobal } from "reactn";
import { background, img } from "../../assets"; import { background, img } from "../../assets";
import GradientButton from "../../components/GradientButton"; import GradientButton from "../../components/GradientButton";
import MoreMenu from "../../components/MoreMenu"; import MoreMenu from "../../components/MoreMenu";
import alert from "../../components/Alert";
import { projectsRef } from "../../config/firebase"; import { projectsRef } from "../../config/firebase";
import Page from "../../layouts/Page"; import Page from "../../layouts/Page";
import { Routes } from "../../navigation"; import { Routes } from "../../navigation";
@@ -102,7 +103,7 @@ const HomeSave = () => {
{ {
label: "Supprimer", label: "Supprimer",
onPress: () => onPress: () =>
Alert.alert( alert(
"Confirmer la suppression", "Confirmer la suppression",
"Cette action supprimera définitivement ce projet.", "Cette action supprimera définitivement ce projet.",
[ [
+3 -2
View File
@@ -8,12 +8,13 @@ import React, {
useRef, useRef,
useState, useState,
} from "react"; } from "react";
import { Alert, Text, View } from "react-native"; import { Text, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context"; import { useSafeAreaInsets } from "react-native-safe-area-context";
import Svg, { Circle } from "react-native-svg"; import Svg, { Circle } from "react-native-svg";
import GradientButton from "../../components/GradientButton"; import GradientButton from "../../components/GradientButton";
import KaraokeLyrics from "../../components/KaraokeLyrics"; import KaraokeLyrics from "../../components/KaraokeLyrics";
import MusicLandHeader from "../../components/MusicLandHeader"; import MusicLandHeader from "../../components/MusicLandHeader";
import alert from "../../components/Alert";
import { increment, projectsRef } from "../../config/firebase"; import { increment, projectsRef } from "../../config/firebase";
import { Routes } from "../../navigation"; import { Routes } from "../../navigation";
import { goBack, navigate } from "../../navigation/NavigationService"; import { goBack, navigate } from "../../navigation/NavigationService";
@@ -358,7 +359,7 @@ const RecordPlayback = ({ route }) => {
// Inform the user when using a simulator where recording isn't supported // Inform the user when using a simulator where recording isn't supported
const msg = String(e?.message || e || ""); const msg = String(e?.message || e || "");
if (/not supported on the simulator/i.test(msg)) { if (/not supported on the simulator/i.test(msg)) {
Alert.alert( alert(
"Indisponible sur simulateur", "Indisponible sur simulateur",
"Lenregistrement vidéo nest pas disponible sur le simulateur. Merci dutiliser un appareil réel.", "Lenregistrement vidéo nest pas disponible sur le simulateur. Merci dutiliser un appareil réel.",
[ [
+3 -2
View File
@@ -8,12 +8,13 @@ import React, {
useRef, useRef,
useState, useState,
} from "react"; } from "react";
import { Alert, Text, View } from "react-native"; import { Text, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context"; import { useSafeAreaInsets } from "react-native-safe-area-context";
import Svg, { Circle } from "react-native-svg"; import Svg, { Circle } from "react-native-svg";
import GradientButton from "../../components/GradientButton"; import GradientButton from "../../components/GradientButton";
import KaraokeLyrics from "../../components/KaraokeLyrics"; import KaraokeLyrics from "../../components/KaraokeLyrics";
import MusicLandHeader from "../../components/MusicLandHeader"; import MusicLandHeader from "../../components/MusicLandHeader";
import alert from "../../components/Alert";
import { increment, projectsRef } from "../../config/firebase"; import { increment, projectsRef } from "../../config/firebase";
import { isWeb } from "../../hooks/useLayoutType"; import { isWeb } from "../../hooks/useLayoutType";
import Page from "../../layouts/Page"; import Page from "../../layouts/Page";
@@ -641,7 +642,7 @@ const RecordPlayback = ({ route }) => {
setIsPreparing(false); setIsPreparing(false);
const msg = String(e?.message || e || ""); const msg = String(e?.message || e || "");
if (/not supported on the simulator/i.test(msg)) { if (/not supported on the simulator/i.test(msg)) {
Alert.alert( alert(
"Indisponible sur simulateur", "Indisponible sur simulateur",
"Lenregistrement vidéo nest pas disponible sur le simulateur. Merci dutiliser un appareil réel.", "Lenregistrement vidéo nest pas disponible sur le simulateur. Merci dutiliser un appareil réel.",
[ [
+3 -2
View File
@@ -1,8 +1,9 @@
import { View, Text, ScrollView, Pressable, Alert } from "react-native"; import { View, Text, ScrollView, Pressable } from "react-native";
import React, { useState } from "react"; import React, { useState } from "react";
import Page from "../../layouts/Page"; import Page from "../../layouts/Page";
import { background } from "../../assets"; import { background } from "../../assets";
import GradientButton from "../../components/GradientButton"; import GradientButton from "../../components/GradientButton";
import alert from "../../components/Alert";
import { navigate } from "../../navigation/NavigationService"; import { navigate } from "../../navigation/NavigationService";
import { Routes } from "../../navigation"; import { Routes } from "../../navigation";
import { gutters } from "../../styles"; import { gutters } from "../../styles";
@@ -102,7 +103,7 @@ const Studio = () => {
disabled={!selected} disabled={!selected}
onPress={() => { onPress={() => {
if (selected.musicStatus === "GENERATING") { if (selected.musicStatus === "GENERATING") {
Alert.alert( alert(
"Attention", "Attention",
"La chanson est en cours de génération. Veuillez patienter.", "La chanson est en cours de génération. Veuillez patienter.",
); );
+3 -2
View File
@@ -1,10 +1,11 @@
import { BlurView } from "expo-blur"; import { BlurView } from "expo-blur";
import React, { useEffect, useRef, useState } from "react"; import React, { useEffect, useRef, useState } from "react";
import { Alert, Image, Platform, Text, View } from "react-native"; import { Image, Platform, Text, View } from "react-native";
import useMinuit from "react-native-minuit/src/hooks/useMinuit.js"; import useMinuit from "react-native-minuit/src/hooks/useMinuit.js";
import { ai } from "../../assets"; import { ai } from "../../assets";
import GradientButton from "../../components/GradientButton"; import GradientButton from "../../components/GradientButton";
import ProgressBar from "../../components/ProgressBar"; import ProgressBar from "../../components/ProgressBar";
import alert from "../../components/Alert";
import firebase from "../../config/firebase"; import firebase from "../../config/firebase";
import { Routes } from "../../navigation"; import { Routes } from "../../navigation";
import { navigate } from "../../navigation/NavigationService"; import { navigate } from "../../navigation/NavigationService";
@@ -145,7 +146,7 @@ const CreatingLyrics = ({ active, config, selections }) => {
navigate(Routes.WritingLyrics); navigate(Routes.WritingLyrics);
}; };
Alert.alert( alert(
"Brief à reformuler", "Brief à reformuler",
error.message, error.message,
[ [
+10 -22
View File
@@ -1,10 +1,11 @@
import React, { useCallback, useMemo, useRef, useState } from "react"; import React, { useCallback, useMemo, useRef, useState } from "react";
import { Alert, ScrollView, View } from "react-native"; import { ScrollView, View } from "react-native";
import useMinuit from "react-native-minuit/src/hooks/useMinuit.js"; import useMinuit from "react-native-minuit/src/hooks/useMinuit.js";
import { background } from "../../assets"; import { background } from "../../assets";
import BorderGradientButton from "../../components/BorderGradientButton"; import BorderGradientButton from "../../components/BorderGradientButton";
import GradientButton from "../../components/GradientButton"; import GradientButton from "../../components/GradientButton";
import ItemContainer from "../../components/ItemContainer/ItemContainer"; import ItemContainer from "../../components/ItemContainer/ItemContainer";
import alert from "../../components/Alert";
import MusicLandHeader from "../../components/MusicLandHeader"; import MusicLandHeader from "../../components/MusicLandHeader";
import firebase, { projectsRef } from "../../config/firebase"; import firebase, { projectsRef } from "../../config/firebase";
import { isWeb } from "../../hooks/useLayoutType"; import { isWeb } from "../../hooks/useLayoutType";
@@ -96,26 +97,14 @@ const Lyrics = ({ navigation }) => {
return obj; return obj;
}; };
const alertMessage = useCallback( const alertMessage = useCallback((title, message) => {
(title, message) => { alert(title, message);
const text = [title, message].filter(Boolean).join("\n\n"); }, []);
if (isWeb && typeof window !== "undefined") {
window.alert(text);
return;
}
Alert.alert(title, message);
},
[isWeb]
);
const confirmSensitiveContent = useCallback( const confirmSensitiveContent = useCallback(
async (title, message) => { (title, message) =>
const text = [title, message].filter(Boolean).join("\n\n"); new Promise((resolve) => {
if (isWeb && typeof window !== "undefined") { alert(title, message, [
return window.confirm(text);
}
return new Promise((resolve) => {
Alert.alert(title, message, [
{ {
text: "Annuler", text: "Annuler",
style: "cancel", style: "cancel",
@@ -127,9 +116,8 @@ const Lyrics = ({ navigation }) => {
onPress: () => resolve(true), onPress: () => resolve(true),
}, },
]); ]);
}); }),
}, []
[isWeb]
); );
const onValidate = useCallback(async () => { const onValidate = useCallback(async () => {
+16 -20
View File
@@ -1,12 +1,13 @@
import { useIsFocused } from "@react-navigation/native"; import { useIsFocused } from "@react-navigation/native";
import { Image as ExpoImage } from "expo-image"; import { Image as ExpoImage } from "expo-image";
import React, { useCallback, useEffect } from "react"; import React, { useCallback, useEffect } from "react";
import { ActivityIndicator, Alert, Text, View } from "react-native"; import { ActivityIndicator, Text, View } from "react-native";
import useMinuit from "react-native-minuit/src/hooks/useMinuit.js"; import useMinuit from "react-native-minuit/src/hooks/useMinuit.js";
import { background, icons } from "../../assets"; import { background, icons } from "../../assets";
import BorderGradientButton from "../../components/BorderGradientButton"; import BorderGradientButton from "../../components/BorderGradientButton";
import GradientButton from "../../components/GradientButton"; import GradientButton from "../../components/GradientButton";
import MusicLandHeader from "../../components/MusicLandHeader"; import MusicLandHeader from "../../components/MusicLandHeader";
import alert from "../../components/Alert";
import firebase, { tasksRef } from "../../config/firebase"; import firebase, { tasksRef } from "../../config/firebase";
import loaderMessages from "../../config/loaderMessages"; import loaderMessages from "../../config/loaderMessages";
import { isWeb } from "../../hooks/useLayoutType"; import { isWeb } from "../../hooks/useLayoutType";
@@ -66,25 +67,20 @@ const PouchReady = () => {
!selectedProject?.cover?.generatedBackground && !selectedProject?.cover?.generatedBackground &&
selectedProject?.coverStatus !== "GENERATING" selectedProject?.coverStatus !== "GENERATING"
) { ) {
if (isWeb) { alert(
if (typeof window !== "undefined") { "Attention",
const shouldGenerate = window.confirm("Générer une pochette ?"); "Générer une pochette ?",
if (shouldGenerate) { [
generateCover(); {
} text: "Oui",
} onPress: generateCover,
return; },
} {
text: "Non",
Alert.alert("Attention", "Générer une pochette ?", [ },
{ ],
text: "Oui", { cancelable: true }
onPress: generateCover, );
},
{
text: "Non",
},
]);
} }
}, [generateCover, isFocused, selectedProject]); }, [generateCover, isFocused, selectedProject]);