NextJSNetflix/pages/profiles.tsx

48 lines
1.7 KiB
TypeScript
Raw Normal View History

2023-06-26 14:50:04 +00:00
import useCurrentUser from "@/hooks/useCurrentUser";
2023-06-04 12:33:10 +00:00
import { NextPageContext } from "next"
import { getSession } from "next-auth/react"
2023-06-26 14:50:04 +00:00
import { useRouter } from "next/router";
2023-06-04 12:33:10 +00:00
export async function getServerSideProps(context: NextPageContext){
const session = await getSession(context);
if(!session){
return{
redirect: {
destination: '/auth',
permanent: false
}
}
}
return {
props: {}
}
}
function Profiles() {
2023-06-26 14:50:04 +00:00
const router = useRouter();
const { data:user } = useCurrentUser();
2023-06-04 12:33:10 +00:00
return (
2023-06-26 14:50:04 +00:00
<div className="flex items-center h-full justify-center">
<div className="flex flex-col">
<h1 className="text-3xl md:text-6xl text-white text-center">Chi sta guardando? </h1>
<div className="flex items-center justify-center gap-8 mt-10">
<div onClick={() => router.push('/')}>
<div className="group flex-row w-44 mx-auto">
<div className="w-44 h-44 rounded-md flex items-center justify-center border-2 border-transparent group-hover:cursor-pointer group:hover:border-white overflow-hidden">
<img src="https://api.dicebear.com/6.x/fun-emoji/svg?seed=Michael" alt="Profilo" />
</div>
<div className="mt-4 text-gray-400 text-2xl text-center group-hover:text-white group-hover:cursor-pointer">
{user?.name}
</div>
</div>
</div>
</div>
</div>
{/* https://api.dicebear.com/6.x/fun-emoji/svg?seed= */}
</div>
2023-06-04 12:33:10 +00:00
)
}
export default Profiles