Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2023-09-12 15:36:22 +01:00
parent 159deec937
commit 89fa7b4b39
No known key found for this signature in database
GPG key ID: A2B008A5F49F5D0D
6 changed files with 39 additions and 57 deletions

View file

@ -130,7 +130,6 @@ import { isNotUndefined } from "../../Typeguards";
import { CancelAskToJoinPayload } from "../../dispatcher/payloads/CancelAskToJoinPayload";
import { SubmitAskToJoinPayload } from "../../dispatcher/payloads/SubmitAskToJoinPayload";
import RightPanelStore from "../../stores/right-panel/RightPanelStore";
import { setPhase } from "../../utils/room/setPhase";
const DEBUG = false;
const PREVENT_MULTIPLE_JITSI_WITHIN = 30_000;
@ -1268,14 +1267,16 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
]);
}
} else {
setPhase(RightPanelPhases.RoomMemberList);
RightPanelStore.instance.setPhase(RightPanelPhases.RoomMemberList);
}
break;
case "view_3pid_invite":
if (payload.event) {
setPhase(RightPanelPhases.Room3pidMemberInfo, { memberInfoEvent: payload.event });
RightPanelStore.instance.setPhase(RightPanelPhases.Room3pidMemberInfo, {
memberInfoEvent: payload.event,
});
} else {
setPhase(RightPanelPhases.RoomMemberList);
RightPanelStore.instance.setPhase(RightPanelPhases.RoomMemberList);
}
break;
}

View file

@ -669,13 +669,14 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
return;
}
if (payload.action !== Action.ViewUser && payload.action !== "view_3pid_invite") return;
/**
* The rest of the `ViewUser` and `view_3pid_invite` exists in the `<RoomView />`
* component. This deals specifically with showing the space members list
*/
if (!payload.member && !payload.event) {
if (
(payload.action === Action.ViewUser && !payload.member) ||
(payload.action === "view_3pid_invite" && payload.event === null)
) {
RightPanelStore.instance.setCard({
phase: RightPanelPhases.SpaceMemberList,
state: { spaceId: this.props.space.roomId },

View file

@ -40,7 +40,6 @@ import { SummarizedNotificationState } from "../../../stores/notifications/Summa
import PosthogTrackers from "../../../PosthogTrackers";
import { ButtonEvent } from "../elements/AccessibleButton";
import { doesRoomOrThreadHaveUnreadMessages } from "../../../Unread";
import { setPhase } from "../../../utils/room/setPhase";
const ROOM_INFO_PHASES = [
RightPanelPhases.RoomSummary,
@ -210,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) {
setPhase(currentPhase);
RightPanelStore.instance.setPhase(currentPhase);
} else {
setPhase(currentPhase, RightPanelStore.instance.currentCard.state);
RightPanelStore.instance.setPhase(currentPhase, RightPanelStore.instance.currentCard.state);
}
} else {
// This toggles for us, if needed
setPhase(RightPanelPhases.RoomSummary);
RightPanelStore.instance.setPhase(RightPanelPhases.RoomSummary);
}
};
private onNotificationsClicked = (): void => {
// This toggles for us, if needed
setPhase(RightPanelPhases.NotificationPanel);
RightPanelStore.instance.setPhase(RightPanelPhases.NotificationPanel);
};
private onPinnedMessagesClicked = (): void => {
// This toggles for us, if needed
setPhase(RightPanelPhases.PinnedMessages);
RightPanelStore.instance.setPhase(RightPanelPhases.PinnedMessages);
};
private onTimelineCardClicked = (): void => {
setPhase(RightPanelPhases.Timeline);
RightPanelStore.instance.setPhase(RightPanelPhases.Timeline);
};
private onThreadsPanelClicked = (ev: ButtonEvent): void => {

View file

@ -45,10 +45,10 @@ import { placeCall } from "../../../utils/room/placeCall";
import { useEncryptionStatus } from "../../../hooks/useEncryptionStatus";
import { E2EStatus } from "../../../utils/ShieldUtils";
import FacePile from "../elements/FacePile";
import { setPhase } from "../../../utils/room/setPhase";
import { useRoomState } from "../../../hooks/useRoomState";
import RoomAvatar from "../avatars/RoomAvatar";
import { formatCount } from "../../../utils/FormattingUtils";
import RightPanelStore from "../../../stores/right-panel/RightPanelStore";
/**
* A helper to transform a notification color to the what the Compound Icon Button
@ -107,7 +107,7 @@ export default function RoomHeader({ room }: { room: Room }): JSX.Element {
gap="var(--cpd-space-3x)"
className="mx_RoomHeader light-panel"
onClick={() => {
setPhase(RightPanelPhases.RoomSummary);
RightPanelStore.instance.setPhase(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();
setPhase(RightPanelPhases.ThreadPanel);
RightPanelStore.instance.setPhase(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();
setPhase(RightPanelPhases.NotificationPanel);
RightPanelStore.instance.setPhase(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) => {
setPhase(RightPanelPhases.RoomMemberList);
RightPanelStore.instance.setPhase(RightPanelPhases.RoomMemberList);
e.stopPropagation();
}}
>