-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
43 lines (38 loc) · 1.43 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
import { useState, useContext, useEffect } from "react";
import { Layout } from "./components/common/Layout";
import { RecordingList } from "./components/RecordingList";
import { ScreenRecorder } from "./components/ScreenRecorder";
import { MobileWarning } from "./components/common/MobileWarning";
import { LoadingOverlay } from "./components/common/LoadingOverlay";
import { IRecording } from "./lib/models";
import { useAppDispatch } from "./lib/hooks";
import { setLoggedIn } from "./lib/slices/user";
import { SkynetContext } from "src/lib/skynetContext";
import "./Global.css";
function App() {
// Initialize Redux state
const skynetState = useContext(SkynetContext);
const loggedIn = skynetState?.loggedIn ? skynetState.loggedIn : false;
const dispatch = useAppDispatch();
dispatch(setLoggedIn(loggedIn));
// Initialize Local state
const [recordings, setRecordings] = useState<IRecording[]>([]);
const [loading, setLoading] = useState<boolean>(true);
useEffect(() => {
if (skynetState?.mySky) {
setLoading(false);
}
}, [skynetState]);
return (
<Layout>
<ScreenRecorder
recordings={recordings}
setRecordings={setRecordings}
/>
{/* <RecordingList recordings={recordings} /> */}
<MobileWarning />
{loading ? <LoadingOverlay /> : null}
</Layout>
);
}
export default App;