mirror of
https://github.com/urosran/cally.git
synced 2025-08-25 13:49:39 +00:00
Remove dark theme
This commit is contained in:
@ -1,29 +1,19 @@
|
||||
import { View, Text } from "react-native-ui-lib";
|
||||
import React, { useState } from "react";
|
||||
import {View} from "react-native-ui-lib";
|
||||
import React, {useState} from "react";
|
||||
import SignUpPage from "./SignUpPage";
|
||||
import SignInPage from "./SignInPage";
|
||||
import { useSignUp } from "@/hooks/firebase/useSignUp";
|
||||
import { StyleSheet } from "react-native";
|
||||
import {ResetPasswordPage} from "@/components/pages/main/ResetPasswordPage";
|
||||
|
||||
const Entry = () => {
|
||||
const [isRegister, setIsRegister] = useState<boolean>(false);
|
||||
const { mutateAsync: signUp } = useSignUp();
|
||||
const [tab, setTab] = useState<"register" | "login" | "reset-password">("login");
|
||||
|
||||
const setRegister = () => {
|
||||
setIsRegister(true);
|
||||
};
|
||||
const unsetRegister = () => {
|
||||
setIsRegister(false);
|
||||
};
|
||||
return (
|
||||
<View>
|
||||
{isRegister ? (
|
||||
<SignUpPage unsetRegister={unsetRegister} />
|
||||
) : (
|
||||
<SignInPage setRegister={setRegister} />
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
return (
|
||||
<View>
|
||||
{tab === "register" && <SignUpPage setTab={setTab}/>}
|
||||
{tab === "login" && <SignInPage setTab={setTab}/>}
|
||||
{tab === "reset-password" && <ResetPasswordPage setTab={setTab}/>}
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
export default Entry;
|
||||
|
51
components/pages/main/ResetPasswordPage.tsx
Normal file
51
components/pages/main/ResetPasswordPage.tsx
Normal file
@ -0,0 +1,51 @@
|
||||
import {Button, ButtonSize, Text, TextField, View} from "react-native-ui-lib";
|
||||
import React, {useState} from "react";
|
||||
import {useSignIn} from "@/hooks/firebase/useSignIn";
|
||||
import {StyleSheet} from "react-native";
|
||||
import {useResetPassword} from "@/hooks/firebase/useResetPassword";
|
||||
import {isLoading} from "expo-font";
|
||||
|
||||
export const ResetPasswordPage = ({setTab}: { setTab: React.Dispatch<React.SetStateAction<"register" | "login" | "reset-password">> }) => {
|
||||
const [email, setEmail] = useState<string>("");
|
||||
|
||||
const {mutateAsync: resetPassword, error, isError, isLoading} = useResetPassword();
|
||||
|
||||
const handleResetPassword = async () => {
|
||||
await resetPassword({email});
|
||||
alert("Password reset, please check your email")
|
||||
};
|
||||
|
||||
return (
|
||||
<View padding-10 centerV height={"100%"}>
|
||||
<Text text70 center>
|
||||
Please enter your email and reset your password
|
||||
</Text>
|
||||
|
||||
<TextField
|
||||
placeholder="Email"
|
||||
value={email}
|
||||
onChangeText={setEmail}
|
||||
style={styles.textfield}
|
||||
/>
|
||||
<Button
|
||||
label="Reset Password"
|
||||
onPress={handleResetPassword}
|
||||
marginB-20
|
||||
backgroundColor="#fd1775"
|
||||
disabled={isLoading}
|
||||
/>
|
||||
|
||||
{isError && <Text center style={{marginBottom: 20}}>{`${error}`}</Text>}
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
textfield: {
|
||||
backgroundColor: "white",
|
||||
marginVertical: 10,
|
||||
padding: 30,
|
||||
height: 45,
|
||||
borderRadius: 50,
|
||||
},
|
||||
});
|
@ -2,8 +2,9 @@ import {Button, ButtonSize, Text, TextField, View} from "react-native-ui-lib";
|
||||
import React, {useState} from "react";
|
||||
import {useSignIn} from "@/hooks/firebase/useSignIn";
|
||||
import {StyleSheet} from "react-native";
|
||||
import Toast from 'react-native-toast-message';
|
||||
|
||||
const SignInPage = (props: { setRegister: () => any }) => {
|
||||
const SignInPage = ({setTab}: { setTab: React.Dispatch<React.SetStateAction<"register" | "login" | "reset-password">> }) => {
|
||||
const [email, setEmail] = useState<string>("");
|
||||
const [password, setPassword] = useState<string>("");
|
||||
|
||||
@ -11,6 +12,12 @@ const SignInPage = (props: { setRegister: () => any }) => {
|
||||
|
||||
const handleSignIn = async () => {
|
||||
await signIn({email, password});
|
||||
if(!isError) {
|
||||
Toast.show({
|
||||
type: "success",
|
||||
text1: "Password successfully reset, please check your messages."
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
@ -41,7 +48,7 @@ const SignInPage = (props: { setRegister: () => any }) => {
|
||||
Don't have an account?
|
||||
</Text>
|
||||
<Button
|
||||
onPress={props.setRegister}
|
||||
onPress={() => setTab("register")}
|
||||
label="Sign Up"
|
||||
link
|
||||
size={ButtonSize.xSmall}
|
||||
@ -52,6 +59,23 @@ const SignInPage = (props: { setRegister: () => any }) => {
|
||||
color="#fd1775"
|
||||
/>
|
||||
</View>
|
||||
|
||||
<View row centerH marginB-5 gap-5>
|
||||
<Text text70>
|
||||
Forgot your password?
|
||||
</Text>
|
||||
<Button
|
||||
onPress={() => setTab("reset-password")}
|
||||
label="Reset password"
|
||||
link
|
||||
size={ButtonSize.xSmall}
|
||||
padding-0
|
||||
margin-0
|
||||
text70
|
||||
left
|
||||
color="#fd1775"
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
@ -5,7 +5,7 @@ import {ProfileType} from "@/contexts/AuthContext";
|
||||
import {StyleSheet} from "react-native";
|
||||
import {AntDesign} from "@expo/vector-icons";
|
||||
|
||||
const SignUpPage = (props: { unsetRegister: () => any }) => {
|
||||
const SignUpPage = ({setTab}: { setTab: React.Dispatch<React.SetStateAction<"register" | "login" | "reset-password">> }) => {
|
||||
const [email, setEmail] = useState<string>("");
|
||||
const [firstName, setFirstName] = useState<string>("");
|
||||
const [lastName, setLastName] = useState<string>("");
|
||||
@ -125,7 +125,7 @@ const SignUpPage = (props: { unsetRegister: () => any }) => {
|
||||
color="#fd1775"
|
||||
size={ButtonSize.small}
|
||||
text70
|
||||
onPress={props.unsetRegister}
|
||||
onPress={() => setTab("login")}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
Reference in New Issue
Block a user