tidy up right-panel if-else-if statement
This commit is contained in:
parent
b002806639
commit
c632c72f25
1 changed files with 75 additions and 58 deletions
|
@ -180,65 +180,82 @@ export default class RightPanel extends React.Component {
|
||||||
|
|
||||||
let panel = <div />;
|
let panel = <div />;
|
||||||
|
|
||||||
if (this.props.roomId && this.state.phase === RIGHT_PANEL_PHASES.RoomMemberList) {
|
switch (this.state.phase) {
|
||||||
panel = <MemberList roomId={this.props.roomId} key={this.props.roomId} />;
|
case RIGHT_PANEL_PHASES.RoomMemberList:
|
||||||
} else if (this.props.groupId && this.state.phase === RIGHT_PANEL_PHASES.GroupMemberList) {
|
if (this.props.roomId) {
|
||||||
panel = <GroupMemberList groupId={this.props.groupId} key={this.props.groupId} />;
|
panel = <MemberList roomId={this.props.roomId} key={this.props.roomId} />;
|
||||||
} else if (this.state.phase === RIGHT_PANEL_PHASES.GroupRoomList) {
|
}
|
||||||
panel = <GroupRoomList groupId={this.props.groupId} key={this.props.groupId} />;
|
break;
|
||||||
} else if (this.state.phase === RIGHT_PANEL_PHASES.RoomMemberInfo ||
|
case RIGHT_PANEL_PHASES.GroupMemberList:
|
||||||
this.state.phase === RIGHT_PANEL_PHASES.EncryptionPanel) {
|
if (this.props.groupId) {
|
||||||
if (SettingsStore.isFeatureEnabled("feature_cross_signing")) {
|
panel = <GroupMemberList groupId={this.props.groupId} key={this.props.groupId} />;
|
||||||
const onClose = () => {
|
}
|
||||||
dis.dispatch({
|
break;
|
||||||
action: "view_user",
|
case RIGHT_PANEL_PHASES.GroupRoomList:
|
||||||
member: this.state.phase === RIGHT_PANEL_PHASES.EncryptionPanel ? this.state.member : null,
|
panel = <GroupRoomList groupId={this.props.groupId} key={this.props.groupId} />;
|
||||||
});
|
break;
|
||||||
};
|
case RIGHT_PANEL_PHASES.RoomMemberInfo:
|
||||||
panel = <UserInfo
|
case RIGHT_PANEL_PHASES.EncryptionPanel:
|
||||||
user={this.state.member}
|
if (SettingsStore.isFeatureEnabled("feature_cross_signing")) {
|
||||||
roomId={this.props.roomId}
|
const onClose = () => {
|
||||||
key={this.props.roomId || this.state.member.userId}
|
dis.dispatch({
|
||||||
onClose={onClose}
|
action: "view_user",
|
||||||
phase={this.state.phase}
|
member: this.state.phase === RIGHT_PANEL_PHASES.EncryptionPanel ? this.state.member : null,
|
||||||
verificationRequest={this.state.verificationRequest}
|
});
|
||||||
/>;
|
};
|
||||||
} else {
|
panel = <UserInfo
|
||||||
panel = <MemberInfo member={this.state.member} key={this.props.roomId || this.state.member.userId} />;
|
user={this.state.member}
|
||||||
}
|
roomId={this.props.roomId}
|
||||||
} else if (this.state.phase === RIGHT_PANEL_PHASES.Room3pidMemberInfo) {
|
key={this.props.roomId || this.state.member.userId}
|
||||||
panel = <ThirdPartyMemberInfo event={this.state.event} key={this.props.roomId} />;
|
onClose={onClose}
|
||||||
} else if (this.state.phase === RIGHT_PANEL_PHASES.GroupMemberInfo) {
|
phase={this.state.phase}
|
||||||
if (SettingsStore.isFeatureEnabled("feature_cross_signing")) {
|
verificationRequest={this.state.verificationRequest}
|
||||||
const onClose = () => {
|
/>;
|
||||||
dis.dispatch({
|
} else {
|
||||||
action: "view_user",
|
panel = <MemberInfo
|
||||||
member: null,
|
member={this.state.member}
|
||||||
});
|
key={this.props.roomId || this.state.member.userId}
|
||||||
};
|
/>;
|
||||||
panel = <UserInfo
|
}
|
||||||
user={this.state.member}
|
break;
|
||||||
groupId={this.props.groupId}
|
case RIGHT_PANEL_PHASES.Room3pidMemberInfo:
|
||||||
key={this.state.member.userId}
|
panel = <ThirdPartyMemberInfo event={this.state.event} key={this.props.roomId} />;
|
||||||
onClose={onClose} />;
|
break;
|
||||||
} else {
|
case RIGHT_PANEL_PHASES.GroupMemberInfo:
|
||||||
panel = (
|
if (SettingsStore.isFeatureEnabled("feature_cross_signing")) {
|
||||||
<GroupMemberInfo
|
const onClose = () => {
|
||||||
groupMember={this.state.member}
|
dis.dispatch({
|
||||||
|
action: "view_user",
|
||||||
|
member: null,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
panel = <UserInfo
|
||||||
|
user={this.state.member}
|
||||||
groupId={this.props.groupId}
|
groupId={this.props.groupId}
|
||||||
key={this.state.member.user_id}
|
key={this.state.member.userId}
|
||||||
/>
|
onClose={onClose} />;
|
||||||
);
|
} else {
|
||||||
}
|
panel = (
|
||||||
} else if (this.state.phase === RIGHT_PANEL_PHASES.GroupRoomInfo) {
|
<GroupMemberInfo
|
||||||
panel = <GroupRoomInfo
|
groupMember={this.state.member}
|
||||||
groupRoomId={this.state.groupRoomId}
|
groupId={this.props.groupId}
|
||||||
groupId={this.props.groupId}
|
key={this.state.member.user_id}
|
||||||
key={this.state.groupRoomId} />;
|
/>
|
||||||
} else if (this.state.phase === RIGHT_PANEL_PHASES.NotificationPanel) {
|
);
|
||||||
panel = <NotificationPanel />;
|
}
|
||||||
} else if (this.state.phase === RIGHT_PANEL_PHASES.FilePanel) {
|
break;
|
||||||
panel = <FilePanel roomId={this.props.roomId} resizeNotifier={this.props.resizeNotifier} />;
|
case RIGHT_PANEL_PHASES.GroupRoomInfo:
|
||||||
|
panel = <GroupRoomInfo
|
||||||
|
groupRoomId={this.state.groupRoomId}
|
||||||
|
groupId={this.props.groupId}
|
||||||
|
key={this.state.groupRoomId} />;
|
||||||
|
break;
|
||||||
|
case RIGHT_PANEL_PHASES.NotificationPanel:
|
||||||
|
panel = <NotificationPanel />;
|
||||||
|
break;
|
||||||
|
case RIGHT_PANEL_PHASES.FilePanel:
|
||||||
|
panel = <FilePanel roomId={this.props.roomId} resizeNotifier={this.props.resizeNotifier} />;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const classes = classNames("mx_RightPanel", "mx_fadable", {
|
const classes = classNames("mx_RightPanel", "mx_fadable", {
|
||||||
|
|
Loading…
Reference in a new issue