2025-09-13 22:02:27 +01:00
|
|
|
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"
|
|
|
|
import { Toaster } from "@/components/ui/sonner"
|
|
|
|
import DashboardSidebar from "@/dashboard/dashboard-sidebar"
|
|
|
|
import "@/styles/globals.css"
|
2025-09-14 10:59:49 +00:00
|
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
|
2025-09-14 18:12:29 +00:00
|
|
|
import { createRootRoute, Outlet } from "@tanstack/react-router"
|
2025-09-14 10:59:49 +00:00
|
|
|
import { TanStackRouterDevtools } from "@tanstack/router-devtools"
|
2025-09-13 22:02:27 +01:00
|
|
|
import { ConvexProvider, ConvexReactClient } from "convex/react"
|
2025-09-14 18:12:29 +00:00
|
|
|
import { toast } from "sonner"
|
|
|
|
import { formatError } from "@/lib/error"
|
2025-09-13 22:02:27 +01:00
|
|
|
|
|
|
|
export const Route = createRootRoute({
|
|
|
|
component: RootLayout,
|
|
|
|
})
|
|
|
|
|
|
|
|
const convexClient = new ConvexReactClient(process.env.BUN_PUBLIC_CONVEX_URL!)
|
2025-09-14 18:12:29 +00:00
|
|
|
const queryClient = new QueryClient({
|
|
|
|
defaultOptions: {
|
|
|
|
mutations: {
|
|
|
|
onError: (error) => {
|
|
|
|
console.log(error)
|
|
|
|
toast.error(formatError(error))
|
|
|
|
},
|
|
|
|
throwOnError: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
2025-09-13 22:02:27 +01:00
|
|
|
|
|
|
|
function RootLayout() {
|
|
|
|
return (
|
2025-09-14 10:59:49 +00:00
|
|
|
<QueryClientProvider client={queryClient}>
|
|
|
|
<ConvexProvider client={convexClient}>
|
|
|
|
<SidebarProvider>
|
|
|
|
<div className="flex h-screen w-full">
|
|
|
|
<DashboardSidebar />
|
|
|
|
<SidebarInset>
|
|
|
|
<Outlet />
|
|
|
|
</SidebarInset>
|
|
|
|
</div>
|
|
|
|
<Toaster />
|
|
|
|
<TanStackRouterDevtools />
|
|
|
|
</SidebarProvider>
|
|
|
|
</ConvexProvider>
|
|
|
|
</QueryClientProvider>
|
2025-09-13 22:02:27 +01:00
|
|
|
)
|
|
|
|
}
|