-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
63 lines (52 loc) · 2 KB
/
index.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
63
import React, { useMemo } from 'react'
import { ThemeProvider } from 'styled-components'
import { defaultThemes, Notification } from '@mexit/shared'
import Dibba from './Components/Dibba'
import { DibbaPortal } from './Components/Dibba/DibbaPortal'
import { InternalEvents } from './Components/InternalEvents'
import ReminderArmer from './Components/ReminderArmer'
import { ExtInfoBar } from './Components/Sidebar'
import Sputlit from './Components/Sputlit'
import { SputlitPortal } from './Components/Sputlit/SputlitPortal'
import Tooltip from './Components/Tooltip'
import { TooltipPortal } from './Components/Tooltip/TooltipPortal'
import { EditorProvider } from './Hooks/useEditorContext'
import { HighlighterProvider } from './Hooks/useHighlighterContext'
import { SputlitProvider } from './Hooks/useSputlitContext'
import { useUserPreferenceStore } from './Stores/userPreferenceStore'
import { GlobalStyle } from './Styles/GlobalStyle'
const Providers: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const theme = useUserPreferenceStore((state) => state.theme)
const themeData = useMemo(() => {
const ctheme = defaultThemes.find((t) => t.id === theme)
return ctheme ? ctheme.themeData : defaultThemes[0].themeData
}, [theme])
return <ThemeProvider theme={themeData}>{children}</ThemeProvider>
}
export default function Index() {
return (
<Providers>
<GlobalStyle />
<ReminderArmer />
<SputlitProvider>
<HighlighterProvider>
<DibbaPortal>
<Dibba />
</DibbaPortal>
<Notification />
<EditorProvider>
<InternalEvents />
{/* TODO: think of a better name, and use it everywhere for consistency */}
<ExtInfoBar />
<TooltipPortal>
<Tooltip />
</TooltipPortal>
<SputlitPortal>
<Sputlit />
</SputlitPortal>
</EditorProvider>
</HighlighterProvider>
</SputlitProvider>
</Providers>
)
}