generated from ZanzyTHEbar/SolidJSTauri
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathApp.tsx
More file actions
44 lines (39 loc) · 1.39 KB
/
App.tsx
File metadata and controls
44 lines (39 loc) · 1.39 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
import { NOTIFICATION_ACTION } from '@interfaces/notifications/enums'
import { checkPermission } from '@store/actions/notifications/checkPermission'
import {
setEnableNotifications,
setEnableNotificationsSounds,
setGlobalNotificationsType,
} from '@store/notifications/notifications'
import { debug } from '@tauri-apps/plugin-log'
import { lazy, onMount, Suspense } from 'solid-js'
import { Toaster } from 'solid-sonner'
import { usePersistentStore } from './persistenStore'
import { runWatchers } from './watchers'
const Modals = lazy(() => import('@containers/Modals'))
const AppRoutes = lazy(() => import('@routes/Routes'))
const App = () => {
const { get } = usePersistentStore()
onMount(() => {
get('settings').then((settings) => {
if (settings) {
debug('loading settings')
setEnableNotifications(settings.enableNotifications)
setEnableNotificationsSounds(settings.enableNotificationsSounds)
setGlobalNotificationsType(
settings.globalNotificationsType ?? NOTIFICATION_ACTION.APP,
)
}
})
checkPermission()
runWatchers()
})
return (
<Suspense>
<Modals />
<AppRoutes />
<Toaster position="top-center" visibleToasts={4} duration={3000} />
</Suspense>
)
}
export default App