-
Notifications
You must be signed in to change notification settings - Fork 441
Expand file tree
/
Copy pathmain.tsx
More file actions
115 lines (111 loc) · 3.08 KB
/
main.tsx
File metadata and controls
115 lines (111 loc) · 3.08 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
import { ClerkProvider } from '@clerk/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 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 UserButtonCustomTrigger from './custom-user-button-trigger';
import UserButton from './user-button';
import Waitlist from './waitlist';
import OrganizationProfile from './organization-profile';
import OrganizationList from './organization-list';
import CreateOrganization from './create-organization';
import OrganizationSwitcher from './organization-switcher';
const Root = () => {
const navigate = useNavigate();
return (
<ClerkProvider
// @ts-ignore
publishableKey={import.meta.env.VITE_CLERK_PUBLISHABLE_KEY as string}
clerkJSUrl={import.meta.env.VITE_CLERK_JS_URL as string}
routerPush={(to: string) => navigate(to)}
routerReplace={(to: string) => navigate(to, { replace: true })}
experimental={{
persistClient: import.meta.env.VITE_EXPERIMENTAL_PERSIST_CLIENT
? import.meta.env.VITE_EXPERIMENTAL_PERSIST_CLIENT === 'true'
: undefined,
}}
>
<Outlet />
</ClerkProvider>
);
};
const router = createBrowserRouter([
{
path: '/',
element: <Root />,
children: [
{
path: '/',
element: <App />,
},
{
path: '/sign-in/*',
element: <SignIn />,
},
{
path: '/sign-up/*',
element: <SignUp />,
},
{
path: '/user/*',
element: <UserProfile />,
},
{
path: '/user-button',
element: <UserButton />,
},
{
path: '/protected',
element: <Protected />,
},
{
path: '/custom-user-profile/*',
element: <UserProfileCustom />,
},
{
path: '/custom-user-button',
element: <UserButtonCustom />,
},
{
path: '/custom-user-button-dynamic-labels',
element: <UserButtonCustomDynamicLabels />,
},
{
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 />,
},
],
},
]);
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<RouterProvider router={router} />
</React.StrictMode>,
);