Open History to see the last commit
1/// <reference types="vite/client" />
2import {
3 HeadContent,
4 Link,
5 Scripts,
6 createRootRoute,
7} from '@tanstack/react-router'
8import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
9import { QueryClientProvider } from '@tanstack/react-query'
10import * as React from 'react'
11import appCss from '~/styles/app.css?url'
12import { queryClient } from '~/utils/queryClient'
13
14export const Route = createRootRoute({
15 head: () => ({
16 meta: [
17 {
18 charSet: `utf-8`,
19 },
20 {
21 name: `viewport`,
22 content: `width=device-width, initial-scale=1`,
23 },
24 ],
25 links: [{ rel: `stylesheet`, href: appCss }],
26 }),
27 shellComponent: RootDocument,
28})
29
30function RootDocument({ children }: { children: React.ReactNode }) {
31 return (
32 <html>
33 <head>
34 <HeadContent />
35 </head>
36 <body>
37 <QueryClientProvider client={queryClient}>
38 <div className="bg-white shadow-sm border-b">
39 <div className="max-w-4xl mx-auto px-6 py-4">
40 <div className="flex items-center justify-between">
41 <div className="flex items-center gap-2">
42 <span className="text-2xl">⚡</span>
43 <span className="text-xl font-bold text-gray-900">
44 TanStack Offline Transactions
45 </span>
46 </div>
47 <div className="flex gap-6 text-sm">
48 <Link
49 to="/"
50 activeProps={{
51 className: `font-bold text-blue-600`,
52 }}
53 activeOptions={{ exact: true }}
54 className="text-gray-600 hover:text-gray-900"
55 >
56 Home
57 </Link>
58 <Link
59 to="/indexeddb"
60 activeProps={{
61 className: `font-bold text-blue-600`,
62 }}
63 className="text-gray-600 hover:text-gray-900"
64 >
65 🗄️ IndexedDB
66 </Link>
67 <Link
68 to="/localstorage"
69 activeProps={{
70 className: `font-bold text-blue-600`,
71 }}
72 className="text-gray-600 hover:text-gray-900"
73 >
74 💾 localStorage
75 </Link>
76 <Link
77 to="/wa-sqlite"
78 activeProps={{
79 className: `font-bold text-blue-600`,
80 }}
81 className="text-gray-600 hover:text-gray-900"
82 >
83 🗃️ wa-sqlite
84 </Link>
85 </div>
86 </div>
87 </div>
88 </div>
89 <hr />
90 {children}
91 <TanStackRouterDevtools position="bottom-right" />
92 </QueryClientProvider>
93 <Scripts />
94 </body>
95 </html>
96 )
97}