create-croissant 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/apps/web/src/components/app-sidebar.tsx +84 -30
- package/template/apps/web/src/routeTree.gen.ts +216 -165
- package/template/apps/web/src/routes/__root.tsx +2 -14
- package/template/apps/web/src/routes/{(auth) → _auth}/account.tsx +1 -1
- package/template/apps/web/src/routes/{(auth) → _auth}/dashboard.tsx +1 -1
- package/template/apps/web/src/routes/{examples → _auth/examples}/client-orpc-auth.tsx +1 -1
- package/template/apps/web/src/routes/{examples → _auth/examples}/ssr-orpc-auth.tsx +1 -1
- package/template/apps/web/src/routes/_auth.tsx +23 -0
- package/template/apps/web/src/routes/{examples → _public/examples}/client-orpc.tsx +1 -1
- package/template/apps/web/src/routes/{examples → _public/examples}/isr.tsx +1 -1
- package/template/apps/web/src/routes/{examples → _public/examples}/ssr-orpc.tsx +1 -1
- package/template/apps/web/src/routes/{(public) → _public}/index.tsx +4 -1
- package/template/apps/web/src/routes/{(public) → _public}/login.tsx +4 -1
- package/template/apps/web/src/routes/{(public) → _public}/signup.tsx +4 -1
- package/template/apps/web/src/routes/_public.tsx +23 -0
- package/template/apps/web/vite.config.ts +2 -1
package/package.json
CHANGED
|
@@ -19,37 +19,91 @@ import { Avatar, AvatarFallback, AvatarImage } from "@workspace/ui/components/av
|
|
|
19
19
|
import { authClient } from "@/lib/auth-client"
|
|
20
20
|
|
|
21
21
|
// This is sample data.
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
22
|
+
export const authNavItems = [
|
|
23
|
+
{
|
|
24
|
+
title: "Dashboard",
|
|
25
|
+
items: [
|
|
26
|
+
{
|
|
27
|
+
title: "Overview",
|
|
28
|
+
url: "/dashboard",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
title: "Account",
|
|
32
|
+
url: "/account",
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
title: "Examples",
|
|
38
|
+
items: [
|
|
39
|
+
{
|
|
40
|
+
title: "SSR + oRPC (Auth)",
|
|
41
|
+
url: "/examples/ssr-orpc-auth",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
title: "Client + oRPC (Auth)",
|
|
45
|
+
url: "/examples/client-orpc-auth",
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
export const publicNavItems = [
|
|
52
|
+
{
|
|
53
|
+
title: "Welcome",
|
|
54
|
+
items: [
|
|
55
|
+
{
|
|
56
|
+
title: "Home",
|
|
57
|
+
url: "/",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
title: "Login",
|
|
61
|
+
url: "/login",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
title: "Sign Up",
|
|
65
|
+
url: "/signup",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
title: "Examples",
|
|
71
|
+
items: [
|
|
72
|
+
{
|
|
73
|
+
title: "SSR + oRPC",
|
|
74
|
+
url: "/examples/ssr-orpc",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
title: "Client + oRPC",
|
|
78
|
+
url: "/examples/client-orpc",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
title: "ISR",
|
|
82
|
+
url: "/examples/isr",
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
interface AppSidebarProps extends React.ComponentProps<typeof Sidebar> {
|
|
89
|
+
items?: Array<{
|
|
90
|
+
title: string
|
|
91
|
+
items: Array<{
|
|
92
|
+
title: string
|
|
93
|
+
url: string
|
|
94
|
+
}>
|
|
95
|
+
}>
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function AuthSidebar(props: React.ComponentProps<typeof Sidebar>) {
|
|
99
|
+
return <AppSidebar items={authNavItems} {...props} />
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function PublicSidebar(props: React.ComponentProps<typeof Sidebar>) {
|
|
103
|
+
return <AppSidebar items={publicNavItems} {...props} />
|
|
50
104
|
}
|
|
51
105
|
|
|
52
|
-
export function AppSidebar({ ...props }:
|
|
106
|
+
export function AppSidebar({ items = authNavItems, ...props }: AppSidebarProps) {
|
|
53
107
|
const {
|
|
54
108
|
data: session,
|
|
55
109
|
} = authClient.useSession()
|
|
@@ -64,7 +118,7 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
|
|
64
118
|
</div>
|
|
65
119
|
</SidebarHeader>
|
|
66
120
|
<SidebarContent>
|
|
67
|
-
{
|
|
121
|
+
{items.map((item) => (
|
|
68
122
|
<SidebarGroup key={item.title}>
|
|
69
123
|
<SidebarGroupLabel>{item.title}</SidebarGroupLabel>
|
|
70
124
|
<SidebarGroupContent>
|
|
@@ -9,68 +9,53 @@
|
|
|
9
9
|
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
|
10
10
|
|
|
11
11
|
import { Route as rootRouteImport } from './routes/__root'
|
|
12
|
-
import { Route as
|
|
13
|
-
import { Route as
|
|
14
|
-
import { Route as
|
|
15
|
-
import { Route as
|
|
16
|
-
import { Route as
|
|
17
|
-
import { Route as
|
|
18
|
-
import { Route as
|
|
19
|
-
import { Route as publicLoginRouteImport } from './routes/(public)/login'
|
|
20
|
-
import { Route as authDashboardRouteImport } from './routes/(auth)/dashboard'
|
|
21
|
-
import { Route as authAccountRouteImport } from './routes/(auth)/account'
|
|
12
|
+
import { Route as PublicRouteImport } from './routes/_public'
|
|
13
|
+
import { Route as AuthRouteImport } from './routes/_auth'
|
|
14
|
+
import { Route as PublicIndexRouteImport } from './routes/_public/index'
|
|
15
|
+
import { Route as PublicSignupRouteImport } from './routes/_public/signup'
|
|
16
|
+
import { Route as PublicLoginRouteImport } from './routes/_public/login'
|
|
17
|
+
import { Route as AuthDashboardRouteImport } from './routes/_auth/dashboard'
|
|
18
|
+
import { Route as AuthAccountRouteImport } from './routes/_auth/account'
|
|
22
19
|
import { Route as ApiRpcSplatRouteImport } from './routes/api/rpc.$'
|
|
23
20
|
import { Route as ApiAuthSplatRouteImport } from './routes/api/auth/$'
|
|
21
|
+
import { Route as PublicExamplesSsrOrpcRouteImport } from './routes/_public/examples/ssr-orpc'
|
|
22
|
+
import { Route as PublicExamplesIsrRouteImport } from './routes/_public/examples/isr'
|
|
23
|
+
import { Route as PublicExamplesClientOrpcRouteImport } from './routes/_public/examples/client-orpc'
|
|
24
|
+
import { Route as AuthExamplesSsrOrpcAuthRouteImport } from './routes/_auth/examples/ssr-orpc-auth'
|
|
25
|
+
import { Route as AuthExamplesClientOrpcAuthRouteImport } from './routes/_auth/examples/client-orpc-auth'
|
|
24
26
|
|
|
25
|
-
const
|
|
26
|
-
id: '/
|
|
27
|
-
path: '/',
|
|
28
|
-
getParentRoute: () => rootRouteImport,
|
|
29
|
-
} as any)
|
|
30
|
-
const ExamplesSsrOrpcAuthRoute = ExamplesSsrOrpcAuthRouteImport.update({
|
|
31
|
-
id: '/examples/ssr-orpc-auth',
|
|
32
|
-
path: '/examples/ssr-orpc-auth',
|
|
33
|
-
getParentRoute: () => rootRouteImport,
|
|
34
|
-
} as any)
|
|
35
|
-
const ExamplesSsrOrpcRoute = ExamplesSsrOrpcRouteImport.update({
|
|
36
|
-
id: '/examples/ssr-orpc',
|
|
37
|
-
path: '/examples/ssr-orpc',
|
|
38
|
-
getParentRoute: () => rootRouteImport,
|
|
39
|
-
} as any)
|
|
40
|
-
const ExamplesIsrRoute = ExamplesIsrRouteImport.update({
|
|
41
|
-
id: '/examples/isr',
|
|
42
|
-
path: '/examples/isr',
|
|
27
|
+
const PublicRoute = PublicRouteImport.update({
|
|
28
|
+
id: '/_public',
|
|
43
29
|
getParentRoute: () => rootRouteImport,
|
|
44
30
|
} as any)
|
|
45
|
-
const
|
|
46
|
-
id: '/
|
|
47
|
-
path: '/examples/client-orpc-auth',
|
|
31
|
+
const AuthRoute = AuthRouteImport.update({
|
|
32
|
+
id: '/_auth',
|
|
48
33
|
getParentRoute: () => rootRouteImport,
|
|
49
34
|
} as any)
|
|
50
|
-
const
|
|
51
|
-
id: '/
|
|
52
|
-
path: '/
|
|
53
|
-
getParentRoute: () =>
|
|
35
|
+
const PublicIndexRoute = PublicIndexRouteImport.update({
|
|
36
|
+
id: '/',
|
|
37
|
+
path: '/',
|
|
38
|
+
getParentRoute: () => PublicRoute,
|
|
54
39
|
} as any)
|
|
55
|
-
const
|
|
56
|
-
id: '/
|
|
40
|
+
const PublicSignupRoute = PublicSignupRouteImport.update({
|
|
41
|
+
id: '/signup',
|
|
57
42
|
path: '/signup',
|
|
58
|
-
getParentRoute: () =>
|
|
43
|
+
getParentRoute: () => PublicRoute,
|
|
59
44
|
} as any)
|
|
60
|
-
const
|
|
61
|
-
id: '/
|
|
45
|
+
const PublicLoginRoute = PublicLoginRouteImport.update({
|
|
46
|
+
id: '/login',
|
|
62
47
|
path: '/login',
|
|
63
|
-
getParentRoute: () =>
|
|
48
|
+
getParentRoute: () => PublicRoute,
|
|
64
49
|
} as any)
|
|
65
|
-
const
|
|
66
|
-
id: '/
|
|
50
|
+
const AuthDashboardRoute = AuthDashboardRouteImport.update({
|
|
51
|
+
id: '/dashboard',
|
|
67
52
|
path: '/dashboard',
|
|
68
|
-
getParentRoute: () =>
|
|
53
|
+
getParentRoute: () => AuthRoute,
|
|
69
54
|
} as any)
|
|
70
|
-
const
|
|
71
|
-
id: '/
|
|
55
|
+
const AuthAccountRoute = AuthAccountRouteImport.update({
|
|
56
|
+
id: '/account',
|
|
72
57
|
path: '/account',
|
|
73
|
-
getParentRoute: () =>
|
|
58
|
+
getParentRoute: () => AuthRoute,
|
|
74
59
|
} as any)
|
|
75
60
|
const ApiRpcSplatRoute = ApiRpcSplatRouteImport.update({
|
|
76
61
|
id: '/api/rpc/$',
|
|
@@ -82,181 +67,183 @@ const ApiAuthSplatRoute = ApiAuthSplatRouteImport.update({
|
|
|
82
67
|
path: '/api/auth/$',
|
|
83
68
|
getParentRoute: () => rootRouteImport,
|
|
84
69
|
} as any)
|
|
70
|
+
const PublicExamplesSsrOrpcRoute = PublicExamplesSsrOrpcRouteImport.update({
|
|
71
|
+
id: '/examples/ssr-orpc',
|
|
72
|
+
path: '/examples/ssr-orpc',
|
|
73
|
+
getParentRoute: () => PublicRoute,
|
|
74
|
+
} as any)
|
|
75
|
+
const PublicExamplesIsrRoute = PublicExamplesIsrRouteImport.update({
|
|
76
|
+
id: '/examples/isr',
|
|
77
|
+
path: '/examples/isr',
|
|
78
|
+
getParentRoute: () => PublicRoute,
|
|
79
|
+
} as any)
|
|
80
|
+
const PublicExamplesClientOrpcRoute =
|
|
81
|
+
PublicExamplesClientOrpcRouteImport.update({
|
|
82
|
+
id: '/examples/client-orpc',
|
|
83
|
+
path: '/examples/client-orpc',
|
|
84
|
+
getParentRoute: () => PublicRoute,
|
|
85
|
+
} as any)
|
|
86
|
+
const AuthExamplesSsrOrpcAuthRoute = AuthExamplesSsrOrpcAuthRouteImport.update({
|
|
87
|
+
id: '/examples/ssr-orpc-auth',
|
|
88
|
+
path: '/examples/ssr-orpc-auth',
|
|
89
|
+
getParentRoute: () => AuthRoute,
|
|
90
|
+
} as any)
|
|
91
|
+
const AuthExamplesClientOrpcAuthRoute =
|
|
92
|
+
AuthExamplesClientOrpcAuthRouteImport.update({
|
|
93
|
+
id: '/examples/client-orpc-auth',
|
|
94
|
+
path: '/examples/client-orpc-auth',
|
|
95
|
+
getParentRoute: () => AuthRoute,
|
|
96
|
+
} as any)
|
|
85
97
|
|
|
86
98
|
export interface FileRoutesByFullPath {
|
|
87
|
-
'/
|
|
88
|
-
'/
|
|
89
|
-
'/
|
|
90
|
-
'/
|
|
91
|
-
'/
|
|
92
|
-
'/examples/client-orpc-auth': typeof
|
|
93
|
-
'/examples/
|
|
94
|
-
'/examples/
|
|
95
|
-
'/examples/
|
|
96
|
-
'/': typeof
|
|
99
|
+
'/': typeof PublicIndexRoute
|
|
100
|
+
'/account': typeof AuthAccountRoute
|
|
101
|
+
'/dashboard': typeof AuthDashboardRoute
|
|
102
|
+
'/login': typeof PublicLoginRoute
|
|
103
|
+
'/signup': typeof PublicSignupRoute
|
|
104
|
+
'/examples/client-orpc-auth': typeof AuthExamplesClientOrpcAuthRoute
|
|
105
|
+
'/examples/ssr-orpc-auth': typeof AuthExamplesSsrOrpcAuthRoute
|
|
106
|
+
'/examples/client-orpc': typeof PublicExamplesClientOrpcRoute
|
|
107
|
+
'/examples/isr': typeof PublicExamplesIsrRoute
|
|
108
|
+
'/examples/ssr-orpc': typeof PublicExamplesSsrOrpcRoute
|
|
97
109
|
'/api/auth/$': typeof ApiAuthSplatRoute
|
|
98
110
|
'/api/rpc/$': typeof ApiRpcSplatRoute
|
|
99
111
|
}
|
|
100
112
|
export interface FileRoutesByTo {
|
|
101
|
-
'/
|
|
102
|
-
'/
|
|
103
|
-
'/
|
|
104
|
-
'/
|
|
105
|
-
'/
|
|
106
|
-
'/examples/client-orpc-auth': typeof
|
|
107
|
-
'/examples/
|
|
108
|
-
'/examples/
|
|
109
|
-
'/examples/
|
|
110
|
-
'/': typeof
|
|
113
|
+
'/': typeof PublicIndexRoute
|
|
114
|
+
'/account': typeof AuthAccountRoute
|
|
115
|
+
'/dashboard': typeof AuthDashboardRoute
|
|
116
|
+
'/login': typeof PublicLoginRoute
|
|
117
|
+
'/signup': typeof PublicSignupRoute
|
|
118
|
+
'/examples/client-orpc-auth': typeof AuthExamplesClientOrpcAuthRoute
|
|
119
|
+
'/examples/ssr-orpc-auth': typeof AuthExamplesSsrOrpcAuthRoute
|
|
120
|
+
'/examples/client-orpc': typeof PublicExamplesClientOrpcRoute
|
|
121
|
+
'/examples/isr': typeof PublicExamplesIsrRoute
|
|
122
|
+
'/examples/ssr-orpc': typeof PublicExamplesSsrOrpcRoute
|
|
111
123
|
'/api/auth/$': typeof ApiAuthSplatRoute
|
|
112
124
|
'/api/rpc/$': typeof ApiRpcSplatRoute
|
|
113
125
|
}
|
|
114
126
|
export interface FileRoutesById {
|
|
115
127
|
__root__: typeof rootRouteImport
|
|
116
|
-
'/
|
|
117
|
-
'/
|
|
118
|
-
'/
|
|
119
|
-
'/
|
|
120
|
-
'/
|
|
121
|
-
'/
|
|
122
|
-
'/
|
|
123
|
-
'/examples/
|
|
124
|
-
'/examples/ssr-orpc-auth': typeof
|
|
125
|
-
'/
|
|
128
|
+
'/_auth': typeof AuthRouteWithChildren
|
|
129
|
+
'/_public': typeof PublicRouteWithChildren
|
|
130
|
+
'/_auth/account': typeof AuthAccountRoute
|
|
131
|
+
'/_auth/dashboard': typeof AuthDashboardRoute
|
|
132
|
+
'/_public/login': typeof PublicLoginRoute
|
|
133
|
+
'/_public/signup': typeof PublicSignupRoute
|
|
134
|
+
'/_public/': typeof PublicIndexRoute
|
|
135
|
+
'/_auth/examples/client-orpc-auth': typeof AuthExamplesClientOrpcAuthRoute
|
|
136
|
+
'/_auth/examples/ssr-orpc-auth': typeof AuthExamplesSsrOrpcAuthRoute
|
|
137
|
+
'/_public/examples/client-orpc': typeof PublicExamplesClientOrpcRoute
|
|
138
|
+
'/_public/examples/isr': typeof PublicExamplesIsrRoute
|
|
139
|
+
'/_public/examples/ssr-orpc': typeof PublicExamplesSsrOrpcRoute
|
|
126
140
|
'/api/auth/$': typeof ApiAuthSplatRoute
|
|
127
141
|
'/api/rpc/$': typeof ApiRpcSplatRoute
|
|
128
142
|
}
|
|
129
143
|
export interface FileRouteTypes {
|
|
130
144
|
fileRoutesByFullPath: FileRoutesByFullPath
|
|
131
145
|
fullPaths:
|
|
146
|
+
| '/'
|
|
132
147
|
| '/account'
|
|
133
148
|
| '/dashboard'
|
|
134
149
|
| '/login'
|
|
135
150
|
| '/signup'
|
|
136
|
-
| '/examples/client-orpc'
|
|
137
151
|
| '/examples/client-orpc-auth'
|
|
152
|
+
| '/examples/ssr-orpc-auth'
|
|
153
|
+
| '/examples/client-orpc'
|
|
138
154
|
| '/examples/isr'
|
|
139
155
|
| '/examples/ssr-orpc'
|
|
140
|
-
| '/examples/ssr-orpc-auth'
|
|
141
|
-
| '/'
|
|
142
156
|
| '/api/auth/$'
|
|
143
157
|
| '/api/rpc/$'
|
|
144
158
|
fileRoutesByTo: FileRoutesByTo
|
|
145
159
|
to:
|
|
160
|
+
| '/'
|
|
146
161
|
| '/account'
|
|
147
162
|
| '/dashboard'
|
|
148
163
|
| '/login'
|
|
149
164
|
| '/signup'
|
|
150
|
-
| '/examples/client-orpc'
|
|
151
165
|
| '/examples/client-orpc-auth'
|
|
166
|
+
| '/examples/ssr-orpc-auth'
|
|
167
|
+
| '/examples/client-orpc'
|
|
152
168
|
| '/examples/isr'
|
|
153
169
|
| '/examples/ssr-orpc'
|
|
154
|
-
| '/examples/ssr-orpc-auth'
|
|
155
|
-
| '/'
|
|
156
170
|
| '/api/auth/$'
|
|
157
171
|
| '/api/rpc/$'
|
|
158
172
|
id:
|
|
159
173
|
| '__root__'
|
|
160
|
-
| '/
|
|
161
|
-
| '/
|
|
162
|
-
| '/
|
|
163
|
-
| '/
|
|
164
|
-
| '/
|
|
165
|
-
| '/
|
|
166
|
-
| '/
|
|
167
|
-
| '/examples/
|
|
168
|
-
| '/examples/ssr-orpc-auth'
|
|
169
|
-
| '/
|
|
174
|
+
| '/_auth'
|
|
175
|
+
| '/_public'
|
|
176
|
+
| '/_auth/account'
|
|
177
|
+
| '/_auth/dashboard'
|
|
178
|
+
| '/_public/login'
|
|
179
|
+
| '/_public/signup'
|
|
180
|
+
| '/_public/'
|
|
181
|
+
| '/_auth/examples/client-orpc-auth'
|
|
182
|
+
| '/_auth/examples/ssr-orpc-auth'
|
|
183
|
+
| '/_public/examples/client-orpc'
|
|
184
|
+
| '/_public/examples/isr'
|
|
185
|
+
| '/_public/examples/ssr-orpc'
|
|
170
186
|
| '/api/auth/$'
|
|
171
187
|
| '/api/rpc/$'
|
|
172
188
|
fileRoutesById: FileRoutesById
|
|
173
189
|
}
|
|
174
190
|
export interface RootRouteChildren {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
publicLoginRoute: typeof publicLoginRoute
|
|
178
|
-
publicSignupRoute: typeof publicSignupRoute
|
|
179
|
-
ExamplesClientOrpcRoute: typeof ExamplesClientOrpcRoute
|
|
180
|
-
ExamplesClientOrpcAuthRoute: typeof ExamplesClientOrpcAuthRoute
|
|
181
|
-
ExamplesIsrRoute: typeof ExamplesIsrRoute
|
|
182
|
-
ExamplesSsrOrpcRoute: typeof ExamplesSsrOrpcRoute
|
|
183
|
-
ExamplesSsrOrpcAuthRoute: typeof ExamplesSsrOrpcAuthRoute
|
|
184
|
-
publicIndexRoute: typeof publicIndexRoute
|
|
191
|
+
AuthRoute: typeof AuthRouteWithChildren
|
|
192
|
+
PublicRoute: typeof PublicRouteWithChildren
|
|
185
193
|
ApiAuthSplatRoute: typeof ApiAuthSplatRoute
|
|
186
194
|
ApiRpcSplatRoute: typeof ApiRpcSplatRoute
|
|
187
195
|
}
|
|
188
196
|
|
|
189
197
|
declare module '@tanstack/react-router' {
|
|
190
198
|
interface FileRoutesByPath {
|
|
191
|
-
'/
|
|
192
|
-
id: '/
|
|
193
|
-
path: '
|
|
199
|
+
'/_public': {
|
|
200
|
+
id: '/_public'
|
|
201
|
+
path: ''
|
|
194
202
|
fullPath: '/'
|
|
195
|
-
preLoaderRoute: typeof
|
|
203
|
+
preLoaderRoute: typeof PublicRouteImport
|
|
196
204
|
parentRoute: typeof rootRouteImport
|
|
197
205
|
}
|
|
198
|
-
'/
|
|
199
|
-
id: '/
|
|
200
|
-
path: '
|
|
201
|
-
fullPath: '/
|
|
202
|
-
preLoaderRoute: typeof
|
|
203
|
-
parentRoute: typeof rootRouteImport
|
|
204
|
-
}
|
|
205
|
-
'/examples/ssr-orpc': {
|
|
206
|
-
id: '/examples/ssr-orpc'
|
|
207
|
-
path: '/examples/ssr-orpc'
|
|
208
|
-
fullPath: '/examples/ssr-orpc'
|
|
209
|
-
preLoaderRoute: typeof ExamplesSsrOrpcRouteImport
|
|
210
|
-
parentRoute: typeof rootRouteImport
|
|
211
|
-
}
|
|
212
|
-
'/examples/isr': {
|
|
213
|
-
id: '/examples/isr'
|
|
214
|
-
path: '/examples/isr'
|
|
215
|
-
fullPath: '/examples/isr'
|
|
216
|
-
preLoaderRoute: typeof ExamplesIsrRouteImport
|
|
217
|
-
parentRoute: typeof rootRouteImport
|
|
218
|
-
}
|
|
219
|
-
'/examples/client-orpc-auth': {
|
|
220
|
-
id: '/examples/client-orpc-auth'
|
|
221
|
-
path: '/examples/client-orpc-auth'
|
|
222
|
-
fullPath: '/examples/client-orpc-auth'
|
|
223
|
-
preLoaderRoute: typeof ExamplesClientOrpcAuthRouteImport
|
|
206
|
+
'/_auth': {
|
|
207
|
+
id: '/_auth'
|
|
208
|
+
path: ''
|
|
209
|
+
fullPath: '/'
|
|
210
|
+
preLoaderRoute: typeof AuthRouteImport
|
|
224
211
|
parentRoute: typeof rootRouteImport
|
|
225
212
|
}
|
|
226
|
-
'/
|
|
227
|
-
id: '/
|
|
228
|
-
path: '/
|
|
229
|
-
fullPath: '/
|
|
230
|
-
preLoaderRoute: typeof
|
|
231
|
-
parentRoute: typeof
|
|
213
|
+
'/_public/': {
|
|
214
|
+
id: '/_public/'
|
|
215
|
+
path: '/'
|
|
216
|
+
fullPath: '/'
|
|
217
|
+
preLoaderRoute: typeof PublicIndexRouteImport
|
|
218
|
+
parentRoute: typeof PublicRoute
|
|
232
219
|
}
|
|
233
|
-
'/
|
|
234
|
-
id: '/
|
|
220
|
+
'/_public/signup': {
|
|
221
|
+
id: '/_public/signup'
|
|
235
222
|
path: '/signup'
|
|
236
223
|
fullPath: '/signup'
|
|
237
|
-
preLoaderRoute: typeof
|
|
238
|
-
parentRoute: typeof
|
|
224
|
+
preLoaderRoute: typeof PublicSignupRouteImport
|
|
225
|
+
parentRoute: typeof PublicRoute
|
|
239
226
|
}
|
|
240
|
-
'/
|
|
241
|
-
id: '/
|
|
227
|
+
'/_public/login': {
|
|
228
|
+
id: '/_public/login'
|
|
242
229
|
path: '/login'
|
|
243
230
|
fullPath: '/login'
|
|
244
|
-
preLoaderRoute: typeof
|
|
245
|
-
parentRoute: typeof
|
|
231
|
+
preLoaderRoute: typeof PublicLoginRouteImport
|
|
232
|
+
parentRoute: typeof PublicRoute
|
|
246
233
|
}
|
|
247
|
-
'/
|
|
248
|
-
id: '/
|
|
234
|
+
'/_auth/dashboard': {
|
|
235
|
+
id: '/_auth/dashboard'
|
|
249
236
|
path: '/dashboard'
|
|
250
237
|
fullPath: '/dashboard'
|
|
251
|
-
preLoaderRoute: typeof
|
|
252
|
-
parentRoute: typeof
|
|
238
|
+
preLoaderRoute: typeof AuthDashboardRouteImport
|
|
239
|
+
parentRoute: typeof AuthRoute
|
|
253
240
|
}
|
|
254
|
-
'/
|
|
255
|
-
id: '/
|
|
241
|
+
'/_auth/account': {
|
|
242
|
+
id: '/_auth/account'
|
|
256
243
|
path: '/account'
|
|
257
244
|
fullPath: '/account'
|
|
258
|
-
preLoaderRoute: typeof
|
|
259
|
-
parentRoute: typeof
|
|
245
|
+
preLoaderRoute: typeof AuthAccountRouteImport
|
|
246
|
+
parentRoute: typeof AuthRoute
|
|
260
247
|
}
|
|
261
248
|
'/api/rpc/$': {
|
|
262
249
|
id: '/api/rpc/$'
|
|
@@ -272,20 +259,84 @@ declare module '@tanstack/react-router' {
|
|
|
272
259
|
preLoaderRoute: typeof ApiAuthSplatRouteImport
|
|
273
260
|
parentRoute: typeof rootRouteImport
|
|
274
261
|
}
|
|
262
|
+
'/_public/examples/ssr-orpc': {
|
|
263
|
+
id: '/_public/examples/ssr-orpc'
|
|
264
|
+
path: '/examples/ssr-orpc'
|
|
265
|
+
fullPath: '/examples/ssr-orpc'
|
|
266
|
+
preLoaderRoute: typeof PublicExamplesSsrOrpcRouteImport
|
|
267
|
+
parentRoute: typeof PublicRoute
|
|
268
|
+
}
|
|
269
|
+
'/_public/examples/isr': {
|
|
270
|
+
id: '/_public/examples/isr'
|
|
271
|
+
path: '/examples/isr'
|
|
272
|
+
fullPath: '/examples/isr'
|
|
273
|
+
preLoaderRoute: typeof PublicExamplesIsrRouteImport
|
|
274
|
+
parentRoute: typeof PublicRoute
|
|
275
|
+
}
|
|
276
|
+
'/_public/examples/client-orpc': {
|
|
277
|
+
id: '/_public/examples/client-orpc'
|
|
278
|
+
path: '/examples/client-orpc'
|
|
279
|
+
fullPath: '/examples/client-orpc'
|
|
280
|
+
preLoaderRoute: typeof PublicExamplesClientOrpcRouteImport
|
|
281
|
+
parentRoute: typeof PublicRoute
|
|
282
|
+
}
|
|
283
|
+
'/_auth/examples/ssr-orpc-auth': {
|
|
284
|
+
id: '/_auth/examples/ssr-orpc-auth'
|
|
285
|
+
path: '/examples/ssr-orpc-auth'
|
|
286
|
+
fullPath: '/examples/ssr-orpc-auth'
|
|
287
|
+
preLoaderRoute: typeof AuthExamplesSsrOrpcAuthRouteImport
|
|
288
|
+
parentRoute: typeof AuthRoute
|
|
289
|
+
}
|
|
290
|
+
'/_auth/examples/client-orpc-auth': {
|
|
291
|
+
id: '/_auth/examples/client-orpc-auth'
|
|
292
|
+
path: '/examples/client-orpc-auth'
|
|
293
|
+
fullPath: '/examples/client-orpc-auth'
|
|
294
|
+
preLoaderRoute: typeof AuthExamplesClientOrpcAuthRouteImport
|
|
295
|
+
parentRoute: typeof AuthRoute
|
|
296
|
+
}
|
|
275
297
|
}
|
|
276
298
|
}
|
|
277
299
|
|
|
300
|
+
interface AuthRouteChildren {
|
|
301
|
+
AuthAccountRoute: typeof AuthAccountRoute
|
|
302
|
+
AuthDashboardRoute: typeof AuthDashboardRoute
|
|
303
|
+
AuthExamplesClientOrpcAuthRoute: typeof AuthExamplesClientOrpcAuthRoute
|
|
304
|
+
AuthExamplesSsrOrpcAuthRoute: typeof AuthExamplesSsrOrpcAuthRoute
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const AuthRouteChildren: AuthRouteChildren = {
|
|
308
|
+
AuthAccountRoute: AuthAccountRoute,
|
|
309
|
+
AuthDashboardRoute: AuthDashboardRoute,
|
|
310
|
+
AuthExamplesClientOrpcAuthRoute: AuthExamplesClientOrpcAuthRoute,
|
|
311
|
+
AuthExamplesSsrOrpcAuthRoute: AuthExamplesSsrOrpcAuthRoute,
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren)
|
|
315
|
+
|
|
316
|
+
interface PublicRouteChildren {
|
|
317
|
+
PublicLoginRoute: typeof PublicLoginRoute
|
|
318
|
+
PublicSignupRoute: typeof PublicSignupRoute
|
|
319
|
+
PublicIndexRoute: typeof PublicIndexRoute
|
|
320
|
+
PublicExamplesClientOrpcRoute: typeof PublicExamplesClientOrpcRoute
|
|
321
|
+
PublicExamplesIsrRoute: typeof PublicExamplesIsrRoute
|
|
322
|
+
PublicExamplesSsrOrpcRoute: typeof PublicExamplesSsrOrpcRoute
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const PublicRouteChildren: PublicRouteChildren = {
|
|
326
|
+
PublicLoginRoute: PublicLoginRoute,
|
|
327
|
+
PublicSignupRoute: PublicSignupRoute,
|
|
328
|
+
PublicIndexRoute: PublicIndexRoute,
|
|
329
|
+
PublicExamplesClientOrpcRoute: PublicExamplesClientOrpcRoute,
|
|
330
|
+
PublicExamplesIsrRoute: PublicExamplesIsrRoute,
|
|
331
|
+
PublicExamplesSsrOrpcRoute: PublicExamplesSsrOrpcRoute,
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const PublicRouteWithChildren =
|
|
335
|
+
PublicRoute._addFileChildren(PublicRouteChildren)
|
|
336
|
+
|
|
278
337
|
const rootRouteChildren: RootRouteChildren = {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
publicLoginRoute: publicLoginRoute,
|
|
282
|
-
publicSignupRoute: publicSignupRoute,
|
|
283
|
-
ExamplesClientOrpcRoute: ExamplesClientOrpcRoute,
|
|
284
|
-
ExamplesClientOrpcAuthRoute: ExamplesClientOrpcAuthRoute,
|
|
285
|
-
ExamplesIsrRoute: ExamplesIsrRoute,
|
|
286
|
-
ExamplesSsrOrpcRoute: ExamplesSsrOrpcRoute,
|
|
287
|
-
ExamplesSsrOrpcAuthRoute: ExamplesSsrOrpcAuthRoute,
|
|
288
|
-
publicIndexRoute: publicIndexRoute,
|
|
338
|
+
AuthRoute: AuthRouteWithChildren,
|
|
339
|
+
PublicRoute: PublicRouteWithChildren,
|
|
289
340
|
ApiAuthSplatRoute: ApiAuthSplatRoute,
|
|
290
341
|
ApiRpcSplatRoute: ApiRpcSplatRoute,
|
|
291
342
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { HeadContent, Scripts, createRootRoute } from "@tanstack/react-router"
|
|
2
2
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
|
|
3
|
-
import { SidebarProvider, SidebarTrigger } from "@workspace/ui/components/sidebar"
|
|
4
3
|
import { Toaster } from "@workspace/ui/components/sonner"
|
|
5
4
|
|
|
6
5
|
import appCss from "@workspace/ui/globals.css?url"
|
|
7
|
-
import { AppSidebar } from "@/components/app-sidebar"
|
|
8
6
|
|
|
9
7
|
const queryClient = new QueryClient()
|
|
10
8
|
|
|
@@ -40,18 +38,8 @@ function RootDocument({ children }: { children: React.ReactNode }) {
|
|
|
40
38
|
</head>
|
|
41
39
|
<body>
|
|
42
40
|
<QueryClientProvider client={queryClient}>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<main className="flex flex-1 flex-col overflow-hidden">
|
|
46
|
-
<header className="flex h-16 shrink-0 items-center gap-2 border-b px-4">
|
|
47
|
-
<SidebarTrigger />
|
|
48
|
-
</header>
|
|
49
|
-
<div className="flex-1 overflow-auto p-4">
|
|
50
|
-
{children}
|
|
51
|
-
</div>
|
|
52
|
-
</main>
|
|
53
|
-
<Toaster />
|
|
54
|
-
</SidebarProvider>
|
|
41
|
+
{children}
|
|
42
|
+
<Toaster />
|
|
55
43
|
</QueryClientProvider>
|
|
56
44
|
<Scripts />
|
|
57
45
|
</body>
|
|
@@ -28,7 +28,7 @@ const passwordSchema = z.object({
|
|
|
28
28
|
path: ["confirmPassword"],
|
|
29
29
|
})
|
|
30
30
|
|
|
31
|
-
export const Route = createFileRoute("/
|
|
31
|
+
export const Route = createFileRoute("/_auth/account")({
|
|
32
32
|
beforeLoad: async () => {
|
|
33
33
|
const session = await getSessionFn()
|
|
34
34
|
if (!session) {
|
|
@@ -3,7 +3,7 @@ import { getSessionFn } from "@/lib/auth-utils"
|
|
|
3
3
|
import { authClient } from "@/lib/auth-client"
|
|
4
4
|
import { orpc } from "@/lib/orpc"
|
|
5
5
|
|
|
6
|
-
export const Route = createFileRoute("/
|
|
6
|
+
export const Route = createFileRoute("/_auth/dashboard")({
|
|
7
7
|
beforeLoad: async () => {
|
|
8
8
|
const session = await getSessionFn()
|
|
9
9
|
if (!session) {
|
|
@@ -3,7 +3,7 @@ import { useQuery } from "@tanstack/react-query"
|
|
|
3
3
|
import { getSessionFn } from "@/lib/auth-utils"
|
|
4
4
|
import { orpc } from "@/lib/orpc"
|
|
5
5
|
|
|
6
|
-
export const Route = createFileRoute("/examples/client-orpc-auth")({
|
|
6
|
+
export const Route = createFileRoute("/_auth/examples/client-orpc-auth")({
|
|
7
7
|
beforeLoad: async () => {
|
|
8
8
|
const session = await getSessionFn()
|
|
9
9
|
if (!session) {
|
|
@@ -2,7 +2,7 @@ import { createFileRoute, redirect } from "@tanstack/react-router"
|
|
|
2
2
|
import { getSessionFn } from "@/lib/auth-utils"
|
|
3
3
|
import { orpc } from "@/lib/orpc"
|
|
4
4
|
|
|
5
|
-
export const Route = createFileRoute("/examples/ssr-orpc-auth")({
|
|
5
|
+
export const Route = createFileRoute("/_auth/examples/ssr-orpc-auth")({
|
|
6
6
|
beforeLoad: async () => {
|
|
7
7
|
const session = await getSessionFn()
|
|
8
8
|
if (!session) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Outlet, createFileRoute } from "@tanstack/react-router"
|
|
2
|
+
import { SidebarProvider, SidebarTrigger } from "@workspace/ui/components/sidebar"
|
|
3
|
+
import { AuthSidebar } from "@/components/app-sidebar"
|
|
4
|
+
|
|
5
|
+
export const Route = createFileRoute("/_auth")({
|
|
6
|
+
component: AuthLayout,
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
function AuthLayout() {
|
|
10
|
+
return (
|
|
11
|
+
<SidebarProvider>
|
|
12
|
+
<AuthSidebar />
|
|
13
|
+
<main className="flex flex-1 flex-col overflow-hidden">
|
|
14
|
+
<header className="flex h-16 shrink-0 items-center gap-2 border-b px-4">
|
|
15
|
+
<SidebarTrigger />
|
|
16
|
+
</header>
|
|
17
|
+
<div className="flex-1 overflow-auto p-4">
|
|
18
|
+
<Outlet />
|
|
19
|
+
</div>
|
|
20
|
+
</main>
|
|
21
|
+
</SidebarProvider>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -29,7 +29,7 @@ const planetSchema = z.object({
|
|
|
29
29
|
diameter: z.string().refine((val) => !isNaN(parseFloat(val)), "Must be a number"),
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
export const Route = createFileRoute("/examples/client-orpc")({
|
|
32
|
+
export const Route = createFileRoute("/_public/examples/client-orpc")({
|
|
33
33
|
component: ClientORPC,
|
|
34
34
|
})
|
|
35
35
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createFileRoute } from "@tanstack/react-router"
|
|
2
2
|
import { orpc } from "@/lib/orpc"
|
|
3
3
|
|
|
4
|
-
export const Route = createFileRoute("/examples/isr")({
|
|
4
|
+
export const Route = createFileRoute("/_public/examples/isr")({
|
|
5
5
|
loader: async () => {
|
|
6
6
|
// In a real ISR scenario, this would be cached on the server
|
|
7
7
|
// For this example, we'll fetch planets via oRPC
|
|
@@ -27,7 +27,7 @@ const planetSchema = z.object({
|
|
|
27
27
|
diameter: z.string().refine((val) => !isNaN(parseFloat(val)), "Must be a number"),
|
|
28
28
|
})
|
|
29
29
|
|
|
30
|
-
export const Route = createFileRoute("/examples/ssr-orpc")({
|
|
30
|
+
export const Route = createFileRoute("/_public/examples/ssr-orpc")({
|
|
31
31
|
loader: async () => {
|
|
32
32
|
const planets = await orpc.planets.getPlanets()
|
|
33
33
|
return { planets }
|
|
@@ -7,7 +7,7 @@ import { orpc } from "@/lib/orpc"
|
|
|
7
7
|
type Outputs = InferRouterOutputs<typeof router>
|
|
8
8
|
type Planet = Outputs["planets"]["getPlanets"][number]
|
|
9
9
|
|
|
10
|
-
export const Route = createFileRoute("/
|
|
10
|
+
export const Route = createFileRoute("/_public/")({
|
|
11
11
|
loader: async () => {
|
|
12
12
|
const [helloRes, planets] = await Promise.all([
|
|
13
13
|
orpc.hello({ name: "Croissant Stack" }),
|
|
@@ -18,6 +18,9 @@ export const Route = createFileRoute("/(public)/")({
|
|
|
18
18
|
planets,
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
+
headers: () => ({
|
|
22
|
+
"Cache-Control": "public, max-age=10, s-maxage=10, stale-while-revalidate=60",
|
|
23
|
+
}),
|
|
21
24
|
component: App,
|
|
22
25
|
})
|
|
23
26
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { createFileRoute } from "@tanstack/react-router"
|
|
2
2
|
import { LoginForm } from "@/components/login-form"
|
|
3
3
|
|
|
4
|
-
export const Route = createFileRoute("/
|
|
4
|
+
export const Route = createFileRoute("/_public/login")({
|
|
5
|
+
headers: () => ({
|
|
6
|
+
"Cache-Control": "public, max-age=3600, s-maxage=3600, stale-while-revalidate=86400",
|
|
7
|
+
}),
|
|
5
8
|
component: Login,
|
|
6
9
|
})
|
|
7
10
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { createFileRoute } from "@tanstack/react-router"
|
|
2
2
|
import { SignupForm } from "@/components/signup-form"
|
|
3
3
|
|
|
4
|
-
export const Route = createFileRoute("/
|
|
4
|
+
export const Route = createFileRoute("/_public/signup")({
|
|
5
|
+
headers: () => ({
|
|
6
|
+
"Cache-Control": "public, max-age=3600, s-maxage=3600, stale-while-revalidate=86400",
|
|
7
|
+
}),
|
|
5
8
|
component: Signup,
|
|
6
9
|
})
|
|
7
10
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Outlet, createFileRoute } from "@tanstack/react-router"
|
|
2
|
+
import { SidebarProvider, SidebarTrigger } from "@workspace/ui/components/sidebar"
|
|
3
|
+
import { PublicSidebar } from "@/components/app-sidebar"
|
|
4
|
+
|
|
5
|
+
export const Route = createFileRoute("/_public")({
|
|
6
|
+
component: PublicLayout,
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
function PublicLayout() {
|
|
10
|
+
return (
|
|
11
|
+
<SidebarProvider>
|
|
12
|
+
<PublicSidebar />
|
|
13
|
+
<main className="flex flex-1 flex-col overflow-hidden">
|
|
14
|
+
<header className="flex h-16 shrink-0 items-center gap-2 border-b px-4">
|
|
15
|
+
<SidebarTrigger />
|
|
16
|
+
</header>
|
|
17
|
+
<div className="flex-1 overflow-auto p-4">
|
|
18
|
+
<Outlet />
|
|
19
|
+
</div>
|
|
20
|
+
</main>
|
|
21
|
+
</SidebarProvider>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -10,7 +10,8 @@ const config = defineConfig({
|
|
|
10
10
|
tailwindcss(),
|
|
11
11
|
tanstackStart({
|
|
12
12
|
prerender: {
|
|
13
|
-
|
|
13
|
+
// In this version of TanStack Start, we use 'filter' to specify ISR routes
|
|
14
|
+
filter: ({ path }) => ["/", "/login", "/signup", "/examples/isr"].includes(path),
|
|
14
15
|
},
|
|
15
16
|
}),
|
|
16
17
|
viteReact(),
|