-
Notifications
You must be signed in to change notification settings - Fork 445
Expand file tree
/
Copy pathmain.tsx
More file actions
155 lines (151 loc) · 4.35 KB
/
main.tsx
File metadata and controls
155 lines (151 loc) · 4.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import { ClerkProvider } from '@clerk/react';
import React from 'react';
import ReactDOM from 'react-dom/client';
import { createBrowserRouter, Outlet, RouterProvider, useNavigate } from 'react-router-dom';
import App from './App.tsx';
import Protected from './protected';
import SignIn from './sign-in';
import SignInPopup from './sign-in-popup';
import SignInHashPopup from './sign-in-hash-popup';
import SignUp from './sign-up';
import UserProfile from './user';
import UserProfileCustom from './custom-user-profile';
import UserButtonCustom from './custom-user-button';
import UserButtonCustomDynamicLabels from './custom-user-button/with-dynamic-labels.tsx';
import UserButtonCustomDynamicLabelsAndCustomPages from './custom-user-button/with-dynamic-label-and-custom-pages.tsx';
import UserButtonCustomTrigger from './custom-user-button-trigger';
import UserButtonCustomDynamicItems from './custom-user-button/with-dynamic-items.tsx';
import UserButton from './user-button';
import UserAvatar from './user-avatar';
import Waitlist from './waitlist';
import OrganizationProfile from './organization-profile';
import OrganizationList from './organization-list';
import CreateOrganization from './create-organization';
import OrganizationSwitcher from './organization-switcher';
import Buttons from './buttons';
import ClerkStatusPage from './clerk-status';
const Root = () => {
const navigate = useNavigate();
return (
<ClerkProvider
__internal_clerkJSUrl={import.meta.env.VITE_CLERK_JS_URL as string}
__internal_clerkUIUrl={import.meta.env.VITE_CLERK_UI_URL as string}
routerPush={(to: string) => navigate(to)}
routerReplace={(to: string) => navigate(to, { replace: true })}
appearance={{
options: {
showOptionalFields: true,
},
}}
experimental={{
persistClient: import.meta.env.VITE_EXPERIMENTAL_PERSIST_CLIENT
? import.meta.env.VITE_EXPERIMENTAL_PERSIST_CLIENT === 'true'
: undefined,
swr: import.meta.env.VITE_EXPERIMENTAL_SWR ? import.meta.env.VITE_EXPERIMENTAL_SWR === 'true' : undefined,
}}
>
<Outlet />
</ClerkProvider>
);
};
const router = createBrowserRouter([
{
path: '/',
element: <Root />,
children: [
{
path: '/',
element: <App />,
},
{
path: '/sign-in/*',
element: <SignIn />,
},
{
path: '/sign-in-popup/*',
element: <SignInPopup />,
},
{
path: '/sign-in-hash-popup',
element: <SignInHashPopup />,
},
{
path: '/sign-up/*',
element: <SignUp />,
},
{
path: '/user/*',
element: <UserProfile />,
},
{
path: '/user-button',
element: <UserButton />,
},
{
path: '/user-avatar',
element: <UserAvatar />,
},
{
path: '/protected',
element: <Protected />,
},
{
path: '/buttons',
element: <Buttons />,
},
{
path: '/custom-user-profile/*',
element: <UserProfileCustom />,
},
{
path: '/custom-user-button',
element: <UserButtonCustom />,
},
{
path: '/custom-user-button-dynamic-items',
element: <UserButtonCustomDynamicItems />,
},
{
path: '/custom-user-button-dynamic-labels',
element: <UserButtonCustomDynamicLabels />,
},
{
path: '/custom-user-button-dynamic-labels-and-custom-pages',
element: <UserButtonCustomDynamicLabelsAndCustomPages />,
},
{
path: '/custom-user-button-trigger',
element: <UserButtonCustomTrigger />,
},
{
path: '/waitlist',
element: <Waitlist />,
},
{
path: '/organization-profile',
element: <OrganizationProfile />,
},
{
path: '/organization-list',
element: <OrganizationList />,
},
{
path: '/organization-switcher',
element: <OrganizationSwitcher />,
},
{
path: '/create-organization',
element: <CreateOrganization />,
},
{
path: '/clerk-status',
element: <ClerkStatusPage />,
},
],
},
]);
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<RouterProvider router={router} />
</React.StrictMode>,
);