Skip to content

Commit

Permalink
fix bug on live mode
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbedouret committed Nov 14, 2021
1 parent 5c36303 commit c474bec
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
8 changes: 7 additions & 1 deletion src/components/Settings/Navigation/Navigation.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
};

Expand Down
21 changes: 15 additions & 6 deletions src/components/Settings/Navigation/Navigation.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -19,12 +22,14 @@ export class NavigationContainer extends PureComponent {
};

render() {
const { history } = this.props;
const { history, isLiveMode, changeLiveMode } = this.props;

return (
<Navigation
{...this.props}
onClose={history.goBack}
isLiveMode={isLiveMode}
changeLiveMode={changeLiveMode}
updateNavigationSettings={this.updateNavigationSettings}
/>
);
Expand All @@ -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(
Expand Down

0 comments on commit c474bec

Please sign in to comment.