diff options
Diffstat (limited to 'web/src/app')
| -rw-r--r-- | web/src/app/api/auth/[...nextauth]/route.js | 2 | ||||
| -rw-r--r-- | web/src/app/components/sign-in.jsx | 14 | ||||
| -rw-r--r-- | web/src/app/components/sign-out.jsx | 14 | ||||
| -rw-r--r-- | web/src/app/dashboard/page.js | 16 | ||||
| -rw-r--r-- | web/src/app/favicon.ico | bin | 0 -> 25931 bytes | |||
| -rw-r--r-- | web/src/app/globals.css | 26 | ||||
| -rw-r--r-- | web/src/app/layout.js | 29 | ||||
| -rw-r--r-- | web/src/app/page.js | 15 |
8 files changed, 116 insertions, 0 deletions
diff --git a/web/src/app/api/auth/[...nextauth]/route.js b/web/src/app/api/auth/[...nextauth]/route.js new file mode 100644 index 0000000..5951f83 --- /dev/null +++ b/web/src/app/api/auth/[...nextauth]/route.js @@ -0,0 +1,2 @@ +import { handlers } from "@/lib/auth" +export const { GET, POST } = handlers diff --git a/web/src/app/components/sign-in.jsx b/web/src/app/components/sign-in.jsx new file mode 100644 index 0000000..bb891c7 --- /dev/null +++ b/web/src/app/components/sign-in.jsx @@ -0,0 +1,14 @@ +import { signIn } from "@/lib/auth" + +export default function SignIn() { + return ( + <form + action={async () => { + "use server" + await signIn("discord") + }} + > + <button type="submit">Login with Discord</button> + </form> + ) +} diff --git a/web/src/app/components/sign-out.jsx b/web/src/app/components/sign-out.jsx new file mode 100644 index 0000000..69162a4 --- /dev/null +++ b/web/src/app/components/sign-out.jsx @@ -0,0 +1,14 @@ +import { signOut } from "@/lib/auth" + +export default function SignOut() { + return ( + <form + action={async () => { + "use server" + await signOut("discord") + }} + > + <button type="submit">Log out</button> + </form> + ) +} diff --git a/web/src/app/dashboard/page.js b/web/src/app/dashboard/page.js new file mode 100644 index 0000000..065bfb0 --- /dev/null +++ b/web/src/app/dashboard/page.js @@ -0,0 +1,16 @@ +import { redirect } from "next/navigation"; +import { auth } from "@/lib/auth"; +import SignOut from "@/app/components/sign-out"; + +export default async function Home() { + const session = await auth(); + if (!session) redirect("/"); + + return ( + <div> + <h1>Dashboard</h1> + <p>Welcome {session.user?.name}</p> + <SignOut /> + </div> + ) +} diff --git a/web/src/app/favicon.ico b/web/src/app/favicon.ico Binary files differnew file mode 100644 index 0000000..718d6fe --- /dev/null +++ b/web/src/app/favicon.ico diff --git a/web/src/app/globals.css b/web/src/app/globals.css new file mode 100644 index 0000000..a2dc41e --- /dev/null +++ b/web/src/app/globals.css @@ -0,0 +1,26 @@ +@import "tailwindcss"; + +:root { + --background: #ffffff; + --foreground: #171717; +} + +@theme inline { + --color-background: var(--background); + --color-foreground: var(--foreground); + --font-sans: var(--font-geist-sans); + --font-mono: var(--font-geist-mono); +} + +@media (prefers-color-scheme: dark) { + :root { + --background: #0a0a0a; + --foreground: #ededed; + } +} + +body { + background: var(--background); + color: var(--foreground); + font-family: Arial, Helvetica, sans-serif; +} diff --git a/web/src/app/layout.js b/web/src/app/layout.js new file mode 100644 index 0000000..bec6c45 --- /dev/null +++ b/web/src/app/layout.js @@ -0,0 +1,29 @@ +import { Geist, Geist_Mono } from "next/font/google"; +import "./globals.css"; + +const geistSans = Geist({ + variable: "--font-geist-sans", + subsets: ["latin"], +}); + +const geistMono = Geist_Mono({ + variable: "--font-geist-mono", + subsets: ["latin"], +}); + +export const metadata = { + title: "AleeBot", + description: "Generated by create next app", +}; + +export default function RootLayout({ children }) { + return ( + <html lang="en"> + <body + className={`${geistSans.variable} ${geistMono.variable} antialiased`} + > + {children} + </body> + </html> + ); +} diff --git a/web/src/app/page.js b/web/src/app/page.js new file mode 100644 index 0000000..1890f99 --- /dev/null +++ b/web/src/app/page.js @@ -0,0 +1,15 @@ +import { redirect } from "next/navigation"; +import SignIn from "@/app/components/sign-in"; +import { auth } from "@/lib/auth"; + +export default async function Home() { + const session = await auth(); + if (session) redirect("/dashboard"); + return ( + <> + <main> + <SignIn /> + </main> + </> + ); +} |
