MCPcopy Create free account
hub / github.com/code100x/daily-code / Signin

Function Signin

apps/web/components/Signin.tsx:10–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8import { motion } from "framer-motion";
9
10const Signin = () => {
11 const session = useSession();
12 const router = useRouter();
13 const searchParams = useSearchParams();
14
15 const redirected = useRef(false);
16 useEffect(() => {
17 if (redirected.current === false && session.data?.user) {
18 const redirectUrl = localStorage.getItem("loginRedirectUrl") || searchParams.get("redirectUrl");
19 localStorage.removeItem("loginRedirectUrl");
20 router.replace(redirectUrl || "/");
21 redirected.current = true;
22 }
23 }, [redirected, session, router]);
24
25 return (
26 <div className="flex flex-center h-screen">
27 <motion.div
28 initial={{ y: -40, opacity: 0 }}
29 animate={{ y: 0, opacity: 1 }}
30 transition={{ duration: 0.5, ease: "easeInOut", type: "spring", damping: 10 }}
31 className="flex flex-col gap-12 justify-between bg-primary/5 p-8 rounded-2xl border border-primary/10 shadow-xl shadow-primary/5 min-w-[30vw]"
32 >
33 <div className="flex flex-col gap-12">
34 <div className="flex flex-col text-center">
35 <h2 className="font-semibold text-3xl md:text-4xl tracking-tighter">
36 Welcome to{" "}
37 <span className="font-bold bg-gradient-to-b from-blue-400 to-blue-700 bg-clip-text text-transparent tracking-tighter">
38 100xProjects
39 </span>
40 </h2>
41 <p className="text-primary/75 font-medium tracking-tighter text-lg md:text-xl">
42 Log in to access paid content!
43 </p>
44 </div>
45 <div className="flex flex-col gap-4">
46 <div
47 className="w-full flex gap-2 p-4 font-medium md:text-lg rounded-xl hover:-translate-y-2 transition-all duration-300 cursor-pointer bg-gradient-to-b from-blue-400 to-blue-700 text-white justify-center items-center"
48 onClick={async () => {
49 await signIn("google");
50 }}
51 >
52 <svg
53 xmlns="http://www.w3.org/2000/svg"
54 viewBox="0 0 30 30"
55 fill="currentColor"
56 className="size-6 md:size-8 text-white"
57 >
58 <path d="M 15.003906 3 C 8.3749062 3 3 8.373 3 15 C 3 21.627 8.3749062 27 15.003906 27 C 25.013906 27 27.269078 17.707 26.330078 13 L 25 13 L 22.732422 13 L 15 13 L 15 17 L 22.738281 17 C 21.848702 20.448251 18.725955 23 15 23 C 10.582 23 7 19.418 7 15 C 7 10.582 10.582 7 15 7 C 17.009 7 18.839141 7.74575 20.244141 8.96875 L 23.085938 6.1289062 C 20.951937 4.1849063 18.116906 3 15.003906 3 z"></path>
59 </svg>
60 Continue with Google
61 </div>
62 <div
63 className="w-full flex gap-2 p-4 font-medium md:text-lg rounded-xl hover:-translate-y-2 transition-all duration-300 cursor-pointer bg-gradient-to-b from-blue-400 to-blue-700 text-white justify-center items-center"
64 onClick={async () => {
65 await signIn("github");
66 }}
67 >

Callers

nothing calls this directly

Calls 1

getMethod · 0.65

Tested by

no test coverage detected