mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-21 10:21:54 +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;
|