65 lines
1.6 KiB
JavaScript
65 lines
1.6 KiB
JavaScript
import Head from "next/head";
|
|
import styles from "../styles/Home.module.css";
|
|
import Header from "./templates/header";
|
|
import Generator from "./templates/generator";
|
|
import Nav from "./templates/nav";
|
|
import Content from "./templates/content";
|
|
import Footer from "./templates/footer";
|
|
import { useState } from "react";
|
|
import { useSession, signIn, signOut } from "next-auth/react";
|
|
import { Button } from "evergreen-ui";
|
|
|
|
export default function Home() {
|
|
const { data: session } = useSession();
|
|
|
|
if (session) {
|
|
return (
|
|
<div className={styles.container}>
|
|
<Head>
|
|
<title>Wastpol</title>
|
|
<meta name="description" content="Wastpol" />
|
|
<link rel="icon" href="/icon.png" />
|
|
</Head>
|
|
<div className="flex justify-between">
|
|
<Nav />
|
|
<div className="flex">
|
|
<h3 className="px-3 py-2 place-self-end">
|
|
Zalogowano jako {session.user.email}
|
|
</h3>
|
|
<Button onClick={() => signOut()} className="place-self-end">
|
|
Wyloguj
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
|
|
<main className={styles.main}>
|
|
<Header />
|
|
<Generator />
|
|
</main>
|
|
<Footer />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="grid place-items-center h-screen">
|
|
<Head>
|
|
<title>Wastpol</title>
|
|
<meta name="description" content="Wastpol" />
|
|
<link rel="icon" href="/icon.png" />
|
|
</Head>
|
|
<div className="flex flex-col justify-center">
|
|
<h2 className="p-2">Nie zalogowano</h2>
|
|
<br></br>
|
|
<Button
|
|
onClick={() => signIn()}
|
|
appearance="primary"
|
|
// className="p-2 bg-slate-200 rounded-md"
|
|
>
|
|
Zaloguj
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|