23 lines
710 B
TypeScript
23 lines
710 B
TypeScript
"use client"
|
|
|
|
import { AuthGuard } from "@/components/auth-guard"
|
|
import { Header } from "@/components/header"
|
|
import { usePathname } from "next/navigation"
|
|
|
|
export default function OrderLayout({ children }: { children: React.ReactNode }) {
|
|
const pathname = usePathname()
|
|
const protectedPathPrefixes = ["/orders", "/order", "/chat", "/dispute", "/review"]
|
|
const shouldGuard = protectedPathPrefixes.some(
|
|
(prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`),
|
|
)
|
|
|
|
return (
|
|
<div className="flex min-h-screen flex-col">
|
|
<Header />
|
|
<main className="flex-1 bg-muted/30">
|
|
{shouldGuard ? <AuthGuard>{children}</AuthGuard> : children}
|
|
</main>
|
|
</div>
|
|
)
|
|
}
|