-
Notifications
You must be signed in to change notification settings - Fork 10
/
App.tsx
53 lines (49 loc) · 1.65 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
import { useEffect } from 'react';
import { observer } from 'mobx-react-lite';
import './App.scss';
import OtaUpdating from 'component/OtaUpdating/OtaUpdating';
import Main from './Main';
import Setup from 'component/Setup/Setup';
import { useStore } from './context/store';
import Settings from 'component/Settings/Settings';
import Onboarding from 'component/Onboarding/Onboarding';
import { AppView } from 'store/ViewStore';
import RootErrorBoundary from 'component/RootErrorBoundary/RootErrorBoundary';
import SpotifySplash from "./component/CarthingUIComponents/SpotifySplash/SpotifySplash";
import { GlobalStyles } from "./@spotify-internal/encore-web/es/components/GlobalStyles";
const App = () => {
const { onboardingStore, viewStore, nightModeController } =
useStore();
useEffect(() => {
onboardingStore.requestOnboardingStatus();
}, [onboardingStore]);
if (viewStore.appView === AppView.NOTHING) {
return null;
}
const settingsEnabled = viewStore.appView !== AppView.LOGO;
return (
<div
id="container"
data-testid="app"
style={{
opacity: `${nightModeController.nightModeUiState.appOpacity}`,
}}
>
<img id="corners" alt="" src="images/round-corners.svg" />
<GlobalStyles />
<RootErrorBoundary>
{settingsEnabled && <Settings />}
{
{
[AppView.LOGO]: <SpotifySplash />,
[AppView.SETUP]: <Setup />,
[AppView.OTA]: <OtaUpdating />,
[AppView.ONBOARDING]: <Onboarding />,
[AppView.MAIN]: <Main />,
}[viewStore.appView]
}
</RootErrorBoundary>
</div>
);
};
export default observer(App);