113 lines
2.4 KiB
TypeScript
113 lines
2.4 KiB
TypeScript
"use client";
|
|
|
|
import dynamic from "next/dynamic";
|
|
import { usePathname } from "next/navigation";
|
|
import type { User } from "next-auth";
|
|
import type { ChatShellChromeProps } from "@/components/chat-shell-chrome";
|
|
|
|
type CustomLink = {
|
|
id: string;
|
|
name: string;
|
|
url: string;
|
|
order: number;
|
|
toolboxGroup: number;
|
|
};
|
|
|
|
type TutorialVideo = {
|
|
id: string;
|
|
title: string;
|
|
videoUrl: string;
|
|
coverUrl: string | null;
|
|
description: string | null;
|
|
order: number;
|
|
};
|
|
|
|
type ChatShellProps = {
|
|
children: React.ReactNode;
|
|
user?: User;
|
|
siteName: string;
|
|
siteLogo?: string;
|
|
siteLogoDark?: string;
|
|
isAdmin: boolean;
|
|
settingsHref?: string | null;
|
|
customLinks: CustomLink[];
|
|
toolbox1Name: string;
|
|
toolbox1Enabled: boolean;
|
|
toolbox2Name: string;
|
|
toolbox2Enabled: boolean;
|
|
tutorialVideos: TutorialVideo[];
|
|
tutorialEnabled: boolean;
|
|
rankingEnabled: boolean;
|
|
productPlanningEnabled: boolean;
|
|
agentEnabled: boolean;
|
|
videoCanvasEnabled: boolean;
|
|
};
|
|
|
|
const ChatShellChrome = dynamic(
|
|
() =>
|
|
import("@/components/chat-shell-chrome").then(
|
|
(module) => module.ChatShellChrome
|
|
),
|
|
{
|
|
loading: () => <div className="h-svh w-full overflow-hidden" />,
|
|
ssr: false,
|
|
}
|
|
);
|
|
|
|
export function ChatShell({
|
|
children,
|
|
user,
|
|
siteName,
|
|
siteLogo,
|
|
siteLogoDark,
|
|
isAdmin,
|
|
settingsHref = null,
|
|
customLinks,
|
|
toolbox1Name,
|
|
toolbox1Enabled,
|
|
toolbox2Name,
|
|
toolbox2Enabled,
|
|
tutorialVideos,
|
|
tutorialEnabled,
|
|
rankingEnabled,
|
|
productPlanningEnabled,
|
|
agentEnabled,
|
|
videoCanvasEnabled,
|
|
}: ChatShellProps) {
|
|
const pathname = usePathname();
|
|
const isLovartHome = pathname === "/";
|
|
const isAiCadWorkspace = pathname === "/ai-cad";
|
|
const isFlowBoardWorkspace = pathname === "/flow-board";
|
|
|
|
if (isLovartHome) {
|
|
return <div className="h-svh w-full overflow-y-auto">{children}</div>;
|
|
}
|
|
|
|
if (isAiCadWorkspace || isFlowBoardWorkspace) {
|
|
return <div className="h-svh w-full overflow-hidden">{children}</div>;
|
|
}
|
|
|
|
const chromeProps: ChatShellChromeProps = {
|
|
agentEnabled,
|
|
children,
|
|
customLinks,
|
|
isAdmin,
|
|
productPlanningEnabled,
|
|
rankingEnabled,
|
|
settingsHref,
|
|
siteLogo,
|
|
siteLogoDark,
|
|
siteName,
|
|
toolbox1Enabled,
|
|
toolbox1Name,
|
|
toolbox2Enabled,
|
|
toolbox2Name,
|
|
tutorialEnabled,
|
|
tutorialVideos,
|
|
user,
|
|
videoCanvasEnabled,
|
|
};
|
|
|
|
return <ChatShellChrome {...chromeProps} />;
|
|
}
|