From f2fd1b3068a43c057243159f9228c8ef3aaa4428 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Fri, 28 Jun 2019 14:52:24 +0200 Subject: Fix settings window dependence --- src/components/layout/AppLayout.js | 126 ++++++++++++++-------------- src/containers/auth/AuthLayoutContainer.js | 8 +- src/containers/layout/AppLayoutContainer.js | 1 - src/containers/settings/SettingsWindow.js | 35 ++++++-- src/index.html | 1 + src/stores/UIStore.js | 28 ++++++- 6 files changed, 117 insertions(+), 82 deletions(-) (limited to 'src') diff --git a/src/components/layout/AppLayout.js b/src/components/layout/AppLayout.js index 499bc097a..ebb9849ea 100644 --- a/src/components/layout/AppLayout.js +++ b/src/components/layout/AppLayout.js @@ -68,7 +68,6 @@ class AppLayout extends Component { areRequiredRequestsSuccessful: PropTypes.bool.isRequired, retryRequiredRequests: PropTypes.func.isRequired, areRequiredRequestsLoading: PropTypes.bool.isRequired, - darkMode: PropTypes.bool.isRequired, isDelayAppScreenVisible: PropTypes.bool.isRequired, }; @@ -101,7 +100,6 @@ class AppLayout extends Component { areRequiredRequestsSuccessful, retryRequiredRequests, areRequiredRequestsLoading, - darkMode, isDelayAppScreenVisible, } = this.props; @@ -109,69 +107,67 @@ class AppLayout extends Component { return ( -
-
- {isWindows && !isFullScreen && } -
- {workspacesDrawer} - {sidebar} -
- - {news.length > 0 && news.map(item => ( - removeNewsItem({ newsId: item.id })} - > - - - ))} - {/* {!isOnline && ( - - - {intl.formatMessage(globalMessages.notConnectedToTheInternet)} - - )} */} - {!areRequiredRequestsSuccessful && showRequiredRequestsError && ( - - - {intl.formatMessage(messages.requiredRequestsFailed)} - - )} - {showServicesUpdatedInfoBar && ( - - - {intl.formatMessage(messages.servicesUpdated)} - - )} - {appUpdateIsDownloaded && ( - - )} - {isDelayAppScreenVisible && ()} - - - {services} - {children} -
+
+ {isWindows && !isFullScreen && } +
+ {workspacesDrawer} + {sidebar} +
+ + {news.length > 0 && news.map(item => ( + removeNewsItem({ newsId: item.id })} + > + + + ))} + {/* {!isOnline && ( + + + {intl.formatMessage(globalMessages.notConnectedToTheInternet)} + + )} */} + {!areRequiredRequestsSuccessful && showRequiredRequestsError && ( + + + {intl.formatMessage(messages.requiredRequestsFailed)} + + )} + {showServicesUpdatedInfoBar && ( + + + {intl.formatMessage(messages.servicesUpdated)} + + )} + {appUpdateIsDownloaded && ( + + )} + {isDelayAppScreenVisible && ()} + + + {services} + {children}
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 stores, actions, children, location, } = this.props; const { - app, features, globalError, settings, + app, features, globalError, } = stores; const isLoadingBaseFeatures = features.defaultFeaturesRequest.isExecuting && !features.defaultFeaturesRequest.wasExecuted; - const themeType = theme(settings.app.darkMode ? 'dark' : 'default'); - if (isLoadingBaseFeatures) { return ( - + ); } return ( - + {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 @@ import React, { Component } from 'react'; +import ReactDOM from 'react-dom'; import PropTypes from 'prop-types'; import { observer, inject } from 'mobx-react'; @@ -10,10 +11,23 @@ import ErrorBoundary from '../../components/util/ErrorBoundary'; import { workspaceStore } from '../../features/workspaces'; export default @inject('stores', 'actions') @observer class SettingsContainer extends Component { + portalRoot = document.querySelector('#portalContainer'); + + el = document.createElement('div'); + + componentDidMount() { + this.portalRoot.appendChild(this.el); + } + + componentWillUnmount() { + this.portalRoot.removeChild(this.el); + } + render() { const { children, stores } = this.props; const { closeSettings } = this.props.actions.ui; + const navigation = ( ); - return ( - - - {children} - - + return ReactDOM.createPortal( + ( + + + {children} + + + ), + this.el, ); } } diff --git a/src/index.html b/src/index.html index bf15e2d4e..f29aa2686 100644 --- a/src/index.html +++ b/src/index.html @@ -10,6 +10,7 @@
DEV MODE
+