Disable the right panel when the app asks us to

Currently this is only used in the GroupView and for forwarding messages.
This commit is contained in:
Travis Ralston 2019-12-06 14:18:18 -07:00
parent a24bbdffd0
commit 814c408e23
3 changed files with 10 additions and 14 deletions

View file

@ -177,7 +177,7 @@ export default createReactClass({
collapseLhs: false, collapseLhs: false,
leftDisabled: false, leftDisabled: false,
middleDisabled: false, middleDisabled: false,
rightDisabled: false, // the right panel's disabled state is tracked in its store.
version: null, version: null,
newVersion: null, newVersion: null,
@ -660,7 +660,7 @@ export default createReactClass({
this.setState({ this.setState({
leftDisabled: payload.leftDisabled || payload.sideDisabled || false, leftDisabled: payload.leftDisabled || payload.sideDisabled || false,
middleDisabled: payload.middleDisabled || false, middleDisabled: payload.middleDisabled || false,
rightDisabled: payload.rightDisabled || payload.sideDisabled || false, // We don't track the right panel being disabled here - it's tracked in the store.
}); });
break; break;
} }

View file

@ -108,20 +108,9 @@ module.exports = createReactClass({
), ),
}); });
}); });
// dis.dispatch({
// action: 'panel_disable',
// sideDisabled: true,
// middleDisabled: true,
// });
}, },
componentWillUnmount: function() { componentWillUnmount: function() {
// dis.dispatch({
// action: 'panel_disable',
// sideDisabled: false,
// middleDisabled: false,
// });
if (this.filterTimeout) { if (this.filterTimeout) {
clearTimeout(this.filterTimeout); clearTimeout(this.filterTimeout);
} }

View file

@ -39,6 +39,8 @@ const GROUP_PHASES = Object.keys(RIGHT_PANEL_PHASES).filter(k => k.startsWith("G
export default class RightPanelStore extends Store { export default class RightPanelStore extends Store {
static _instance; static _instance;
_inhibitUpdates = false;
constructor() { constructor() {
super(dis); super(dis);
@ -107,7 +109,12 @@ export default class RightPanelStore extends Store {
} }
__onDispatch(payload) { __onDispatch(payload) {
if (payload.action !== 'set_right_panel_phase') return; if (payload.action === 'panel_disable') {
this._inhibitUpdates = payload.rightDisabled || payload.sideDisabled || false;
return;
}
if (payload.action !== 'set_right_panel_phase' || this._inhibitUpdates) return;
const targetPhase = payload.phase; const targetPhase = payload.phase;
if (!RIGHT_PANEL_PHASES[targetPhase]) { if (!RIGHT_PANEL_PHASES[targetPhase]) {