import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import {
Outlet,
Link,
createRootRouteWithContext,
useRouter,
HeadContent,
Scripts,
} from "@tanstack/react-router";
import appCss from "../styles.css?url";
import { SiteHeader } from "@/components/site-header";
import { SiteFooter } from "@/components/site-footer";
import { ReviewsEmbed } from "@/components/reviews-embed";
function NotFoundComponent() {
return (
404
Page not found
That page doesn't exist, head home or give us a call.
);
}
function ErrorComponent({ error, reset }: { error: Error; reset: () => void }) {
console.error(error);
const router = useRouter();
return (
This page didn't load
Something went wrong. Try again or head home.
Go home
);
}
export const Route = createRootRouteWithContext<{ queryClient: QueryClient }>()({
head: () => ({
meta: [
{ charSet: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{ title: "O'Bray Electric, Master Electrician in Utah" },
{ name: "description", content: "Master Electrician serving Salt Lake, Tooele & Utah counties. Panel upgrades, EV chargers, lighting, repairs & more. Licensed & bonded." },
{ name: "author", content: "O'Bray Electric" },
{ property: "og:title", content: "O'Bray Electric, Master Electrician in Utah" },
{ property: "og:description", content: "Master Electrician serving Salt Lake, Tooele & Utah counties. Panel upgrades, EV chargers, lighting, repairs & more. Licensed & bonded." },
{ property: "og:type", content: "website" },
{ name: "twitter:card", content: "summary_large_image" },
{ name: "twitter:title", content: "O'Bray Electric, Master Electrician in Utah" },
{ name: "twitter:description", content: "Master Electrician serving Salt Lake, Tooele & Utah counties. Panel upgrades, EV chargers, lighting, repairs & more. Licensed & bonded." },
{ property: "og:image", content: "/_studio-media/cf47c69ce081f5b4.png" },
{ name: "twitter:image", content: "/_studio-media/cf47c69ce081f5b4.png" },
],
links: [
{ rel: "stylesheet", href: appCss },
{ rel: "preconnect", href: "https://fonts.googleapis.com" },
{ rel: "preconnect", href: "https://fonts.gstatic.com", crossOrigin: "anonymous" },
{ rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap" },
],
scripts: [
{
src: "https://widgets.leadconnectorhq.com/loader.js",
"data-resources-url": "https://widgets.leadconnectorhq.com/chat-widget/loader.js",
"data-widget-id": "6a107b91294a01e42fd8c020",
"data-source": "WEB_USER",
async: true,
},
{
type: "application/ld+json",
children: JSON.stringify({
"@context": "https://schema.org",
"@type": "Electrician",
name: "O'Bray Electric",
description: "Master Electrician serving Salt Lake, Tooele, and Utah counties. Panel upgrades, EV chargers, lighting, repairs, generators, and more.",
url: "/",
telephone: "+1-801-866-4217",
priceRange: "$$",
areaServed: [
{ "@type": "AdministrativeArea", name: "Salt Lake County, Utah" },
{ "@type": "AdministrativeArea", name: "Tooele County, Utah" },
{ "@type": "AdministrativeArea", name: "Utah County, Utah" },
],
address: { "@type": "PostalAddress", addressRegion: "UT", addressCountry: "US" },
}),
},
],
}),
shellComponent: RootShell,
component: RootComponent,
notFoundComponent: NotFoundComponent,
errorComponent: ErrorComponent,
});
function RootShell({ children }: { children: React.ReactNode }) {
return (
Root
{children}
);
}
function RootComponent() {
const { queryClient } = Route.useRouteContext();
const router = useRouter();
const pathname = router.state.location.pathname;
const skipReviews = pathname === "/" || pathname.startsWith("/services/");
return (
{!skipReviews && }
);
}