Skip to content

Commit

Permalink
Removed Prisma and Fixed Footer
Browse files Browse the repository at this point in the history
  • Loading branch information
VulpoTheDev committed Sep 8, 2023
1 parent 591e584 commit 855531a
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 196 deletions.
2 changes: 0 additions & 2 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@fortawesome/free-brands-svg-icons": "^6.4.0",
"@fortawesome/react-fontawesome": "^0.2.0",
"@headlessui/react": "^1.7.17",
"@prisma/client": "^4.16.2",
"@tailwindcss/forms": "^0.5.5",
"@tailwindcss/typography": "^0.5.9",
"@types/lodash-es": "^4.17.8",
Expand All @@ -32,7 +31,6 @@
"lodash.kebabcase": "^4.1.1",
"lucide-react": "^0.269.0",
"next": "^13.4.19",
"next-auth": "^4.22.3",
"postcss": "^8.4.28",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
50 changes: 0 additions & 50 deletions apps/website/src/app/api/auth/[...nextauth]/route.ts

This file was deleted.

49 changes: 0 additions & 49 deletions apps/website/src/app/api/register/route.ts

This file was deleted.

28 changes: 14 additions & 14 deletions apps/website/src/app/signin/SignInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { FormEvent, useEffect, useState } from "react"
import { useRouter } from "next/navigation"

import { signIn, useSession } from "next-auth/react"
// import { signIn, useSession } from "next-auth/react"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"

import { emailRegex } from "@/constants"
Expand All @@ -16,20 +16,20 @@ export default function SignInForm() {
// TODO: 2. recommended to create a useClientAuth() custom hook to resolve code dup
// TODO: and also sharable for signup form too
// !!!!! code duplication detected !!!!!
const { status, data } = useSession()
const router = useRouter()
// const { status, data } = useSession()
// const router = useRouter()
const [emailEntered, setEmailEntered] = useState(false)
const [errors, setErrors] = useState<string[]>([])
const [email, setEmail] = useState("")
const [password, setPassword] = useState("")
useEffect(() => {
console.log("USE EFFECT ")
if (status === "authenticated" && data) {
console.log("LOGGED")
router.push("/")
}
console.log("NOT LOGGED")
}, [status, data, router])
// useEffect(() => {
// console.log("USE EFFECT ")
// if (status === "authenticated" && data) {
// console.log("LOGGED")
// router.push("/")
// }
// console.log("NOT LOGGED")
// }, [status, data, router])

// TODO export this function as a custom hook as `useValidateEmail()` so it can be used to the signup page as well
const validateEmail = () => {
Expand All @@ -45,8 +45,8 @@ export default function SignInForm() {

const submitLogin = (e: FormEvent<HTMLFormElement>) => {
e.preventDefault()
signIn("credentials", { email, password, redirect: false })
router.push("/")
// signIn("credentials", { email, password, redirect: false })
// router.push("/")
}

return (
Expand Down Expand Up @@ -123,7 +123,7 @@ export default function SignInForm() {
value={password}
onChange={(e) => setPassword(e.target.value)}
/>
<Button type="submit">Login</Button>
<Button type="submit">Login</Button>
<Button onClick={() => setEmailEntered(false)}>Previous</Button>
</div>
</form>
Expand Down
6 changes: 5 additions & 1 deletion apps/website/src/app/signin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ export const metadata: Metadata = {
}

export default function SignIn() {
return <SignInForm />
return (
<div>
<SignInForm />
</div>
)
}
28 changes: 14 additions & 14 deletions apps/website/src/app/signup/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ export default function SignUp() {

const submitRegister = async (e: FormEvent<HTMLFormElement>) => {
e.preventDefault()
const response = await fetch("/api/register", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
username: username,
email: email,
password: password
})
})
const user = await response.json()
console.log(user)
router.push("/signin")
// const response = await fetch("/api/register", {
// method: "POST",
// headers: {
// "Content-Type": "application/json"
// },
// body: JSON.stringify({
// username: username,
// email: email,
// password: password
// })
// })
// const user = await response.json()
// console.log(user)
// router.push("/signin")
}

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/base/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default function Footer() {
return (
<div className="relative">
<footer>
<section className="flex justify-between px-12 py-6 mx-auto max-w-screen-2xl">
<section className="flex justify-between px-12 pb-6 pt-48 mx-auto max-w-screen-2xl">
<div className="flex flex-col justify-between w-fit">
<div className="flex flex-col">
<Link href="/">
Expand Down
6 changes: 3 additions & 3 deletions apps/website/src/context/Providers.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client"

import { SessionProvider } from "next-auth/react"
// import { SessionProvider } from "next-auth/react"
import { SidebarProvider } from "./NavbarProvider"
import { ThemeProvider } from "./ThemeProvider"

Expand All @@ -10,10 +10,10 @@ export default function Providers({
children?: React.ReactNode
}) {
return (
<SessionProvider>
// <SessionProvider>
<ThemeProvider>
<SidebarProvider>{children}</SidebarProvider>
</ThemeProvider>
</SessionProvider>
// </SessionProvider>
)
}
Loading

0 comments on commit 855531a

Please sign in to comment.