Migrate all shadcn components into apps/web/components/ui/ so the web app is fully independent from packages/ui for its UI layer. Update to the latest shadcn base-nova style. Add missing semantic color variables (success, warning, info, canvas), font-mono mapping, scrollbar styling, and wrap Select items in SelectGroup for proper padding. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
import { useRouter } from "next/navigation";
|
|
import { MulticaIcon } from "@/components/multica-icon";
|
|
import { SidebarProvider, SidebarInset } from "@/components/ui/sidebar";
|
|
import { useAuthStore } from "@/features/auth";
|
|
import { useWorkspaceStore } from "@/features/workspace";
|
|
import { AppSidebar } from "./_components/app-sidebar";
|
|
|
|
export default function DashboardLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
const router = useRouter();
|
|
const user = useAuthStore((s) => s.user);
|
|
const isLoading = useAuthStore((s) => s.isLoading);
|
|
const workspace = useWorkspaceStore((s) => s.workspace);
|
|
|
|
useEffect(() => {
|
|
if (!isLoading && !user) {
|
|
router.push("/login");
|
|
}
|
|
}, [user, isLoading, router]);
|
|
|
|
if (isLoading) {
|
|
return (
|
|
<div className="flex h-screen items-center justify-center">
|
|
<MulticaIcon className="size-6" />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (!user || !workspace) return null;
|
|
|
|
return (
|
|
<SidebarProvider>
|
|
<AppSidebar />
|
|
<SidebarInset className="overflow-hidden">{children}</SidebarInset>
|
|
</SidebarProvider>
|
|
);
|
|
}
|