From ef9e310a25291cffb36145ee01ad33dc67b745a7 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 27 Sep 2024 15:10:33 +0100 Subject: [PATCH] Pop right panel timeline when unmaximising widget to avoid double timeline (#94) Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/AppTile.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/views/elements/AppTile.tsx b/src/components/views/elements/AppTile.tsx index 9ff38b8222..011f9a446e 100644 --- a/src/components/views/elements/AppTile.tsx +++ b/src/components/views/elements/AppTile.tsx @@ -50,6 +50,8 @@ import { WidgetMessagingStore } from "../../../stores/widgets/WidgetMessagingSto import { SdkContextClass } from "../../../contexts/SDKContext"; import { ModuleRunner } from "../../../modules/ModuleRunner"; import { parseUrl } from "../../../utils/UrlUtils"; +import RightPanelStore from "../../../stores/right-panel/RightPanelStore.ts"; +import { RightPanelPhases } from "../../../stores/right-panel/RightPanelStorePhases.ts"; interface IProps { app: IWidget | IApp; @@ -576,6 +578,14 @@ export default class AppTile extends React.Component { ? Container.Top : Container.Center; WidgetLayoutStore.instance.moveToContainer(this.props.room, this.props.app, targetContainer); + + // If the right panel has a timeline, but we're about to show the timeline in the main view, pop the right panel + if ( + targetContainer === Container.Top && + RightPanelStore.instance.currentCardForRoom(this.props.room.roomId).phase === RightPanelPhases.Timeline + ) { + RightPanelStore.instance.popCard(this.props.room.roomId); + } }; private onMinimiseClicked = (): void => {