Update Right Panel phase recall behaviour

This commit is contained in:
Michael Telatynski 2020-08-28 10:52:04 +01:00
parent 2527344294
commit 8f94a42daf
2 changed files with 11 additions and 5 deletions

View file

@ -47,10 +47,10 @@ export default class RightPanel extends React.Component {
constructor(props, context) { constructor(props, context) {
super(props, context); super(props, context);
this.state = { this.state = {
...RightPanelStore.getSharedInstance().roomPanelPhaseParams,
phase: this._getPhaseFromProps(), phase: this._getPhaseFromProps(),
isUserPrivilegedInGroup: null, isUserPrivilegedInGroup: null,
member: this._getUserForPanel(), member: this._getUserForPanel(),
verificationRequest: RightPanelStore.getSharedInstance().roomPanelPhaseParams.verificationRequest,
}; };
this.onAction = this.onAction.bind(this); this.onAction = this.onAction.bind(this);
this.onRoomStateMember = this.onRoomStateMember.bind(this); this.onRoomStateMember = this.onRoomStateMember.bind(this);
@ -102,10 +102,6 @@ export default class RightPanel extends React.Component {
} }
return RightPanelPhases.RoomMemberInfo; return RightPanelPhases.RoomMemberInfo;
} else { } else {
if (!RIGHT_PANEL_PHASES_NO_ARGS.includes(rps.roomPanelPhase)) {
dis.dispatch({action: Action.SetRightPanelPhase, phase: RightPanelPhases.RoomMemberList});
return RightPanelPhases.RoomMemberList;
}
return rps.roomPanelPhase; return rps.roomPanelPhase;
} }
} }

View file

@ -33,6 +33,8 @@ interface RightPanelStoreState {
lastRoomPhase: RightPanelPhases; lastRoomPhase: RightPanelPhases;
lastGroupPhase: RightPanelPhases; lastGroupPhase: RightPanelPhases;
previousPhase?: RightPanelPhases;
// Extra information about the last phase // Extra information about the last phase
lastRoomPhaseParams: {[key: string]: any}; lastRoomPhaseParams: {[key: string]: any};
} }
@ -89,6 +91,10 @@ export default class RightPanelStore extends Store<ActionPayload> {
return this.state.lastGroupPhase; return this.state.lastGroupPhase;
} }
get previousPhase(): RightPanelPhases | null {
return RIGHT_PANEL_PHASES_NO_ARGS.includes(this.state.previousPhase) ? this.state.previousPhase : null;
}
get visibleRoomPanelPhase(): RightPanelPhases { get visibleRoomPanelPhase(): RightPanelPhases {
return this.isOpenForRoom ? this.roomPanelPhase : null; return this.isOpenForRoom ? this.roomPanelPhase : null;
} }
@ -176,23 +182,27 @@ export default class RightPanelStore extends Store<ActionPayload> {
if (targetPhase === this.state.lastGroupPhase) { if (targetPhase === this.state.lastGroupPhase) {
this.setState({ this.setState({
showGroupPanel: !this.state.showGroupPanel, showGroupPanel: !this.state.showGroupPanel,
previousPhase: null,
}); });
} else { } else {
this.setState({ this.setState({
lastGroupPhase: targetPhase, lastGroupPhase: targetPhase,
showGroupPanel: true, showGroupPanel: true,
previousPhase: this.state.lastGroupPhase,
}); });
} }
} else { } else {
if (targetPhase === this.state.lastRoomPhase && !refireParams) { if (targetPhase === this.state.lastRoomPhase && !refireParams) {
this.setState({ this.setState({
showRoomPanel: !this.state.showRoomPanel, showRoomPanel: !this.state.showRoomPanel,
previousPhase: null,
}); });
} else { } else {
this.setState({ this.setState({
lastRoomPhase: targetPhase, lastRoomPhase: targetPhase,
showRoomPanel: true, showRoomPanel: true,
lastRoomPhaseParams: refireParams || {}, lastRoomPhaseParams: refireParams || {},
previousPhase: this.state.lastRoomPhase,
}); });
} }
} }