Rename setPhase to showOrHidePanel

This commit is contained in:
RMidhunSuresh 2023-09-12 20:48:29 +05:30
parent 89fa7b4b39
commit 919580fd10
No known key found for this signature in database
4 changed files with 14 additions and 14 deletions

View file

@ -1267,16 +1267,16 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
]); ]);
} }
} else { } else {
RightPanelStore.instance.setPhase(RightPanelPhases.RoomMemberList); RightPanelStore.instance.showOrHidePanel(RightPanelPhases.RoomMemberList);
} }
break; break;
case "view_3pid_invite": case "view_3pid_invite":
if (payload.event) { if (payload.event) {
RightPanelStore.instance.setPhase(RightPanelPhases.Room3pidMemberInfo, { RightPanelStore.instance.showOrHidePanel(RightPanelPhases.Room3pidMemberInfo, {
memberInfoEvent: payload.event, memberInfoEvent: payload.event,
}); });
} else { } else {
RightPanelStore.instance.setPhase(RightPanelPhases.RoomMemberList); RightPanelStore.instance.showOrHidePanel(RightPanelPhases.RoomMemberList);
} }
break; break;
} }

View file

@ -209,27 +209,27 @@ export default class LegacyRoomHeaderButtons extends HeaderButtons<IProps> {
const currentPhase = RightPanelStore.instance.currentCard.phase; const currentPhase = RightPanelStore.instance.currentCard.phase;
if (currentPhase && ROOM_INFO_PHASES.includes(currentPhase)) { if (currentPhase && ROOM_INFO_PHASES.includes(currentPhase)) {
if (this.state.phase === currentPhase) { if (this.state.phase === currentPhase) {
RightPanelStore.instance.setPhase(currentPhase); RightPanelStore.instance.showOrHidePanel(currentPhase);
} else { } else {
RightPanelStore.instance.setPhase(currentPhase, RightPanelStore.instance.currentCard.state); RightPanelStore.instance.showOrHidePanel(currentPhase, RightPanelStore.instance.currentCard.state);
} }
} else { } else {
// This toggles for us, if needed // This toggles for us, if needed
RightPanelStore.instance.setPhase(RightPanelPhases.RoomSummary); RightPanelStore.instance.showOrHidePanel(RightPanelPhases.RoomSummary);
} }
}; };
private onNotificationsClicked = (): void => { private onNotificationsClicked = (): void => {
// This toggles for us, if needed // This toggles for us, if needed
RightPanelStore.instance.setPhase(RightPanelPhases.NotificationPanel); RightPanelStore.instance.showOrHidePanel(RightPanelPhases.NotificationPanel);
}; };
private onPinnedMessagesClicked = (): void => { private onPinnedMessagesClicked = (): void => {
// This toggles for us, if needed // This toggles for us, if needed
RightPanelStore.instance.setPhase(RightPanelPhases.PinnedMessages); RightPanelStore.instance.showOrHidePanel(RightPanelPhases.PinnedMessages);
}; };
private onTimelineCardClicked = (): void => { private onTimelineCardClicked = (): void => {
RightPanelStore.instance.setPhase(RightPanelPhases.Timeline); RightPanelStore.instance.showOrHidePanel(RightPanelPhases.Timeline);
}; };
private onThreadsPanelClicked = (ev: ButtonEvent): void => { private onThreadsPanelClicked = (ev: ButtonEvent): void => {

View file

@ -107,7 +107,7 @@ export default function RoomHeader({ room }: { room: Room }): JSX.Element {
gap="var(--cpd-space-3x)" gap="var(--cpd-space-3x)"
className="mx_RoomHeader light-panel" className="mx_RoomHeader light-panel"
onClick={() => { onClick={() => {
RightPanelStore.instance.setPhase(RightPanelPhases.RoomSummary); RightPanelStore.instance.showOrHidePanel(RightPanelPhases.RoomSummary);
}} }}
> >
<RoomAvatar room={room} size="40px" /> <RoomAvatar room={room} size="40px" />
@ -195,7 +195,7 @@ export default function RoomHeader({ room }: { room: Room }): JSX.Element {
indicator={notificationColorToIndicator(threadNotifications)} indicator={notificationColorToIndicator(threadNotifications)}
onClick={(evt) => { onClick={(evt) => {
evt.stopPropagation(); evt.stopPropagation();
RightPanelStore.instance.setPhase(RightPanelPhases.ThreadPanel); RightPanelStore.instance.showOrHidePanel(RightPanelPhases.ThreadPanel);
}} }}
title={_t("common|threads")} title={_t("common|threads")}
> >
@ -207,7 +207,7 @@ export default function RoomHeader({ room }: { room: Room }): JSX.Element {
indicator={notificationColorToIndicator(globalNotificationState.color)} indicator={notificationColorToIndicator(globalNotificationState.color)}
onClick={(evt) => { onClick={(evt) => {
evt.stopPropagation(); evt.stopPropagation();
RightPanelStore.instance.setPhase(RightPanelPhases.NotificationPanel); RightPanelStore.instance.showOrHidePanel(RightPanelPhases.NotificationPanel);
}} }}
title={_t("Notifications")} title={_t("Notifications")}
> >
@ -222,7 +222,7 @@ export default function RoomHeader({ room }: { room: Room }): JSX.Element {
weight="medium" weight="medium"
aria-label={_t("%(count)s members", { count: memberCount })} aria-label={_t("%(count)s members", { count: memberCount })}
onClick={(e: React.MouseEvent) => { onClick={(e: React.MouseEvent) => {
RightPanelStore.instance.setPhase(RightPanelPhases.RoomMemberList); RightPanelStore.instance.showOrHidePanel(RightPanelPhases.RoomMemberList);
e.stopPropagation(); e.stopPropagation();
}} }}
> >

View file

@ -236,7 +236,7 @@ export default class RightPanelStore extends ReadyWatchingStore {
* @param phase The right panel phase. * @param phase The right panel phase.
* @param cardState The state within the phase. * @param cardState The state within the phase.
*/ */
public setPhase(phase: RightPanelPhases, cardState?: Partial<IRightPanelCardState>): void { public showOrHidePanel(phase: RightPanelPhases, cardState?: Partial<IRightPanelCardState>): void {
if (this.currentCard.phase == phase && !cardState && this.isOpen) { if (this.currentCard.phase == phase && !cardState && this.isOpen) {
this.togglePanel(null); this.togglePanel(null);
} else { } else {