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 {
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;
}

View file

@ -209,27 +209,27 @@ export default class LegacyRoomHeaderButtons extends HeaderButtons<IProps> {
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 => {

View file

@ -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);
}}
>
<RoomAvatar room={room} size="40px" />
@ -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();
}}
>

View file

@ -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<IRightPanelCardState>): void {
public showOrHidePanel(phase: RightPanelPhases, cardState?: Partial<IRightPanelCardState>): void {
if (this.currentCard.phase == phase && !cardState && this.isOpen) {
this.togglePanel(null);
} else {