-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a8b6a9
commit ec5867c
Showing
20 changed files
with
234 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
GOOGLE_CLIENT_ID=692432207293-9pj9dlm4n6fu81s5r5bj3a14qmevc79h.apps.googleusercontent.com | ||
GOOGLE_CLIENT_SECRET=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 | ||
NEXTAUTH_SECRET=my_ultra_secure_nextauth_secret | ||
NEXTAUTH_URL=http://localhost:3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import NextAuth, { NextAuthOptions } from "next-auth"; | ||
import GoogleProvider from "next-auth/providers/google"; | ||
|
||
export const authOptions: NextAuthOptions = { | ||
providers: [ | ||
GoogleProvider({ | ||
clientId: process.env.GOOGLE_CLIENT_ID as string, | ||
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string, | ||
}), | ||
], | ||
}; | ||
|
||
const handler = NextAuth(authOptions); | ||
|
||
export { handler as GET, handler as POST }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/applications/Authentication/Ui/AuthenticationFirewall.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"use client"; | ||
|
||
import { SessionProvider } from "next-auth/react"; | ||
|
||
export interface AuthenticationFirewallProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
const AuthenticationFirewall = ({ children }: AuthenticationFirewallProps) => { | ||
return <SessionProvider>{children}</SessionProvider>; | ||
}; | ||
|
||
export default AuthenticationFirewall; |
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
src/applications/Authentication/Ui/SigninButton/SigninButtonBase.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"use client"; | ||
|
||
import useSignInModal from "~/applications/Authentication/Ui/useSigninModal"; | ||
|
||
const SigninButtonBase = () => { | ||
const { SignInModal, setShowSignInModal } = useSignInModal(); | ||
|
||
return ( | ||
<> | ||
<button | ||
type="button" | ||
onClick={() => setShowSignInModal(true)} | ||
className="rounded-full text-white bg-black px-5 py-2" | ||
> | ||
Sign in | ||
</button> | ||
<SignInModal /> | ||
</> | ||
); | ||
}; | ||
|
||
export default SigninButtonBase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { getServerSession } from "next-auth"; | ||
import Image from "next/image"; | ||
import { authOptions } from "~/app/api/auth/[...nextauth]/route"; | ||
import SigninButtonBase from "~/applications/Authentication/Ui/SigninButton/SigninButtonBase"; | ||
|
||
const SigninButton = async () => { | ||
const session = await getServerSession(authOptions); | ||
|
||
return session?.user ? ( | ||
<Image | ||
src={session.user.image ?? ""} | ||
alt="" | ||
width={30} | ||
height={30} | ||
className="rounded-full" | ||
style={{ width: "auto", height: "auto" }} | ||
/> | ||
) : ( | ||
<SigninButtonBase /> | ||
); | ||
}; | ||
|
||
export default SigninButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"use client"; | ||
|
||
import { useCallback, useMemo, useState } from "react"; | ||
import SignInModal from "~/applications/Authentication/Ui/SigninModal"; | ||
|
||
const useSignInModal = () => { | ||
const [showSignInModal, setShowSignInModal] = useState(false); | ||
|
||
const SignInModalCallback = useCallback(() => { | ||
return <SignInModal showSignInModal={showSignInModal} setShowSignInModal={setShowSignInModal} />; | ||
}, [showSignInModal]); | ||
|
||
return useMemo(() => ({ setShowSignInModal, SignInModal: SignInModalCallback }), [SignInModalCallback]); | ||
}; | ||
|
||
export default useSignInModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
export default function Google({ className }: { className: string }) { | ||
return ( | ||
<svg viewBox="0 0 186.69 190.5" className={className}> | ||
<title>Google</title> | ||
<g transform="translate(1184.583 765.171)"> | ||
<path | ||
clip-path="none" | ||
mask="none" | ||
d="M-1089.333-687.239v36.888h51.262c-2.251 11.863-9.006 21.908-19.137 28.662l30.913 23.986c18.011-16.625 28.402-41.044 28.402-70.052 0-6.754-.606-13.249-1.732-19.483z" | ||
fill="#4285f4" | ||
/> | ||
<path | ||
clip-path="none" | ||
mask="none" | ||
d="M-1142.714-651.791l-6.972 5.337-24.679 19.223h0c15.673 31.086 47.796 52.561 85.03 52.561 25.717 0 47.278-8.486 63.038-23.033l-30.913-23.986c-8.486 5.715-19.31 9.179-32.125 9.179-24.765 0-45.806-16.712-53.34-39.226z" | ||
fill="#34a853" | ||
/> | ||
<path | ||
clip-path="none" | ||
mask="none" | ||
d="M-1174.365-712.61c-6.494 12.815-10.217 27.276-10.217 42.689s3.723 29.874 10.217 42.689c0 .086 31.693-24.592 31.693-24.592-1.905-5.715-3.031-11.776-3.031-18.098s1.126-12.383 3.031-18.098z" | ||
fill="#fbbc05" | ||
/> | ||
<path | ||
d="M-1089.333-727.244c14.028 0 26.497 4.849 36.455 14.201l27.276-27.276c-16.539-15.413-38.013-24.852-63.731-24.852-37.234 0-69.359 21.388-85.032 52.561l31.692 24.592c7.533-22.514 28.575-39.226 53.34-39.226z" | ||
fill="#ea4335" | ||
clip-path="none" | ||
mask="none" | ||
/> | ||
</g> | ||
</svg> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.loading { | ||
display: inline-flex; | ||
align-items: center; | ||
} | ||
|
||
.loading .spacer { | ||
margin-right: 2px; | ||
} | ||
|
||
.loading span { | ||
animation-name: blink; | ||
animation-duration: 1.4s; | ||
animation-iteration-count: infinite; | ||
animation-fill-mode: both; | ||
width: 5px; | ||
height: 5px; | ||
border-radius: 50%; | ||
display: inline-block; | ||
margin: 0 1px; | ||
} | ||
|
||
.loading span:nth-of-type(2) { | ||
animation-delay: 0.2s; | ||
} | ||
|
||
.loading span:nth-of-type(3) { | ||
animation-delay: 0.4s; | ||
} | ||
|
||
@keyframes blink { | ||
0% { | ||
opacity: 0.2; | ||
} | ||
20% { | ||
opacity: 1; | ||
} | ||
100% { | ||
opacity: 0.2; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import styles from "~/components/Loader/LoadingDot.module.css"; | ||
|
||
const LoadingDots = ({ color = "#000" }: { color?: string }) => { | ||
return ( | ||
<span className={styles.loading}> | ||
<span style={{ backgroundColor: color }} /> | ||
<span style={{ backgroundColor: color }} /> | ||
<span style={{ backgroundColor: color }} /> | ||
</span> | ||
); | ||
}; | ||
|
||
export default LoadingDots; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export type Route = string; | ||
|
||
export const pcomparatorHomepageRoute = (): Route => { | ||
return "/"; | ||
}; |
Oops, something went wrong.