import { Outlet, useLocation } from "react-router";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Toaster } from "@/components/ui/sonner";
import Providers from "./Providers";
export default function DefaultLayout() {
	const { pathname } = useLocation();
	if (pathname !== "/") {
		const preloader = document.getElementById("preloader");
		if (preloader) {
			preloader.classList.add("hidden");
		}
	}
	return (
		<Providers>
			<ScrollArea className="h-svh w-full">
				<div className="grid min-h-svh grid-rows-[auto_1fr]">
					<Outlet />
				</div>
				<ScrollBar orientation="vertical" />
			</ScrollArea>
			<Toaster richColors />
		</Providers>
	);
}
