You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-05 23:10:41 +03:00
toggle right panel when clicking already active header button
This commit is contained in:
@@ -36,6 +36,7 @@ export default class HeaderButton extends React.Component {
|
|||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_right_panel_phase',
|
action: 'view_right_panel_phase',
|
||||||
phase: this.props.clickPhase,
|
phase: this.props.clickPhase,
|
||||||
|
fromHeader: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,9 +49,24 @@ export default class HeaderButtons extends React.Component {
|
|||||||
|
|
||||||
onAction(payload) {
|
onAction(payload) {
|
||||||
if (payload.action === "view_right_panel_phase") {
|
if (payload.action === "view_right_panel_phase") {
|
||||||
this.setState({
|
// only actions coming from header buttons should collapse the right panel
|
||||||
phase: payload.phase,
|
if (this.state.phase === payload.phase && payload.fromHeader) {
|
||||||
});
|
dis.dispatch({
|
||||||
|
action: 'hide_right_panel',
|
||||||
|
});
|
||||||
|
this.setState({
|
||||||
|
phase: null,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (!this.state.phase) {
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'show_right_panel',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
phase: payload.phase,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user