Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions frontend/app/components/AppShell.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
"use client";

import { useMemo } from "react";
import { usePathname } from "next/navigation";

import CommandPalette from "./CommandPalette";
import Sidebar from "./Sidebar";
import TopNavbar from "./TopNavbar";

export default function AppShell({
children,
}: {
children: React.ReactNode;
}) {
const pathname = usePathname();

function getLayoutState(pathname: string | null) {
const isPublicRoute =
pathname === "/" ||
pathname === "/login" ||
Expand All @@ -24,11 +19,35 @@ export default function AppShell({
const hideSidebar =
isPublicRoute || isInsightsRoute;

// Insights pages manage their own spacing
const mainClass = hideSidebar
? "min-w-0 flex-1 overflow-x-hidden"
: "min-w-0 flex-1 overflow-x-hidden p-6";

return {
isPublicRoute,
isInsightsRoute,
hideSidebar,
mainClass,
};
}


export default function AppShell({
children,
}: {
children: React.ReactNode;
}) {
const pathname = usePathname();

const {
isPublicRoute,
hideSidebar,
mainClass,
} = useMemo(
() => getLayoutState(pathname),
[pathname]
);

return (
<div className="flex min-h-screen w-full bg-[#f5f7f2]">
<CommandPalette />
Expand Down
Loading