mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 01:21:48 +03:00
34 lines
720 B
TypeScript
34 lines
720 B
TypeScript
"use client";
|
|
import { usePathname, useRouter } from "next/navigation";
|
|
import { ReactNode, useEffect, useState } from "react";
|
|
|
|
interface LayoutProps {
|
|
children?: ReactNode;
|
|
}
|
|
|
|
const Layout = ({ children }: LayoutProps): JSX.Element => {
|
|
const pathname = usePathname();
|
|
const router = useRouter();
|
|
const [isLoading, setIsLoading] = useState(true);
|
|
|
|
useEffect(() => {
|
|
if (pathname === "/chat") {
|
|
router.push("/search");
|
|
} else {
|
|
setIsLoading(false);
|
|
}
|
|
}, [pathname, router]);
|
|
|
|
if (isLoading) {
|
|
return <></>;
|
|
}
|
|
|
|
return (
|
|
<div className="relative h-full w-full flex justify-stretch items-stretch overflow-auto">
|
|
{children}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Layout;
|