diff --git a/ntc-web/app/AuthLayout.tsx b/ntc-web/app/AuthLayout.tsx new file mode 100644 index 0000000..4bcb37d --- /dev/null +++ b/ntc-web/app/AuthLayout.tsx @@ -0,0 +1,15 @@ +'use client' + +import { usePathname } from 'next/navigation' +import LayoutClient from './LayoutClient' + +export default function AuthLayout({ children }: { children: React.ReactNode }) { + const pathname = usePathname() + const isAuthPage = pathname === '/sign-in' || pathname === '/sign-up' + + if (isAuthPage) { + return children + } + + return {children} +} \ No newline at end of file diff --git a/ntc-web/app/layout.tsx b/ntc-web/app/layout.tsx index 0ebced7..f478a95 100644 --- a/ntc-web/app/layout.tsx +++ b/ntc-web/app/layout.tsx @@ -3,11 +3,8 @@ import './globals.css' import LayoutClient from './LayoutClient' import { ClerkProvider, - SignInButton, - SignedIn, - SignedOut, - UserButton } from '@clerk/nextjs' +import AuthLayout from './AuthLayout' // Add this import const inter = Inter({ subsets: ['latin'] }) @@ -21,9 +18,9 @@ export default function RootLayout({
- + {children} - +
diff --git a/ntc-web/app/sign-in/[[...sign-in]]/page.tsx b/ntc-web/app/sign-in/[[...sign-in]]/page.tsx new file mode 100644 index 0000000..8f5f18c --- /dev/null +++ b/ntc-web/app/sign-in/[[...sign-in]]/page.tsx @@ -0,0 +1,61 @@ +'use client'; + +import { SignIn } from '@clerk/nextjs'; +import { useRouter, useSearchParams } from 'next/navigation'; +import Image from 'next/image'; + +export default function SignInPage() { + const router = useRouter(); + const searchParams = useSearchParams(); + const redirectUrl = searchParams.get('redirect_url') || '/dashboard'; + const currentYear = new Date().getFullYear(); + + return ( +
+
+
+
+
+
+
+ Logo +
+
+

Nautilus MVP Sign In

+
+ +
+
+
+ + +
+ ); +} \ No newline at end of file diff --git a/ntc-web/app/sign-up/[[...sign-up]]/page.tsx b/ntc-web/app/sign-up/[[...sign-up]]/page.tsx new file mode 100644 index 0000000..f30e6a3 --- /dev/null +++ b/ntc-web/app/sign-up/[[...sign-up]]/page.tsx @@ -0,0 +1,76 @@ +'use client'; + +import { SignUp } from "@clerk/nextjs"; +import Image from "next/image"; + +export default function SignUpPage() { + const currentYear = new Date().getFullYear(); + + return ( +
+
+
+
+
+
+
+ Logo +
+
+

Create Account

+
+ + + +
+ Already have an account? + + Sign In + +
+
+
+
+ + +
+ ); +} \ No newline at end of file diff --git a/ntc-web/middleware.ts b/ntc-web/middleware.ts index 3c977e9..646e776 100644 --- a/ntc-web/middleware.ts +++ b/ntc-web/middleware.ts @@ -1,6 +1,12 @@ -import { clerkMiddleware } from "@clerk/nextjs/server"; +import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server' -export default clerkMiddleware(); +const isPublicRoute = createRouteMatcher(['/sign-in(.*)', '/sign-up(.*)']) + +export default clerkMiddleware(async (auth, request) => { + if (!isPublicRoute(request)) { + await auth.protect() + } +}) export const config = { matcher: [ @@ -9,4 +15,4 @@ export const config = { // Always run for API routes '/(api|trpc)(.*)', ], -}; \ No newline at end of file +} \ No newline at end of file diff --git a/ntc-web/sign-in/[[...sign-in]]/page.tsx b/ntc-web/sign-in/[[...sign-in]]/page.tsx deleted file mode 100644 index 4dba57a..0000000 --- a/ntc-web/sign-in/[[...sign-in]]/page.tsx +++ /dev/null @@ -1,47 +0,0 @@ -'use client'; - -import { SignIn } from '@clerk/nextjs'; -import { useRouter, useSearchParams } from 'next/navigation'; -import Image from 'next/image'; - -export default function SignInPage() { - const router = useRouter(); - const searchParams = useSearchParams(); - const redirectUrl = searchParams.get('redirect_url') || '/dashboard'; // Default to '/dashboard' - - return ( -
-
-
-
-
-
- Logo -
-
-

Sign In

-
- -
- Don't have an account? - - Sign Up - -
-
-
-
- ); -} diff --git a/ntc-web/sign-up/[[...sign-up]]/page.tsx b/ntc-web/sign-up/[[...sign-up]]/page.tsx deleted file mode 100644 index 8fb650b..0000000 --- a/ntc-web/sign-up/[[...sign-up]]/page.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { SignUp } from "@clerk/nextjs"; -import Image from "next/image"; - -export default function SignUpPage() { - return ( -
-
-
-
-
-
- Logo -
-
-

Create Account

-
- - - -
- Already have an account? - - Sign In - -
-
-
-
- ); -} \ No newline at end of file