diff options
author | 2022-06-26 23:59:32 +0200 | |
---|---|---|
committer | 2022-06-26 21:59:32 +0000 | |
commit | 6bff2bb5439d25e0ab2a24a8ca1b28b89ef40ff9 (patch) | |
tree | 1676f5eef42b8086d28476c7eaad62c7b1753120 /src/containers/auth/AuthLayoutContainer.js | |
parent | Reduce tab item layout shift (#376) (diff) | |
download | ferdium-app-6bff2bb5439d25e0ab2a24a8ca1b28b89ef40ff9.tar.gz ferdium-app-6bff2bb5439d25e0ab2a24a8ca1b28b89ef40ff9.tar.zst ferdium-app-6bff2bb5439d25e0ab2a24a8ca1b28b89ef40ff9.zip |
chore: turned all auth containers into typescript (#375)
Diffstat (limited to 'src/containers/auth/AuthLayoutContainer.js')
-rw-r--r-- | src/containers/auth/AuthLayoutContainer.js | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/src/containers/auth/AuthLayoutContainer.js b/src/containers/auth/AuthLayoutContainer.js deleted file mode 100644 index e6d6dcf8a..000000000 --- a/src/containers/auth/AuthLayoutContainer.js +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | import { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { inject, observer } from 'mobx-react'; | ||
4 | import { ThemeProvider } from 'react-jss'; | ||
5 | |||
6 | import AuthLayout from '../../components/auth/AuthLayout'; | ||
7 | import AppStore from '../../stores/AppStore'; | ||
8 | import UserStore from '../../stores/UserStore'; | ||
9 | import GlobalErrorStore from '../../stores/GlobalErrorStore'; | ||
10 | import UIStore from '../../stores/UIStore'; | ||
11 | import SettingsStore from '../../stores/SettingsStore'; | ||
12 | import AppLoader from '../../components/ui/AppLoader'; | ||
13 | |||
14 | import { oneOrManyChildElements } from '../../prop-types'; | ||
15 | import FeaturesStore from '../../stores/FeaturesStore'; | ||
16 | |||
17 | class AuthLayoutContainer extends Component { | ||
18 | static propTypes = { | ||
19 | children: oneOrManyChildElements.isRequired, | ||
20 | location: PropTypes.shape({ | ||
21 | pathname: PropTypes.string.isRequired, | ||
22 | }).isRequired, | ||
23 | }; | ||
24 | |||
25 | render() { | ||
26 | const { stores, actions, children, location } = this.props; | ||
27 | const { app, features, globalError, user } = stores; | ||
28 | |||
29 | const isLoadingBaseFeatures = | ||
30 | features.defaultFeaturesRequest.isExecuting && | ||
31 | !features.defaultFeaturesRequest.wasExecuted; | ||
32 | |||
33 | if (isLoadingBaseFeatures) { | ||
34 | return ( | ||
35 | <ThemeProvider theme={stores.ui.theme}> | ||
36 | <AppLoader /> | ||
37 | </ThemeProvider> | ||
38 | ); | ||
39 | } | ||
40 | |||
41 | const { isLoggingOut } = user; | ||
42 | if (isLoggingOut) { | ||
43 | return ( | ||
44 | <ThemeProvider theme={stores.ui.theme}> | ||
45 | <AppLoader texts={['Logging you out...']} /> | ||
46 | </ThemeProvider> | ||
47 | ); | ||
48 | } | ||
49 | |||
50 | return ( | ||
51 | <ThemeProvider theme={stores.ui.theme}> | ||
52 | <AuthLayout | ||
53 | error={globalError.response} | ||
54 | pathname={location.pathname} | ||
55 | isOnline={app.isOnline} | ||
56 | isAPIHealthy={!app.healthCheckRequest.isError} | ||
57 | retryHealthCheck={actions.app.healthCheck} | ||
58 | isHealthCheckLoading={app.healthCheckRequest.isExecuting} | ||
59 | isFullScreen={app.isFullScreen} | ||
60 | installAppUpdate={actions.app.installUpdate} | ||
61 | appUpdateIsDownloaded={ | ||
62 | app.updateStatus === app.updateStatusTypes.DOWNLOADED | ||
63 | } | ||
64 | > | ||
65 | {children} | ||
66 | </AuthLayout> | ||
67 | </ThemeProvider> | ||
68 | ); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | AuthLayoutContainer.propTypes = { | ||
73 | stores: PropTypes.shape({ | ||
74 | app: PropTypes.instanceOf(AppStore).isRequired, | ||
75 | features: PropTypes.instanceOf(FeaturesStore).isRequired, | ||
76 | globalError: PropTypes.instanceOf(GlobalErrorStore).isRequired, | ||
77 | user: PropTypes.instanceOf(UserStore).isRequired, | ||
78 | ui: PropTypes.instanceOf(UIStore).isRequired, | ||
79 | }).isRequired, | ||
80 | actions: PropTypes.shape({ | ||
81 | app: PropTypes.instanceOf(AppStore).isRequired, | ||
82 | settings: PropTypes.instanceOf(SettingsStore).isRequired, | ||
83 | }).isRequired, | ||
84 | }; | ||
85 | |||
86 | export default inject('stores', 'actions')(observer(AuthLayoutContainer)); | ||