login time
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useRouter } from "expo-router";
|
||||
import { useState } from "react";
|
||||
import { View, Text } from "react-native";
|
||||
import { View, Text, TouchableOpacity } from "react-native";
|
||||
import { z } from "zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
@@ -8,10 +8,10 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { AuthLayout } from "@/components/auth/AuthLayout";
|
||||
import { AuthHeader } from "@/components/auth/AuthHeader";
|
||||
import { AuthCard } from "@/components/auth/AuthCard";
|
||||
import { AuthFooter } from "@/components/auth/AuthFooter";
|
||||
import { FormInput } from "@/components/auth/FormInput";
|
||||
import { getApiUrl } from "@/store/api/baseApi";
|
||||
import { AuthButton } from "@/components/auth/AuthButton";
|
||||
import { MessageDisplay } from "@/components/auth/MessageDisplay";
|
||||
|
||||
const schema = z.object({
|
||||
email: z.email("Enter a valid email"),
|
||||
@@ -72,16 +72,12 @@ const ForgotPasswordScreen = () => {
|
||||
|
||||
return (
|
||||
<AuthLayout>
|
||||
<AuthHeader title="Project Athena" />
|
||||
<AuthHeader title="Bird Eye View" />
|
||||
<AuthCard title="Forgot Password" subtitle="We'll email you a reset link">
|
||||
{!!error && (
|
||||
<Text style={{ color: "#F83434", marginBottom: 8 }}>{error}</Text>
|
||||
)}
|
||||
{!!message && (
|
||||
<Text style={{ color: "#22C927", marginBottom: 8 }}>{message}</Text>
|
||||
)}
|
||||
{error ? <MessageDisplay message={error} type="error" /> : null}
|
||||
{message ? <MessageDisplay message={message} type="success" /> : null}
|
||||
<FormInput
|
||||
label={errors.email?.message || "Email"}
|
||||
label="Email"
|
||||
value={email}
|
||||
onChangeText={(t) => setValue("email", t, { shouldValidate: true })}
|
||||
icon="email"
|
||||
@@ -90,22 +86,31 @@ const ForgotPasswordScreen = () => {
|
||||
returnKeyType="send"
|
||||
submitBehavior="blurAndSubmit"
|
||||
/>
|
||||
<View style={{ marginTop: 8 }}>
|
||||
<AuthButton
|
||||
onPress={handleSubmit(onSubmit)}
|
||||
loading={submitting}
|
||||
{errors.email?.message ? (
|
||||
<Text style={{ color: "#F83434", marginTop: -4, marginBottom: 8 }}>
|
||||
{errors.email.message}
|
||||
</Text>
|
||||
) : null}
|
||||
<AuthButton
|
||||
onPress={handleSubmit(onSubmit)}
|
||||
loading={submitting}
|
||||
disabled={submitting}
|
||||
>
|
||||
{submitting ? "Sending..." : "Send Reset Link"}
|
||||
</AuthButton>
|
||||
|
||||
<View style={{ alignItems: "center", marginTop: 16 }}>
|
||||
<Text>Remembered your password?</Text>
|
||||
<TouchableOpacity
|
||||
onPress={() => router.push("/sign-in")}
|
||||
disabled={submitting}
|
||||
>
|
||||
{submitting ? "Sending..." : "Send Reset Link"}
|
||||
</AuthButton>
|
||||
<Text className="text-primaryPurpleDark font-bold mt-4">
|
||||
Sign in
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</AuthCard>
|
||||
<AuthFooter
|
||||
question="Remembered your password?"
|
||||
actionText="Sign in"
|
||||
onPress={() => router.push("/sign-in")}
|
||||
disabled={submitting}
|
||||
/>
|
||||
</AuthLayout>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user