Skip to content
Merged

Dev #152

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
2 changes: 1 addition & 1 deletion components/modal/auth/AuthInputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const AuthInputs: React.FC<AuthInputsProps> = () => {
const modalState = useAtomValue(authModalStateAtom);

return (
<Flex direction="column" align="center" width="100%" mt={4}>
<Flex direction="column" align="stretch" width="100%" mt={4}>
{modalState.view === "login" && <Login />}
{modalState.view === "signup" && <Signup />}
</Flex>
Expand Down
5 changes: 3 additions & 2 deletions components/modal/auth/AuthModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
DialogTitle,
Flex,
Separator,
Box,
} from "@chakra-ui/react";
import { useAtom } from "jotai";
import React, { useEffect } from "react";
Expand Down Expand Up @@ -92,12 +93,12 @@ const AuthModal: React.FC = () => {
>
{/* If user is trying to authenticate (log in or sign up) */}
{modalState.view === "login" || modalState.view === "signup" ? (
<>
<Box width="100%">
<OAuthButtons />
{/* <Text color='gray.500' fontWeight={700}>OR</Text> */}
<Separator />
<AuthInputs />
</>
</Box>
) : (
// If user is trying to reset password
<ResetPassword />
Expand Down
11 changes: 9 additions & 2 deletions components/modal/auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ const Login: React.FC<LoginProps> = () => {
};

return (
<form onSubmit={handleSubmit(onSubmit)}>
<form
onSubmit={(e) => {
e.preventDefault();
handleSubmit(onSubmit)(e);
}}
style={{ width: "100%" }}
>
<InputField placeholder="Email" type="email" {...register("email")} />
{errors.email && (
<Text color="red.500" fontSize="10pt" mt={1}>
Expand Down Expand Up @@ -94,7 +100,8 @@ const Login: React.FC<LoginProps> = () => {
height="36px"
mt={2}
mb={2}
type="submit"
type="button"
onClick={handleSubmit(onSubmit)}
loading={loading}
disabled={!isValid}
>
Expand Down
13 changes: 7 additions & 6 deletions components/modal/auth/ResetPassword.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Flex, Icon, Image, Input, Text } from "@chakra-ui/react";
import { Button, Flex, Icon, Image, Input, Text, Box } from "@chakra-ui/react";
import { useSetAtom } from "jotai";
import React, { useState } from "react";
import { useSendPasswordResetEmail } from "react-firebase-hooks/auth";
Expand Down Expand Up @@ -38,12 +38,12 @@ const ResetPassword: React.FC = () => {
{success ? (
<Text mb={4}>Check your email</Text>
) : (
<>
<Box width="100%" display="flex" flexDirection="column" alignItems="center">
<Text fontSize="sm" textAlign="center" mb={2}>
Enter the email associated with your account and we will send you a
reset link
</Text>
<form onSubmit={handleSubmit(onSubmit)} style={{ width: "100%" }}>
<form onSubmit={(e) => { e.preventDefault(); handleSubmit(onSubmit)(e); }} style={{ width: "100%" }}>
<Input
placeholder="Email"
type="email"
Expand Down Expand Up @@ -76,19 +76,20 @@ const ResetPassword: React.FC = () => {
>
{error?.message}
</Text>
<Button
<Button
width="100%"
height="36px"
mb={2}
mt={2}
type="submit"
type="button"
onClick={handleSubmit(onSubmit)}
loading={sending}
disabled={!isValid}
>
Reset Password
</Button>
</form>
</>
</Box>
)}
<Flex
alignItems="center"
Expand Down
11 changes: 9 additions & 2 deletions components/modal/auth/Signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ const SignUp = () => {
};

return (
<form onSubmit={handleSubmit(onSubmit)}>
<form
onSubmit={(e) => {
e.preventDefault();
handleSubmit(onSubmit)(e);
}}
style={{ width: "100%" }}
>
<InputField placeholder="Email" type="email" {...register("email")} />
{errors.email && (
<Text color="red.500" fontSize="10pt" mt={1}>
Expand Down Expand Up @@ -106,7 +112,8 @@ const SignUp = () => {
height="36px"
mt={2}
mb={2}
type="submit"
type="button"
onClick={handleSubmit(onSubmit)}
loading={loading}
disabled={!isValid}
>
Expand Down
12 changes: 7 additions & 5 deletions components/posts/comments/CommentInput.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ProfileModal from "@/components/modal/profile/ProfileModal";
import AuthButtons from "@/components/navbar/right-content/AuthButtons";
import { Flex, Textarea, Button, Text, Stack, Icon } from "@chakra-ui/react";
import { Flex, Textarea, Button, Text, Stack, Icon, Box } from "@chakra-ui/react";
import { LuSend, LuTrash } from "react-icons/lu";
import { User } from "firebase/auth";
import React, { useState } from "react";
Expand Down Expand Up @@ -37,14 +37,15 @@ const CommentInput: React.FC<CommentInputProps> = ({
const commentText = watch("text");

const onSubmit = (data: CommentInputType) => {
console.log("Submitting comment:", data.text);
onCreateComment(data.text);
reset();
};

return (
<Flex direction="column" position="relative">
{user ? (
<>
<Box width="100%">
<ProfileModal
handleClose={() => setProfileModalOpen(false)}
open={isProfileModalOpen}
Expand All @@ -67,7 +68,7 @@ const CommentInput: React.FC<CommentInputProps> = ({
</Text>
</Stack>

<form onSubmit={handleSubmit(onSubmit)}>
<form onSubmit={(e) => { e.preventDefault(); handleSubmit(onSubmit)(e); }}>
<Flex
direction="column"
bg={{ base: "white", _dark: "gray.800" }}
Expand Down Expand Up @@ -124,7 +125,8 @@ const CommentInput: React.FC<CommentInputProps> = ({
disabled={!isValid}
loading={createLoading}
borderRadius={"xl"}
type="submit"
type="button"
onClick={handleSubmit(onSubmit)}
height={"36px"}
>
<Icon as={LuSend} mr={2} />
Expand All @@ -134,7 +136,7 @@ const CommentInput: React.FC<CommentInputProps> = ({
</Flex>
</Flex>
</form>
</>
</Box>
) : (
<Flex
align="center"
Expand Down
Loading