import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import {
Outlet,
createRootRouteWithContext,
useRouter,
HeadContent,
Scripts,
} from "@tanstack/react-router";
import { useEffect, type ReactNode } from "react";
import appCss from "../styles.css?url";
import { reportLovableError } from "../lib/lovable-error-reporting";
import { SiteHeader } from "@/components/SiteHeader";
import { SiteFooter } from "@/components/SiteFooter";
function NotFoundComponent() {
return (
404
Page not found
The page you're looking for doesn't exist or has been moved.
);
}
function ErrorComponent({ error, reset }: { error: Error; reset: () => void }) {
console.error(error);
const router = useRouter();
useEffect(() => {
reportLovableError(error, { boundary: "tanstack_root_error_component" });
}, [error]);
return (
This page didn't load
Something went wrong on our end. You can try refreshing or head back home.
Go home
);
}
export const Route = createRootRouteWithContext<{ queryClient: QueryClient }>()({
head: () => ({
meta: [
{ charSet: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{ title: "SafeSight — Eyes on the Road. Always." },
{ name: "description", content: "SafeSight monitors your driving focus and sends real-time alerts to prevent distracted driving accidents. Drive safer, arrive alive." },
{ property: "og:title", content: "SafeSight — Eyes on the Road. Always." },
{ property: "og:description", content: "SafeSight monitors your driving focus and sends real-time alerts to prevent distracted driving accidents." },
{ property: "og:type", content: "website" },
{ property: "og:site_name", content: "SafeSight" },
{ name: "twitter:card", content: "summary_large_image" },
{ name: "twitter:site", content: "@safesight" },
],
links: [
{ rel: "stylesheet", href: appCss },
{ rel: "icon", type: "image/png", href: "/favicon.png" },
],
scripts: [
{
type: "application/ld+json",
children: JSON.stringify({
"@context": "https://schema.org",
"@type": "Organization",
name: "SafeSight",
description: "Driver safety app that monitors focus and prevents distracted driving",
url: "/",
logo: "/logo.png",
sameAs: [],
}),
},
],
}),
shellComponent: RootShell,
component: RootComponent,
notFoundComponent: NotFoundComponent,
errorComponent: ErrorComponent,
});
function RootShell({ children }: { children: ReactNode }) {
return (
{children}
);
}
function RootComponent() {
const { queryClient } = Route.useRouteContext();
return (
);
}