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/containers/auth/AuthLayoutContainer.js | 8 +++---- src/containers/layout/AppLayoutContainer.js | 1 - src/containers/settings/SettingsWindow.js | 35 +++++++++++++++++++++-------- 3 files changed, 29 insertions(+), 15 deletions(-) (limited to 'src/containers') 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, ); } } -- cgit v1.2.3-54-g00ecf