From db122bcf59cc32029d67dcf99109f1a76c695069 Mon Sep 17 00:00:00 2001
From: Bart van der Braak
Date: Tue, 13 Jun 2023 00:09:59 +0200
Subject: [PATCH] feat: Revamped Authentication layer with Clerk
---
.env.example | 4 ++++
app/(authenticated)/layout.tsx | 30 +----------------------------
app/layout.tsx | 13 +++++++++----
app/sign-in/[[...sign-in]]/page.tsx | 19 ++++++++++++++++++
app/sign-up/[[...sign-up]]/page.tsx | 19 ++++++++++++++++++
components/landing/ui/header.tsx | 2 +-
6 files changed, 53 insertions(+), 34 deletions(-)
create mode 100644 app/sign-in/[[...sign-in]]/page.tsx
create mode 100644 app/sign-up/[[...sign-up]]/page.tsx
diff --git a/.env.example b/.env.example
index eacd76b..f768022 100644
--- a/.env.example
+++ b/.env.example
@@ -1,2 +1,6 @@
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
+NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
+NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
+NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/overview
+NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/overview
diff --git a/app/(authenticated)/layout.tsx b/app/(authenticated)/layout.tsx
index e6eed60..026814a 100644
--- a/app/(authenticated)/layout.tsx
+++ b/app/(authenticated)/layout.tsx
@@ -1,31 +1,3 @@
-import { Particles } from "@/components/landing/particles";
-import {
- ClerkProvider,
- SignIn,
- SignedIn,
- SignedOut,
-} from "@clerk/nextjs/app-beta";
-
export default function AppLayout({ children }: { children: React.ReactNode }) {
- return (
-
- {children}
-
-
-
-
- );
+ return children;
}
diff --git a/app/layout.tsx b/app/layout.tsx
index ea03a49..fc5acac 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -6,6 +6,7 @@ import "tailwindcss/tailwind.css";
import { ToastProvider } from "../toast-provider";
import { Metadata } from "next";
+import { ClerkProvider } from "@clerk/nextjs/app-beta";
export const metadata: Metadata = {
title: {
@@ -67,11 +68,15 @@ export default async function RootLayout({ children }: RootLayoutProps) {
suppressHydrationWarning
className={[inter.variable, calSans.variable].join(" ")}
>
-
+
+
+
-
- {children}
-
+
+
+ {children}
+
+
>
diff --git a/app/sign-in/[[...sign-in]]/page.tsx b/app/sign-in/[[...sign-in]]/page.tsx
new file mode 100644
index 0000000..34d6f3b
--- /dev/null
+++ b/app/sign-in/[[...sign-in]]/page.tsx
@@ -0,0 +1,19 @@
+import { Particles } from "@/components/landing/particles";
+import { SignIn } from "@clerk/nextjs/app-beta";
+
+export default function Page() {
+ return (
+
+ );
+}
diff --git a/app/sign-up/[[...sign-up]]/page.tsx b/app/sign-up/[[...sign-up]]/page.tsx
new file mode 100644
index 0000000..a1bcabb
--- /dev/null
+++ b/app/sign-up/[[...sign-up]]/page.tsx
@@ -0,0 +1,19 @@
+import { Particles } from "@/components/landing/particles";
+import { SignUp } from "@clerk/nextjs/app-beta";
+
+export default function Page() {
+ return (
+
+ );
+}
diff --git a/components/landing/ui/header.tsx b/components/landing/ui/header.tsx
index 711863a..c93f0bf 100644
--- a/components/landing/ui/header.tsx
+++ b/components/landing/ui/header.tsx
@@ -17,7 +17,7 @@ export const Header: React.FC = () => {
Sign in