diff --git a/package-lock.json b/package-lock.json index 375029b..fc5dec3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "postcss": "8.4.28", "react": "18.2.0", "react-dom": "18.2.0", + "react-icons": "^4.11.0", "tailwindcss": "3.3.3" }, "devDependencies": { @@ -3365,6 +3366,14 @@ } } }, + "node_modules/react-icons": { + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.11.0.tgz", + "integrity": "sha512-V+4khzYcE5EBk/BvcuYRq6V/osf11ODUM2J8hg2FDSswRrGvqiYUYPRy4OdrWaQOBj4NcpJfmHZLNaD+VH0TyA==", + "peerDependencies": { + "react": "*" + } + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -6369,6 +6378,12 @@ "use-sidecar": "^1.1.2" } }, + "react-icons": { + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.11.0.tgz", + "integrity": "sha512-V+4khzYcE5EBk/BvcuYRq6V/osf11ODUM2J8hg2FDSswRrGvqiYUYPRy4OdrWaQOBj4NcpJfmHZLNaD+VH0TyA==", + "requires": {} + }, "react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", diff --git a/package.json b/package.json index 41391a3..33c4b7d 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "postcss": "8.4.28", "react": "18.2.0", "react-dom": "18.2.0", + "react-icons": "^4.11.0", "tailwindcss": "3.3.3" }, "devDependencies": { diff --git a/src/components/Logo.tsx b/src/components/Logo.tsx new file mode 100644 index 0000000..5b51f19 --- /dev/null +++ b/src/components/Logo.tsx @@ -0,0 +1,3 @@ +export default function CompoundLogo(){ + return <>LOGO HERE +} \ No newline at end of file diff --git a/src/components/SignInForm.tsx b/src/components/SignInForm.tsx new file mode 100644 index 0000000..ee42f4a --- /dev/null +++ b/src/components/SignInForm.tsx @@ -0,0 +1,50 @@ +import { Text, Button, Input, Divider, VStack, HStack, InputGroup, InputRightElement, Center, AbsoluteCenter, Flex } from "@chakra-ui/react"; +import CompoundLogo from "./Logo"; +import { FcGoogle } from 'react-icons/fc' +import { FaFacebook } from 'react-icons/fa' +import { SiLinkedin } from 'react-icons/si' +import { signIn } from "next-auth/react"; +import { useState } from "react"; + +export default function SignInForm(): JSX.Element { + const [show, setShow] = useState(false) + const handleClick = () => setShow(!show) + + return ( + +
+ + + + + + + + + + + + Or Log In With One Of: + + {/* Providers Here */} + + + + + + + +
+
) + } \ No newline at end of file diff --git a/src/models/users.ts b/src/models/users.ts index 9eeab17..0ac3449 100644 --- a/src/models/users.ts +++ b/src/models/users.ts @@ -3,7 +3,7 @@ import { PrismaClient, User } from "@prisma/client"; import isEmail from "isemail"; import { PrismaClientKnownRequestError } from "@prisma/client/runtime/library"; import { UserData, UserReturnType } from "../../lib/CompoundTypes"; -import { data } from "autoprefixer"; +import prisma from "../../lib/client"; // Uer Information that is Insensitive export interface InsensitiveUserInformation { @@ -159,11 +159,11 @@ export default class Users { } public async isUserInDatabase(email: string): Promise { - const userExists = this.usersDB.findUnique({ + const userExists = await this.usersDB.findUnique({ where: { email: email, }, }); - return userExists instanceof Users; + return userExists !== null; } -} +} \ No newline at end of file diff --git a/src/pages/api/auth/[...nextauth].ts b/src/pages/api/auth/[...nextauth].ts index 748bbbe..932b05e 100644 --- a/src/pages/api/auth/[...nextauth].ts +++ b/src/pages/api/auth/[...nextauth].ts @@ -15,18 +15,20 @@ export const authOptions: NextAuthOptions = { async signIn({ user }) { if (user.email) { const isUserinDB = await persistentUserInstance.isUserInDatabase(user.email) + console.log(isUserinDB) if(isUserinDB === false) { const dummyUserData: UserData = { email: user.email, - phoneNumber: "null", + phoneNumber: null, firstName: user.name?.split(" ")[0] as string, lastName: user.name?.split(" ")[1] as string, dob: new Date(), }; await persistentUserInstance.signUpProviderDetails(dummyUserData); + return '/auth-frontend/signUp' } else { - return true + return '/dashboard' } } return true; diff --git a/src/pages/auth-frontend/signIn.tsx b/src/pages/auth-frontend/signIn.tsx index e69de29..7803350 100644 --- a/src/pages/auth-frontend/signIn.tsx +++ b/src/pages/auth-frontend/signIn.tsx @@ -0,0 +1,5 @@ +import SignInForm from "@/components/SignInForm"; + +export default function SignInPage(): JSX.Element { + return () +} \ No newline at end of file diff --git a/src/pages/auth-frontend/signUp.tsx b/src/pages/auth-frontend/signUp.tsx index e69de29..c9eeee9 100644 --- a/src/pages/auth-frontend/signUp.tsx +++ b/src/pages/auth-frontend/signUp.tsx @@ -0,0 +1,3 @@ +export default function SignInPage(): JSX.Element { + return (<>Sign Up Flow Here) +} \ No newline at end of file diff --git a/src/pages/dashboard/index.tsx b/src/pages/dashboard/index.tsx new file mode 100644 index 0000000..ceee2e9 --- /dev/null +++ b/src/pages/dashboard/index.tsx @@ -0,0 +1,3 @@ +export default function SignInPage(): JSX.Element { + return (<>dashboard here) +} \ No newline at end of file diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 5d42b2b..a747630 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,5 +1,7 @@ import SignUpBar from "@/components/SignUpBar"; import { signIn } from "next-auth/react"; +import SignInPage from "./auth-frontend/signIn"; +import { Button } from "@chakra-ui/react"; export default function Home() { function button(text: string) { @@ -9,16 +11,15 @@ export default function Home() { ); } - return (

Home!

-
- {button("Sign Up")} +
signIn("google")} > + {button("Sign In")}
-
- {button("Sign In")} +
signIn("google")} > + { button("Sign Up") }
);