From c474becd6113c614c27b84c93416879f5b7ff734 Mon Sep 17 00:00:00 2001 From: martin bedouret Date: Sat, 13 Nov 2021 21:05:06 -0300 Subject: [PATCH] fix bug on live mode --- .../Navigation/Navigation.component.js | 8 ++++++- .../Navigation/Navigation.container.js | 21 +++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/components/Settings/Navigation/Navigation.component.js b/src/components/Settings/Navigation/Navigation.component.js index c5b9172ac..d3adc7db9 100644 --- a/src/components/Settings/Navigation/Navigation.component.js +++ b/src/components/Settings/Navigation/Navigation.component.js @@ -20,7 +20,9 @@ const propTypes = { */ onClose: PropTypes.func, updateNavigationSettings: PropTypes.func.isRequired, - navigationSettings: PropTypes.object.isRequired + navigationSettings: PropTypes.object.isRequired, + isLiveMode: PropTypes.bool, + changeLiveMode: PropTypes.func.isRequired }; class Navigation extends React.Component { @@ -69,6 +71,10 @@ class Navigation extends React.Component { }; onSubmit = () => { + const { isLiveMode, changeLiveMode } = this.props; + if (!this.state.liveMode && isLiveMode) { + changeLiveMode(); + } this.props.updateNavigationSettings(this.state); }; diff --git a/src/components/Settings/Navigation/Navigation.container.js b/src/components/Settings/Navigation/Navigation.container.js index f0c9c7fe1..3be48ef5d 100644 --- a/src/components/Settings/Navigation/Navigation.container.js +++ b/src/components/Settings/Navigation/Navigation.container.js @@ -5,10 +5,13 @@ import { injectIntl, intlShape } from 'react-intl'; import { updateNavigationSettings } from '../../App/App.actions'; import Navigation from './Navigation.component'; import API from '../../../api'; +import { changeLiveMode } from '../../Board/Board.actions'; export class NavigationContainer extends PureComponent { static propTypes = { - intl: intlShape.isRequired + intl: intlShape.isRequired, + isLiveMode: PropTypes.bool, + changeLiveMode: PropTypes.func }; updateNavigationSettings = async navigationSettings => { @@ -19,12 +22,14 @@ export class NavigationContainer extends PureComponent { }; render() { - const { history } = this.props; + const { history, isLiveMode, changeLiveMode } = this.props; return ( ); @@ -37,12 +42,16 @@ NavigationContainer.props = { navigationSettings: PropTypes.object.isRequired }; -const mapStateToProps = ({ app: { navigationSettings } }) => ({ - navigationSettings -}); +const mapStateToProps = ({ board, app }) => { + return { + isLiveMode: board.isLiveMode, + navigationSettings: app.navigationSettings + }; +}; const mapDispatchToProps = { - updateNavigationSettingsAction: updateNavigationSettings + updateNavigationSettingsAction: updateNavigationSettings, + changeLiveMode }; export default connect(