aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-06-28 14:52:24 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-06-28 14:52:24 +0200
commitf2fd1b3068a43c057243159f9228c8ef3aaa4428 (patch)
treee16b3daf3cde58d4e71d40f1c157af93b76051f7 /src/containers
parentRevert: fix spellchecker (diff)
downloadferdium-app-f2fd1b3068a43c057243159f9228c8ef3aaa4428.tar.gz
ferdium-app-f2fd1b3068a43c057243159f9228c8ef3aaa4428.tar.zst
ferdium-app-f2fd1b3068a43c057243159f9228c8ef3aaa4428.zip
Fix settings window dependence
Diffstat (limited to 'src/containers')
-rw-r--r--src/containers/auth/AuthLayoutContainer.js8
-rw-r--r--src/containers/layout/AppLayoutContainer.js1
-rw-r--r--src/containers/settings/SettingsWindow.js35
3 files changed, 29 insertions, 15 deletions
diff --git a/src/containers/auth/AuthLayoutContainer.js b/src/containers/auth/AuthLayoutContainer.js
index 1f9c1ea61..20b88c500 100644
--- a/src/containers/auth/AuthLayoutContainer.js
+++ b/src/containers/auth/AuthLayoutContainer.js
@@ -24,24 +24,22 @@ export default @inject('stores', 'actions') @observer class AuthLayoutContainer
24 stores, actions, children, location, 24 stores, actions, children, location,
25 } = this.props; 25 } = this.props;
26 const { 26 const {
27 app, features, globalError, settings, 27 app, features, globalError,
28 } = stores; 28 } = stores;
29 29
30 const isLoadingBaseFeatures = features.defaultFeaturesRequest.isExecuting 30 const isLoadingBaseFeatures = features.defaultFeaturesRequest.isExecuting
31 && !features.defaultFeaturesRequest.wasExecuted; 31 && !features.defaultFeaturesRequest.wasExecuted;
32 32
33 const themeType = theme(settings.app.darkMode ? 'dark' : 'default');
34
35 if (isLoadingBaseFeatures) { 33 if (isLoadingBaseFeatures) {
36 return ( 34 return (
37 <ThemeProvider theme={theme(themeType)}> 35 <ThemeProvider theme={stores.ui.theme}>
38 <AppLoader /> 36 <AppLoader />
39 </ThemeProvider> 37 </ThemeProvider>
40 ); 38 );
41 } 39 }
42 40
43 return ( 41 return (
44 <ThemeProvider theme={theme(themeType)}> 42 <ThemeProvider theme={stores.ui.theme}>
45 <AuthLayout 43 <AuthLayout
46 error={globalError.response} 44 error={globalError.response}
47 pathname={location.pathname} 45 pathname={location.pathname}
diff --git a/src/containers/layout/AppLayoutContainer.js b/src/containers/layout/AppLayoutContainer.js
index d290a6094..cf3da71e8 100644
--- a/src/containers/layout/AppLayoutContainer.js
+++ b/src/containers/layout/AppLayoutContainer.js
@@ -148,7 +148,6 @@ export default @inject('stores', 'actions') @observer class AppLayoutContainer e
148 areRequiredRequestsSuccessful={requests.areRequiredRequestsSuccessful} 148 areRequiredRequestsSuccessful={requests.areRequiredRequestsSuccessful}
149 retryRequiredRequests={retryRequiredRequests} 149 retryRequiredRequests={retryRequiredRequests}
150 areRequiredRequestsLoading={requests.areRequiredRequestsLoading} 150 areRequiredRequestsLoading={requests.areRequiredRequestsLoading}
151 darkMode={settings.all.app.darkMode}
152 isDelayAppScreenVisible={delayAppState.isDelayAppScreenVisible} 151 isDelayAppScreenVisible={delayAppState.isDelayAppScreenVisible}
153 > 152 >
154 {React.Children.count(children) > 0 ? children : null} 153 {React.Children.count(children) > 0 ? children : null}
diff --git a/src/containers/settings/SettingsWindow.js b/src/containers/settings/SettingsWindow.js
index 663b9e2e4..440d32a46 100644
--- a/src/containers/settings/SettingsWindow.js
+++ b/src/containers/settings/SettingsWindow.js
@@ -1,4 +1,5 @@
1import React, { Component } from 'react'; 1import React, { Component } from 'react';
2import ReactDOM from 'react-dom';
2import PropTypes from 'prop-types'; 3import PropTypes from 'prop-types';
3import { observer, inject } from 'mobx-react'; 4import { observer, inject } from 'mobx-react';
4 5
@@ -10,10 +11,23 @@ import ErrorBoundary from '../../components/util/ErrorBoundary';
10import { workspaceStore } from '../../features/workspaces'; 11import { workspaceStore } from '../../features/workspaces';
11 12
12export default @inject('stores', 'actions') @observer class SettingsContainer extends Component { 13export default @inject('stores', 'actions') @observer class SettingsContainer extends Component {
14 portalRoot = document.querySelector('#portalContainer');
15
16 el = document.createElement('div');
17
18 componentDidMount() {
19 this.portalRoot.appendChild(this.el);
20 }
21
22 componentWillUnmount() {
23 this.portalRoot.removeChild(this.el);
24 }
25
13 render() { 26 render() {
14 const { children, stores } = this.props; 27 const { children, stores } = this.props;
15 const { closeSettings } = this.props.actions.ui; 28 const { closeSettings } = this.props.actions.ui;
16 29
30
17 const navigation = ( 31 const navigation = (
18 <Navigation 32 <Navigation
19 serviceCount={stores.services.all.length} 33 serviceCount={stores.services.all.length}
@@ -21,15 +35,18 @@ export default @inject('stores', 'actions') @observer class SettingsContainer ex
21 /> 35 />
22 ); 36 );
23 37
24 return ( 38 return ReactDOM.createPortal(
25 <ErrorBoundary> 39 (
26 <Layout 40 <ErrorBoundary>
27 navigation={navigation} 41 <Layout
28 closeSettings={closeSettings} 42 navigation={navigation}
29 > 43 closeSettings={closeSettings}
30 {children} 44 >
31 </Layout> 45 {children}
32 </ErrorBoundary> 46 </Layout>
47 </ErrorBoundary>
48 ),
49 this.el,
33 ); 50 );
34 } 51 }
35} 52}