-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathApp.tsx
62 lines (56 loc) · 1.6 KB
/
App.tsx
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
/*!
* Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project.
*/
import 'allotment/dist/style.css'
import { type AppProfile, DataShaperApp } from '@datashaper/app-framework'
import { Spinner } from '@fluentui/react'
import { useConst } from '@fluentui/react-hooks'
import { Suspense, memo } from 'react'
import { HashRouter } from 'react-router-dom'
import { RecoilRoot } from 'recoil'
import { Layout } from '../components/Layout.js'
import { TestAppProfile } from '../profiles/index.js'
import type { AppContext, AppSettings } from '../types.js'
import { About } from './About.js'
import { ErrorBoundary } from './ErrorBoundary.js'
import { StyleContext } from './StyleContext.js'
const examples = [
{ name: 'Smoking', url: 'examples/smoking.json' },
{ name: 'Companies', url: 'examples/companies.json' },
]
const defaultSettings: AppSettings = {
darkMode: true,
}
const context: AppContext = {
initialSettings: {
name: 'Tester',
},
}
export const App: React.FC = memo(function App() {
const customProfiles = useConst<AppProfile[]>(
() => [new TestAppProfile()] as AppProfile<any, any>[],
)
return (
<ErrorBoundary>
<RecoilRoot>
<HashRouter>
<Suspense fallback={<Spinner />}>
<StyleContext>
<Layout>
<DataShaperApp
examples={examples}
profiles={customProfiles}
defaultSettings={defaultSettings}
appContext={context}
>
<About />
</DataShaperApp>
</Layout>
</StyleContext>
</Suspense>
</HashRouter>
</RecoilRoot>
</ErrorBoundary>
)
})