feat: fixes and formatter

This commit is contained in:
2026-01-12 16:01:32 +01:00
parent 85c6084351
commit 11e632acff
353 changed files with 23315 additions and 27361 deletions
+44 -47
View File
@@ -1,50 +1,47 @@
import { BlurView } from "expo-blur";
import React, { useState } from "react";
import { Platform, Pressable, Text, View } from "react-native";
import { responsiveHeight } from "react-native-responsive-dimensions";
import { useGlobal } from "reactn";
import { background } from "../../assets";
import GradientButton from "../../components/GradientButton";
import firebase from "../../config/firebase";
import { isWeb } from "../../hooks/useLayoutType";
import Page from "../../layouts/Page";
import { Routes } from "../../navigation";
import { navigate } from "../../navigation/NavigationService";
import { gutters, Palette } from "../../styles";
import { FONT_FAMILY } from "../../styles/Fonts";
import EditInput from "./components/EditInput";
import { BlurView } from 'expo-blur'
import React, { useState } from 'react'
import { Platform, Pressable, Text, View } from 'react-native'
import { responsiveHeight } from 'react-native-responsive-dimensions'
import { useGlobal } from 'reactn'
import { background } from '../../assets'
import GradientButton from '../../components/GradientButton'
import firebase from '../../config/firebase'
import { isWeb } from '../../hooks/useLayoutType'
import Page from '../../layouts/Page'
import { Routes } from '../../navigation'
import { navigate } from '../../navigation/NavigationService'
import { gutters, Palette } from '../../styles'
import { FONT_FAMILY } from '../../styles/Fonts'
import EditInput from './components/EditInput'
const ChangePassword = () => {
const [oldPassword, setOldPassword] = useState("");
const [newPassword, setNewPassword] = useState("");
const [loading, setLoading] = useState(false);
const [, setTooltip] = useGlobal("_tooltip");
const [oldPassword, setOldPassword] = useState('')
const [newPassword, setNewPassword] = useState('')
const [loading, setLoading] = useState(false)
const [, setTooltip] = useGlobal('_tooltip')
const onSave = async () => {
const oldVal = (oldPassword || "").trim();
const newVal = (newPassword || "").trim();
if (!oldVal || !newVal) return;
const oldVal = (oldPassword || '').trim()
const newVal = (newPassword || '').trim()
if (!oldVal || !newVal) return
try {
setLoading(true);
const user = firebase.auth().currentUser;
if (!user?.email) return;
setLoading(true)
const user = firebase.auth().currentUser
if (!user?.email) return
const credential = firebase.auth.EmailAuthProvider.credential(
user.email,
oldVal
);
await user.reauthenticateWithCredential(credential);
await user.updatePassword(newVal);
setTooltip({ type: "success", text: "Mot de passe mis à jour" });
navigate(Routes.Settings);
const credential = firebase.auth.EmailAuthProvider.credential(user.email, oldVal)
await user.reauthenticateWithCredential(credential)
await user.updatePassword(newVal)
setTooltip({ type: 'success', text: 'Mot de passe mis à jour' })
navigate(Routes.Settings)
} catch (e) {
console.log("ChangePassword error", e?.message);
const msg = e?.message || "Mise à jour impossible";
setTooltip({ type: "error", text: msg });
console.log('ChangePassword error', e?.message)
const msg = e?.message || 'Mise à jour impossible'
setTooltip({ type: 'error', text: msg })
} finally {
setLoading(false);
setLoading(false)
}
};
}
return (
<Page
headerType="NAVIGATE"
@@ -54,17 +51,17 @@ const ChangePassword = () => {
paddingBottom: gutters * 4,
}}
containerStyle={{
backgroundColor: isWeb ? "transparent" : "#0000004D",
backgroundColor: isWeb ? 'transparent' : '#0000004D',
}}
>
<View style={{ flex: 1, marginTop: responsiveHeight(2) }}>
<BlurView
intensity={Platform.OS !== "ios" ? 10 : 20}
intensity={Platform.OS !== 'ios' ? 10 : 20}
style={{
paddingHorizontal: 20,
paddingVertical: 16,
borderRadius: 20,
overflow: "hidden",
overflow: 'hidden',
backgroundColor: Palette.glass,
gap: 4,
}}
@@ -100,16 +97,16 @@ const ChangePassword = () => {
</BlurView>
</View>
<GradientButton
title={loading ? "Chargement..." : "Enregistrer les modifications"}
title={loading ? 'Chargement...' : 'Enregistrer les modifications'}
containerStyle={{
width: "80%",
alignSelf: "center",
width: '80%',
alignSelf: 'center',
}}
onPress={onSave}
disabled={loading || !oldPassword?.trim() || !newPassword?.trim()}
/>
</Page>
);
};
)
}
export default ChangePassword;
export default ChangePassword