-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
95 lines (88 loc) · 2.74 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
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
import React, {useEffect } from 'react';
import bridge from '@vkontakte/vk-bridge';
import './styles/Global.scss'
import "@ionic/react/css/padding.css";
import "@ionic/react/css/float-elements.css";
import "@ionic/react/css/text-alignment.css";
import "@ionic/react/css/text-transformation.css";
import "@ionic/react/css/flex-utils.css";
import "@ionic/react/css/display.css";
import {setupIonicReact, IonApp, IonContent, IonPage, IonHeader} from "@ionic/react";
import AppHeader from "./components/appHeader/AppHeader";
import {BrowserRouter as Router} from "react-router-dom";
import {createTheme, ThemeProvider} from "@mui/material/styles";
import Navbar from "./components/navbar/Navbar";
import ProjectRoutes from "./components/projectRoot/ProjectRoutes";
import ModalPage from "./components/modalPage/ModalPage";
import {Modal} from "./modules/Modal";
import Grades from "./pages/schedule/scheduleModalPages/Grades";
import Subjects from "./pages/subjects/Subjects";
import ScheduleType from "./pages/schedule/scheduleModalPages/ScheduleType";
import Teachers from "./pages/schedule/scheduleModalPages/Teachers";
import {useLoadUserData} from "./hooks/useLoadUserData";
import PwaInstallerModal from "./components/pwaInstallerModal/PwaInstallerModal";
import '@ionic/core/dist/ionic/index.esm';
import '@ionic/core/dist/ionic/ionic.js';
import '@ionic/core/css/ionic.bundle.css';
import {Grid} from "@mui/material";
import getNames from "./modules/api/getNames";
import {setClasses, setTeachers} from "./modules/effector/TimetableStore";
setupIonicReact({
mode: 'ios',
animated: true,
rippleEffect: true,
});
const darkTheme = createTheme({
palette: {
mode: 'dark',
},
});
const App = () => {
getNames("group").then(setClasses);
getNames("teacher").then(setTeachers);
useEffect(() => {
bridge.send("VKWebAppInit", {});
}, []);
useEffect(() => {
useLoadUserData()
}, [])
return (
<ThemeProvider theme={darkTheme}>
<IonApp>
<IonContent>
<Router>
<IonPage>
<Navbar/>
<IonHeader>
<AppHeader />
</IonHeader>
<IonContent>
<Grid className="panel" overflow={'scroll'} height={'100%'}>
<ProjectRoutes />
<div className="end"/>
</Grid>
<PwaInstallerModal />
<ModalPage name={Modal.Grades}>
<Grades />
</ModalPage>
<ModalPage name={Modal.Grades}>
<Grades />
</ModalPage>
<ModalPage name={Modal.Subjects}>
<Subjects />
</ModalPage>
<ModalPage name={Modal.Type}>
<ScheduleType />
</ModalPage>
<ModalPage name={Modal.Teachers}>
<Teachers />
</ModalPage>
</IonContent>
</IonPage>
</Router>
</IonContent>
</IonApp>
</ThemeProvider>
);
}
export default App;