@@ -96,6 +96,8 @@ import { dispatchShowThreadEvent } from '../../dispatcher/dispatch-actions/threa
9696import { fetchInitialEvent } from "../../utils/EventUtils" ;
9797import { ComposerType } from "../../dispatcher/payloads/ComposerInsertPayload" ;
9898import AppsDrawer from '../views/rooms/AppsDrawer' ;
99+ import { SetRightPanelPhasePayload } from '../../dispatcher/payloads/SetRightPanelPhasePayload' ;
100+ import { RightPanelPhases } from '../../stores/RightPanelStorePhases' ;
99101
100102const DEBUG = false ;
101103let debuglog = function ( msg : string ) { } ;
@@ -327,7 +329,15 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
327329
328330 private onWidgetLayoutChange = ( ) => {
329331 if ( ! this . state . room ) return ;
332+ if ( WidgetLayoutStore . instance . hasMaximisedWidget ( this . state . room ) ) {
333+ // Show chat in right panel when a widget is maximised
334+ dis . dispatch < SetRightPanelPhasePayload > ( {
335+ action : Action . SetRightPanelPhase ,
336+ phase : RightPanelPhases . Timeline ,
337+ } ) ;
338+ }
330339 this . checkWidgets ( this . state . room ) ;
340+ this . checkRightPanel ( this . state . room ) ;
331341 } ;
332342
333343 private checkWidgets = ( room ) => {
@@ -345,6 +355,22 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
345355 : MainSplitContentType . Timeline ;
346356 } ;
347357
358+ private checkRightPanel = ( room ) => {
359+ // This is a hack to hide the chat. This should not be necessary once the right panel
360+ // phase is stored per room. (need to be done after check widget so that mainSplitContentType is updated)
361+ if (
362+ RightPanelStore . getSharedInstance ( ) . roomPanelPhase === RightPanelPhases . Timeline &&
363+ this . state . showRightPanel &&
364+ ! WidgetLayoutStore . instance . hasMaximisedWidget ( this . state . room )
365+ ) {
366+ // Two timelines are shown prevent this by hiding the right panel
367+ dis . dispatch ( {
368+ action : Action . ToggleRightPanel ,
369+ type : "room" ,
370+ } ) ;
371+ }
372+ } ;
373+
348374 private onReadReceiptsChange = ( ) => {
349375 this . setState ( {
350376 showReadReceipts : SettingsStore . getValue ( "showReadReceipts" , this . state . roomId ) ,
@@ -1007,6 +1033,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
10071033 this . updateE2EStatus ( room ) ;
10081034 this . updatePermissions ( room ) ;
10091035 this . checkWidgets ( room ) ;
1036+ this . checkRightPanel ( room ) ;
10101037
10111038 this . setState ( {
10121039 liveTimeline : room . getLiveTimeline ( ) ,
@@ -2102,6 +2129,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
21022129 }
21032130
21042131 const showRightPanel = this . state . room && this . state . showRightPanel ;
2132+
21052133 const rightPanel = showRightPanel
21062134 ? < RightPanel
21072135 room = { this . state . room }
0 commit comments