Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/(auth)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ const AuthLayout = () => {
}}
/>
<Stack.Screen
name="signup"
name="create-new-account"
options={{
headerShown: false,
}}
/>
<Stack.Screen
name="forget-password"
name="forgot-password"
options={{
headerShown: false,
}}
Expand Down
2 changes: 1 addition & 1 deletion app/(auth)/create-new-account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const SignUpScreen = () => {
Already have an account?{" "}
<Text
style={styles.loginLink}
onPress={() => router.navigate("/(auth)/login")}
onPress={() => router.replace("/(auth)/login")}
>
Login
</Text>
Expand Down
82 changes: 0 additions & 82 deletions app/(auth)/forget-password.tsx

This file was deleted.

81 changes: 76 additions & 5 deletions app/(auth)/forgot-password.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,82 @@
import { Text, View } from "@/components/theme/Themed";
import fnStyles from "@/styles/forgot-password.styles";
import { useTheme } from "@react-navigation/native";
import { useRouter } from "expo-router";
import * as React from "react";
import { View, Image, Text } from "react-native";
import { TextInput, Button } from "react-native-paper";
import { sendPasswordResetEmail } from "firebase/auth";
import { AuthApp } from "@/utils/auth";
import Toaster from "@/shared-uis/components/toaster/Toaster";
import Colors from "@/constants/Colors";

const ForgotPasswordScreen = () => {
const [email, setEmail] = React.useState("");
const router = useRouter();
const theme = useTheme();
const styles = fnStyles(theme);

const handleResetPassword = () => {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

if (!emailRegex.test(email)) {
alert("Please enter a valid email address");
return;
}

sendPasswordResetEmail(AuthApp, email)
.then(() => {
Toaster.success("Password reset email sent successfully");
router.replace("/(auth)/login");
})
.catch((error) => {
Toaster.error(error.message);
});
};

const ForgotPassword = () => {
return (
<View>
<Text>Forgot Password</Text>
<View style={styles.container}>
{/* Logo Section */}
<Image
source={require("@/assets/images/logo.png")} // Replace with your actual logo path
style={styles.logo}
resizeMode="contain"
/>

{/* Title */}
<Text style={styles.title}>Forgot Password</Text>

{/* Email Input Field */}
<TextInput
label="Enter your Email ID"
value={email}
onChangeText={setEmail}
mode="outlined"
style={styles.input}
theme={{ colors: { primary: Colors(theme).text } }}
/>

{/* Reset Password Button */}
<Button
mode="contained"
onPress={() => {
handleResetPassword();
}}
>
Reset Password
</Button>

{/* Back to Login Prompt */}
<Text style={styles.loginText}>
Remember your password?{" "}
<Text
style={styles.loginLink}
onPress={() => router.replace("/(auth)/login")}
>
Login
</Text>
</Text>
</View>
);
};

export default ForgotPassword;
export default ForgotPasswordScreen;
4 changes: 2 additions & 2 deletions app/(auth)/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ const LoginScreen = () => {
Don't have an account?{" "}
<Text
style={styles.footerLink}
onPress={() => router.navigate("/create-new-account")}
onPress={() => router.replace("/create-new-account")}
>
Sign Up
</Text>
</Text>

<Text
style={styles.footerLink}
onPress={() => router.navigate("/forget-password")}
onPress={() => router.replace("/forgot-password")}
>
Forgot Password?
</Text>
Expand Down
34 changes: 0 additions & 34 deletions app/(auth)/signup.tsx

This file was deleted.

31 changes: 19 additions & 12 deletions app/(onboarding)/onboarding-get-started.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import { doc, getDoc, setDoc } from "firebase/firestore";
import { FirestoreDB } from "@/utils/firestore";
import { useBrandContext } from "@/contexts/brand-context.provider";
import { Brand } from "@/types/Brand";
import Toaster from "@/shared-uis/components/toaster/Toaster";

const GetStartedScreen = () => {
const [hearAboutUs, setHearAboutUs] = useState("");
const [useFor, setUseFor] = useState("");
const [volumeOfCollaboration, setVolumeOfCollaboration] = useState("");
const { firebaseSignIn } = useAuthContext();
const { setSession } = useAuthContext();
const theme = useTheme();
const styles = fnStyles(theme);

Expand All @@ -34,22 +35,27 @@ const GetStartedScreen = () => {
const openMenu3 = () => setVisible3(true);
const closeMenu3 = () => setVisible3(false);

const handleSignUp = () => {
firebaseSignIn(AuthApp.currentUser?.uid || "");
};

const params = useLocalSearchParams();
const {
brandId,
firstBrand,
} = useLocalSearchParams();

const {
setSelectedBrand,
} = useBrandContext();

const handleSkip = () => {
setSession(AuthApp.currentUser?.uid || "");
router.replace("/explore-influencers");
Toaster.success(firstBrand === "true" ? "Signed In Successfully!" : "Brand Created Successfully!");
};

const handleSubmit = async () => {
try {
const { brandId } = params;
if (brandId) {
//@ts-ignore
const brandRef = doc(FirestoreDB, "brands", brandId);

await setDoc(
brandRef,
{
Expand All @@ -60,7 +66,7 @@ const GetStartedScreen = () => {
},
},
{ merge: true }
);
)

const brandData = await getDoc(brandRef);

Expand All @@ -69,7 +75,8 @@ const GetStartedScreen = () => {
id: brandRef.id,
});

router.push("/(main)/explore-influencers");
router.replace("/explore-influencers");
Toaster.success(firstBrand === "true" ? "Signed In Successfully!" : "Brand Created Successfully!");
}
} catch (error) {
console.error(error);
Expand All @@ -85,7 +92,7 @@ const GetStartedScreen = () => {
<Button
mode="contained"
onPress={() => {
handleSignUp();
handleSkip();
}}
>
Skip
Expand Down Expand Up @@ -212,13 +219,13 @@ const GetStartedScreen = () => {
<Button
mode="contained"
onPress={() => {
handleSignUp();
handleSubmit();
}}
style={{
width: "100%",
}}
>
Take me in
{firstBrand === "true" ? "Take me in" : "Submit"}
</Button>
</View>
</View>
Expand Down
18 changes: 11 additions & 7 deletions app/(onboarding)/onboarding-your-brand.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import { router, useLocalSearchParams } from "expo-router";
import { useTheme } from "@react-navigation/native";
import { addDoc, collection, doc, setDoc } from "firebase/firestore";

import { AuthApp } from "@/utils/auth";
import { Brand } from "@/types/Brand";
import { FirestoreDB } from "@/utils/firestore";
import { useBrandContext } from "@/contexts/brand-context.provider";
import { useFirebaseStorageContext } from "@/contexts";
import { useAuthContext, useFirebaseStorageContext } from "@/contexts";
import AppLayout from "@/layouts/app-layout";
import BrandProfile from "@/components/brand-profile";
import fnStyles from "@/styles/onboarding/brand.styles";
Expand Down Expand Up @@ -48,9 +47,11 @@ const OnboardingScreen = () => {
const {
setSelectedBrand,
} = useBrandContext();
const {
manager: user,
} = useAuthContext();

const handleCreateBrand = async () => {
const user = AuthApp.currentUser;
if (!user) {
Toaster.error("User not found");
return;
Expand Down Expand Up @@ -82,16 +83,19 @@ const OnboardingScreen = () => {
"brands",
docRef.id,
"members",
user.uid
user.id
);

await setDoc(managerRef, {
managerId: user.uid,
managerId: user.id,
role,
}).then(() => {
router.navigate({
router.replace({
pathname: "/(onboarding)/onboarding-get-started",
params: { brandId: docRef.id },
params: {
brandId: docRef.id,
firstBrand: firstBrand === "true" ? "true" : "false",
},
});
setSelectedBrand(brandData as Brand);
}).catch((error) => {
Expand Down
Loading