continue generating flow, add backend connection on main tabs

This commit is contained in:
Thomas Demirdjian
2025-08-28 17:18:28 +02:00
parent 0ca7544005
commit bb7b35626f
110 changed files with 1701 additions and 3408 deletions
+53 -2
View File
@@ -1,17 +1,68 @@
import { View, Text } from "react-native";
import React from "react";
import React, { useGlobal } from "reactn";
import AppActionSheet from "../AppActionSheet";
import BorderGradientButton from "../BorderGradientButton";
import GradientButton from "../GradientButton";
import { Palette } from "../../styles";
import { FONT_FAMILY } from "../../styles/Fonts";
import { SheetManager } from "react-native-actions-sheet";
import alert from "../Alert";
import firebase, { usersRef } from "../../config/firebase";
import { reset } from "../../navigation/NavigationService";
import { Routes } from "../../navigation";
const DeleteAccountModal = () => {
const [currentUID] = useGlobal("currentUID");
const [, setTooltip] = useGlobal("_tooltip");
const onClose = async () => {
await SheetManager.hide("DeleteAccount");
};
const confirmDelete = () => {
alert(
"Êtes-vous sûr ?",
"Cette action supprimera votre profil.",
[
{ text: "Annuler", style: "cancel", onPress: () => {} },
{
text: "Confirmer",
onPress: () => {
alert(
"Confirmation",
"Dernière vérification: supprimer définitivement votre profil ?",
[
{ text: "Non", style: "cancel", onPress: () => {} },
{
text: "Oui, supprimer",
onPress: async () => {
try {
if (!currentUID) return;
await usersRef.doc(currentUID).delete();
// Sign out and reset navigation to Login
await firebase.auth().signOut();
reset({ index: 0, routes: [{ name: Routes.Login }] });
setTooltip({ type: "success", text: "Profil supprimé" });
} catch (e) {
setTooltip({
type: "error",
text: e?.message || "Suppression impossible",
});
} finally {
onClose();
}
},
},
],
{ cancelable: true },
);
},
},
],
{ cancelable: true },
);
};
return (
<AppActionSheet id="DeleteAccount">
<View style={{ gap: 20 }}>
@@ -39,7 +90,7 @@ const DeleteAccountModal = () => {
</Text>
</View>
<View style={{ width: "80%", alignSelf: "center", gap: 12 }}>
<BorderGradientButton title="Oui, supprimer" onPress={onClose} />
<BorderGradientButton title="Oui, supprimer" onPress={confirmDelete} />
<GradientButton title="Non, annuler" onPress={onClose} />
</View>
</View>