fiddy/apps/web/components/app-frame.tsx
2026-02-11 23:45:15 -08:00

27 lines
716 B
TypeScript

"use client";
import type React from "react";
import { usePathname } from "next/navigation";
import Navbar from "@/components/navbar";
const NO_NAVBAR_PATHS = new Set(["/login", "/register"]);
const NO_NAVBAR_PREFIXES = ["/invite"];
type AppFrameProps = {
children: React.ReactNode;
};
export default function AppFrame({ children }: AppFrameProps) {
const pathname = usePathname();
const hideNavbar = pathname
? NO_NAVBAR_PATHS.has(pathname) || NO_NAVBAR_PREFIXES.some(prefix => pathname.startsWith(prefix))
: false;
return (
<>
{hideNavbar ? null : <Navbar />}
<main className="mx-auto max-w-5xl px-4 py-6">{children}</main>
</>
);
}