mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 08:24:55 +00:00
Remove dark theme
This commit is contained in:
6
.github/workflows/.env
vendored
Executable file
6
.github/workflows/.env
vendored
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
EXPO_ASC_API_KEY_PATH=../AuthKey_F7ZX3C8C69.p8
|
||||||
|
EXPO_ASC_KEY_ID=F7ZX3C8C69
|
||||||
|
EXPO_ASC_ISSUER_ID=f7d6175c-75fe-416c-b6d1-0bc9eaf87415
|
||||||
|
EXPO_APPLE_TEAM_ID=MV9C3PHV87
|
||||||
|
EXPO_APPLE_TEAM_TYPE=INDIVIDUAL
|
||||||
|
EXPO_TOKEN=qt2h_4xhuhFB-ArysIkzgpsBtWOrrZ-c_So_S9ch
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import {Stack} from "expo-router";
|
import {Stack} from "expo-router";
|
||||||
|
|
||||||
export default function Layout() {
|
export default function Layout() {
|
||||||
return <Stack screenOptions={{title: ""}}/>
|
return <Stack screenOptions={{headerShown: false}}/>
|
||||||
}
|
}
|
||||||
@ -12,6 +12,7 @@ import functions from "@react-native-firebase/functions";
|
|||||||
import firestore from "@react-native-firebase/firestore";
|
import firestore from "@react-native-firebase/firestore";
|
||||||
import auth from "@react-native-firebase/auth";
|
import auth from "@react-native-firebase/auth";
|
||||||
import {QueryClient, QueryClientProvider} from "react-query";
|
import {QueryClient, QueryClientProvider} from "react-query";
|
||||||
|
import {Toast} from "react-native-ui-lib";
|
||||||
|
|
||||||
// Prevent the splash screen from auto-hiding before asset loading is complete.
|
// Prevent the splash screen from auto-hiding before asset loading is complete.
|
||||||
SplashScreen.preventAutoHideAsync();
|
SplashScreen.preventAutoHideAsync();
|
||||||
@ -26,7 +27,6 @@ if (__DEV__) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function RootLayout() {
|
export default function RootLayout() {
|
||||||
const colorScheme = useColorScheme();
|
|
||||||
const [loaded] = useFonts({
|
const [loaded] = useFonts({
|
||||||
SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'),
|
SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'),
|
||||||
});
|
});
|
||||||
@ -44,12 +44,13 @@ export default function RootLayout() {
|
|||||||
return (
|
return (
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<AuthContextProvider>
|
<AuthContextProvider>
|
||||||
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
|
<ThemeProvider value={DefaultTheme}>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack.Screen name="(auth)" options={{headerShown: false}}/>
|
<Stack.Screen name="(auth)" options={{headerShown: false}}/>
|
||||||
<Stack.Screen name="(unauth)" options={{headerShown: false}}/>
|
<Stack.Screen name="(unauth)" options={{headerShown: false}}/>
|
||||||
<Stack.Screen name="+not-found"/>
|
<Stack.Screen name="+not-found"/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
<Toast />
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
</AuthContextProvider>
|
</AuthContextProvider>
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
|
|||||||
@ -1,27 +1,17 @@
|
|||||||
import { View, Text } from "react-native-ui-lib";
|
import {View} from "react-native-ui-lib";
|
||||||
import React, {useState} from "react";
|
import React, {useState} from "react";
|
||||||
import SignUpPage from "./SignUpPage";
|
import SignUpPage from "./SignUpPage";
|
||||||
import SignInPage from "./SignInPage";
|
import SignInPage from "./SignInPage";
|
||||||
import { useSignUp } from "@/hooks/firebase/useSignUp";
|
import {ResetPasswordPage} from "@/components/pages/main/ResetPasswordPage";
|
||||||
import { StyleSheet } from "react-native";
|
|
||||||
|
|
||||||
const Entry = () => {
|
const Entry = () => {
|
||||||
const [isRegister, setIsRegister] = useState<boolean>(false);
|
const [tab, setTab] = useState<"register" | "login" | "reset-password">("login");
|
||||||
const { mutateAsync: signUp } = useSignUp();
|
|
||||||
|
|
||||||
const setRegister = () => {
|
|
||||||
setIsRegister(true);
|
|
||||||
};
|
|
||||||
const unsetRegister = () => {
|
|
||||||
setIsRegister(false);
|
|
||||||
};
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
{isRegister ? (
|
{tab === "register" && <SignUpPage setTab={setTab}/>}
|
||||||
<SignUpPage unsetRegister={unsetRegister} />
|
{tab === "login" && <SignInPage setTab={setTab}/>}
|
||||||
) : (
|
{tab === "reset-password" && <ResetPasswordPage setTab={setTab}/>}
|
||||||
<SignInPage setRegister={setRegister} />
|
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
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 React, {useState} from "react";
|
||||||
import {useSignIn} from "@/hooks/firebase/useSignIn";
|
import {useSignIn} from "@/hooks/firebase/useSignIn";
|
||||||
import {StyleSheet} from "react-native";
|
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 [email, setEmail] = useState<string>("");
|
||||||
const [password, setPassword] = useState<string>("");
|
const [password, setPassword] = useState<string>("");
|
||||||
|
|
||||||
@ -11,6 +12,12 @@ const SignInPage = (props: { setRegister: () => any }) => {
|
|||||||
|
|
||||||
const handleSignIn = async () => {
|
const handleSignIn = async () => {
|
||||||
await signIn({email, password});
|
await signIn({email, password});
|
||||||
|
if(!isError) {
|
||||||
|
Toast.show({
|
||||||
|
type: "success",
|
||||||
|
text1: "Password successfully reset, please check your messages."
|
||||||
|
})
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -41,7 +48,7 @@ const SignInPage = (props: { setRegister: () => any }) => {
|
|||||||
Don't have an account?
|
Don't have an account?
|
||||||
</Text>
|
</Text>
|
||||||
<Button
|
<Button
|
||||||
onPress={props.setRegister}
|
onPress={() => setTab("register")}
|
||||||
label="Sign Up"
|
label="Sign Up"
|
||||||
link
|
link
|
||||||
size={ButtonSize.xSmall}
|
size={ButtonSize.xSmall}
|
||||||
@ -52,6 +59,23 @@ const SignInPage = (props: { setRegister: () => any }) => {
|
|||||||
color="#fd1775"
|
color="#fd1775"
|
||||||
/>
|
/>
|
||||||
</View>
|
</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>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import {ProfileType} from "@/contexts/AuthContext";
|
|||||||
import {StyleSheet} from "react-native";
|
import {StyleSheet} from "react-native";
|
||||||
import {AntDesign} from "@expo/vector-icons";
|
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 [email, setEmail] = useState<string>("");
|
||||||
const [firstName, setFirstName] = useState<string>("");
|
const [firstName, setFirstName] = useState<string>("");
|
||||||
const [lastName, setLastName] = useState<string>("");
|
const [lastName, setLastName] = useState<string>("");
|
||||||
@ -125,7 +125,7 @@ const SignUpPage = (props: { unsetRegister: () => any }) => {
|
|||||||
color="#fd1775"
|
color="#fd1775"
|
||||||
size={ButtonSize.small}
|
size={ButtonSize.small}
|
||||||
text70
|
text70
|
||||||
onPress={props.unsetRegister}
|
onPress={() => setTab("login")}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
16
hooks/firebase/useResetPassword.ts
Normal file
16
hooks/firebase/useResetPassword.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import {useMutation} from "react-query";
|
||||||
|
import auth from "@react-native-firebase/auth";
|
||||||
|
|
||||||
|
export const useResetPassword = () => {
|
||||||
|
return useMutation({
|
||||||
|
mutationKey: ["resetPassword"],
|
||||||
|
mutationFn: async (
|
||||||
|
{
|
||||||
|
email,
|
||||||
|
}: {
|
||||||
|
email: string;
|
||||||
|
}) => {
|
||||||
|
return await auth().sendPasswordResetEmail(email);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
@ -64,6 +64,7 @@
|
|||||||
"react-native-safe-area-context": "4.10.5",
|
"react-native-safe-area-context": "4.10.5",
|
||||||
"react-native-screens": "3.31.1",
|
"react-native-screens": "3.31.1",
|
||||||
"react-native-svg": "^15.6.0",
|
"react-native-svg": "^15.6.0",
|
||||||
|
"react-native-toast-message": "^2.2.1",
|
||||||
"react-native-ui-lib": "^7.27.0",
|
"react-native-ui-lib": "^7.27.0",
|
||||||
"react-native-web": "~0.19.10",
|
"react-native-web": "~0.19.10",
|
||||||
"react-query": "^3.39.3"
|
"react-query": "^3.39.3"
|
||||||
|
|||||||
@ -8544,6 +8544,11 @@ react-native-swipe-gestures@^1.0.5:
|
|||||||
resolved "https://registry.npmjs.org/react-native-swipe-gestures/-/react-native-swipe-gestures-1.0.5.tgz"
|
resolved "https://registry.npmjs.org/react-native-swipe-gestures/-/react-native-swipe-gestures-1.0.5.tgz"
|
||||||
integrity sha512-Ns7Bn9H/Tyw278+5SQx9oAblDZ7JixyzeOczcBK8dipQk2pD7Djkcfnf1nB/8RErAmMLL9iXgW0QHqiII8AhKw==
|
integrity sha512-Ns7Bn9H/Tyw278+5SQx9oAblDZ7JixyzeOczcBK8dipQk2pD7Djkcfnf1nB/8RErAmMLL9iXgW0QHqiII8AhKw==
|
||||||
|
|
||||||
|
react-native-toast-message@^2.2.1:
|
||||||
|
version "2.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/react-native-toast-message/-/react-native-toast-message-2.2.1.tgz#f395321e9bc818ce63274c38a3d294ed997a4a27"
|
||||||
|
integrity sha512-iXFMnlxPcgKKs4bZOIl06W16m6KXMh/bAYpWLyVXlISSCdcL2+FX5WPpRP3TGQeM/u9q+j5ex48DDY+72en+Sw==
|
||||||
|
|
||||||
react-native-ui-lib@^7.27.0:
|
react-native-ui-lib@^7.27.0:
|
||||||
version "7.29.0"
|
version "7.29.0"
|
||||||
resolved "https://registry.npmjs.org/react-native-ui-lib/-/react-native-ui-lib-7.29.0.tgz"
|
resolved "https://registry.npmjs.org/react-native-ui-lib/-/react-native-ui-lib-7.29.0.tgz"
|
||||||
|
|||||||
Reference in New Issue
Block a user