2025-09-30 22:38:25 -04:00
// app/page.tsx
import { cookies } from "next/headers" ;
import { redirect } from "next/navigation" ;
import SignIn from "@/app/auth/sign-in/sign-in" ;
import SignUp from "@/app/auth/sign-up/sign-up" ;
2025-10-02 14:21:12 -04:00
import { isJwtValid } from "@/lib/jwt" ;
2025-09-30 22:38:25 -04:00
2025-10-02 14:21:12 -04:00
type SearchParams = { [ key : string ] : string | string [ ] | undefined } ;
export default async function HomePage ( {
searchParams ,
} : {
searchParams? : SearchParams ;
} ) {
// If already signed in with a VALID token, go straight to the app
2025-09-30 22:38:25 -04:00
const ck = await cookies ( ) ;
const at = ck . get ( "ma_at" ) ? . value ;
2025-10-02 14:21:12 -04:00
if ( isJwtValid ( at ) ) redirect ( "/portal" ) ;
const reauth = searchParams ? . reauth === "1" ;
2025-09-22 10:37:53 -04:00
return (
2025-09-30 22:38:25 -04:00
< main className = "mx-auto max-w-5xl px-4 py-12" >
2025-10-02 14:21:12 -04:00
{ reauth && (
< p className = "mb-6 rounded-md border bg-yellow-50 p-3 text-sm text-yellow-900" >
Your session expired . Please sign in again .
< / p >
) }
2025-09-30 22:38:25 -04:00
< section className = "mb-10 text-center" >
< h1 className = "text-3xl font-bold tracking-tight" > MakeArmy < / h1 >
< p className = "mt-2 text-base text-muted-foreground" >
2025-10-02 14:21:12 -04:00
Free to use . Manage laser rigs , settings , and projects — all in one
place .
2025-09-30 22:38:25 -04:00
< / p >
< / section >
< section className = "grid gap-6 md:grid-cols-2" >
< div className = "rounded-lg border p-6" >
< h2 className = "mb-3 text-lg font-semibold" > Create an account < / h2 >
{ /* Uses your existing sign-up component */ }
< SignUp nextPath = "/portal" / >
< / div >
< div className = "rounded-lg border p-6" >
< h2 className = "mb-3 text-lg font-semibold" > Sign in < / h2 >
{ /* Uses your existing sign-in component */ }
2025-10-02 14:21:12 -04:00
< SignIn nextPath = "/portal" reauth = { reauth } / >
2025-09-30 22:38:25 -04:00
< / div >
< / section >
< section className = "mt-8 text-center text-xs text-muted-foreground" >
2025-10-03 07:11:42 -04:00
This is the production build v0 . 0.1 - this site is an active BETA . Some features may not be available or work as intended . If you ' re experiencing issues please report them here : https : //forge.makearmy.io/makearmy/makearmy-app/issues PRIVACY: We only use cookies strictly necessary to operate the site (e.g., your sign-in session). We do not store user data or telemetry other than what you provide and never share or sell data to third parties. Ever.
2025-09-30 22:38:25 -04:00
< / section >
2025-09-22 10:37:53 -04:00
< / main >
) ;
}