Skip to content

Commit 7c4b673

Browse files
committed
Add group member right panel
1 parent 12628b6 commit 7c4b673

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

‎src/components/structures/RightPanel.js‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module.exports = React.createClass({
4242
FilePanel: 'FilePanel',
4343
NotificationPanel: 'NotificationPanel',
4444
RoomMemberInfo: 'RoomMemberInfo',
45+
GroupMemberInfo: 'GroupMemberInfo',
4546
},
4647

4748
componentWillMount: function() {
@@ -57,6 +58,10 @@ module.exports = React.createClass({
5758
}
5859
},
5960

61+
componentWillReceiveProps: function(newprops) {
62+
this.setState(this.getInitialState());
63+
},
64+
6065
getInitialState: function() {
6166
if (this.props.userId) {
6267
const member = new Matrix.RoomMember(null, this.props.userId);
@@ -142,12 +147,19 @@ module.exports = React.createClass({
142147
});
143148
} else if (this.props.groupId) {
144149
this.setState({
145-
phase: this.Phase.GroupMemberList
150+
phase: this.Phase.GroupMemberList,
151+
groupId: payload.groupId,
152+
member: payload.member,
146153
});
147154
}
148155
}
149-
}
150-
else if (payload.action === "view_room") {
156+
} else if (payload.action === "view_group_user") {
157+
this.setState({
158+
phase: this.Phase.GroupMemberInfo,
159+
groupId: payload.groupId,
160+
member: payload.member,
161+
});
162+
} else if (payload.action === "view_room") {
151163
if (this.state.phase === this.Phase.RoomMemberInfo) {
152164
this.setState({
153165
phase: this.Phase.RoomMemberList
@@ -239,9 +251,12 @@ module.exports = React.createClass({
239251
panel = <MemberList roomId={this.props.roomId} key={this.props.roomId} />
240252
} else if (this.props.groupId && this.state.phase == this.Phase.GroupMemberList) {
241253
panel = <GroupMemberList groupId={this.props.groupId} key={this.props.groupId} />
242-
} else if(this.state.phase == this.Phase.RoomMemberInfo) {
254+
} else if (this.state.phase == this.Phase.RoomMemberInfo) {
243255
const MemberInfo = sdk.getComponent('rooms.MemberInfo');
244256
panel = <MemberInfo member={this.state.member} key={this.props.roomId || this.props.userId} />
257+
} else if (this.state.phase == this.Phase.GroupMemberInfo) {
258+
const GroupMemberInfo = sdk.getComponent('groups.GroupMemberInfo');
259+
panel = <GroupMemberInfo member={this.state.member} groupId={this.props.groupId} key={this.state.member.user_id} />
245260
} else if (this.state.phase == this.Phase.NotificationPanel) {
246261
panel = <NotificationPanel />
247262
} else if (this.state.phase == this.Phase.FilePanel) {

0 commit comments

Comments
 (0)