From 919580fd10d9b88b3adeeb10ab5a61e11554ff0f Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Tue, 12 Sep 2023 20:48:29 +0530 Subject: [PATCH] Rename setPhase to showOrHidePanel --- src/components/structures/RoomView.tsx | 6 +++--- .../views/right_panel/LegacyRoomHeaderButtons.tsx | 12 ++++++------ src/components/views/rooms/RoomHeader.tsx | 8 ++++---- src/stores/right-panel/RightPanelStore.ts | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index bb2e9e502c..b2f2e89500 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -1267,16 +1267,16 @@ export class RoomView extends React.Component { ]); } } else { - RightPanelStore.instance.setPhase(RightPanelPhases.RoomMemberList); + RightPanelStore.instance.showOrHidePanel(RightPanelPhases.RoomMemberList); } break; case "view_3pid_invite": if (payload.event) { - RightPanelStore.instance.setPhase(RightPanelPhases.Room3pidMemberInfo, { + RightPanelStore.instance.showOrHidePanel(RightPanelPhases.Room3pidMemberInfo, { memberInfoEvent: payload.event, }); } else { - RightPanelStore.instance.setPhase(RightPanelPhases.RoomMemberList); + RightPanelStore.instance.showOrHidePanel(RightPanelPhases.RoomMemberList); } break; } diff --git a/src/components/views/right_panel/LegacyRoomHeaderButtons.tsx b/src/components/views/right_panel/LegacyRoomHeaderButtons.tsx index 61594eb66d..43c3fcb762 100644 --- a/src/components/views/right_panel/LegacyRoomHeaderButtons.tsx +++ b/src/components/views/right_panel/LegacyRoomHeaderButtons.tsx @@ -209,27 +209,27 @@ export default class LegacyRoomHeaderButtons extends HeaderButtons { const currentPhase = RightPanelStore.instance.currentCard.phase; if (currentPhase && ROOM_INFO_PHASES.includes(currentPhase)) { if (this.state.phase === currentPhase) { - RightPanelStore.instance.setPhase(currentPhase); + RightPanelStore.instance.showOrHidePanel(currentPhase); } else { - RightPanelStore.instance.setPhase(currentPhase, RightPanelStore.instance.currentCard.state); + RightPanelStore.instance.showOrHidePanel(currentPhase, RightPanelStore.instance.currentCard.state); } } else { // This toggles for us, if needed - RightPanelStore.instance.setPhase(RightPanelPhases.RoomSummary); + RightPanelStore.instance.showOrHidePanel(RightPanelPhases.RoomSummary); } }; private onNotificationsClicked = (): void => { // This toggles for us, if needed - RightPanelStore.instance.setPhase(RightPanelPhases.NotificationPanel); + RightPanelStore.instance.showOrHidePanel(RightPanelPhases.NotificationPanel); }; private onPinnedMessagesClicked = (): void => { // This toggles for us, if needed - RightPanelStore.instance.setPhase(RightPanelPhases.PinnedMessages); + RightPanelStore.instance.showOrHidePanel(RightPanelPhases.PinnedMessages); }; private onTimelineCardClicked = (): void => { - RightPanelStore.instance.setPhase(RightPanelPhases.Timeline); + RightPanelStore.instance.showOrHidePanel(RightPanelPhases.Timeline); }; private onThreadsPanelClicked = (ev: ButtonEvent): void => { diff --git a/src/components/views/rooms/RoomHeader.tsx b/src/components/views/rooms/RoomHeader.tsx index 7b690d8e28..56f2af3a22 100644 --- a/src/components/views/rooms/RoomHeader.tsx +++ b/src/components/views/rooms/RoomHeader.tsx @@ -107,7 +107,7 @@ export default function RoomHeader({ room }: { room: Room }): JSX.Element { gap="var(--cpd-space-3x)" className="mx_RoomHeader light-panel" onClick={() => { - RightPanelStore.instance.setPhase(RightPanelPhases.RoomSummary); + RightPanelStore.instance.showOrHidePanel(RightPanelPhases.RoomSummary); }} > @@ -195,7 +195,7 @@ export default function RoomHeader({ room }: { room: Room }): JSX.Element { indicator={notificationColorToIndicator(threadNotifications)} onClick={(evt) => { evt.stopPropagation(); - RightPanelStore.instance.setPhase(RightPanelPhases.ThreadPanel); + RightPanelStore.instance.showOrHidePanel(RightPanelPhases.ThreadPanel); }} title={_t("common|threads")} > @@ -207,7 +207,7 @@ export default function RoomHeader({ room }: { room: Room }): JSX.Element { indicator={notificationColorToIndicator(globalNotificationState.color)} onClick={(evt) => { evt.stopPropagation(); - RightPanelStore.instance.setPhase(RightPanelPhases.NotificationPanel); + RightPanelStore.instance.showOrHidePanel(RightPanelPhases.NotificationPanel); }} title={_t("Notifications")} > @@ -222,7 +222,7 @@ export default function RoomHeader({ room }: { room: Room }): JSX.Element { weight="medium" aria-label={_t("%(count)s members", { count: memberCount })} onClick={(e: React.MouseEvent) => { - RightPanelStore.instance.setPhase(RightPanelPhases.RoomMemberList); + RightPanelStore.instance.showOrHidePanel(RightPanelPhases.RoomMemberList); e.stopPropagation(); }} > diff --git a/src/stores/right-panel/RightPanelStore.ts b/src/stores/right-panel/RightPanelStore.ts index d975bd9a3b..3c0084ece7 100644 --- a/src/stores/right-panel/RightPanelStore.ts +++ b/src/stores/right-panel/RightPanelStore.ts @@ -236,7 +236,7 @@ export default class RightPanelStore extends ReadyWatchingStore { * @param phase The right panel phase. * @param cardState The state within the phase. */ - public setPhase(phase: RightPanelPhases, cardState?: Partial): void { + public showOrHidePanel(phase: RightPanelPhases, cardState?: Partial): void { if (this.currentCard.phase == phase && !cardState && this.isOpen) { this.togglePanel(null); } else {