@@ -25,7 +25,7 @@ import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
2525import Analytics from 'matrix-react-sdk/lib/Analytics' ;
2626import rate_limited_func from 'matrix-react-sdk/lib/ratelimitedfunc' ;
2727import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton' ;
28- import { showGroupInviteDialog } from 'matrix-react-sdk/lib/GroupInvite ' ;
28+ import { showGroupInviteDialog , showGroupAddRoomDialog } from 'matrix-react-sdk/lib/GroupAddressPicker ' ;
2929
3030class HeaderButton extends React . Component {
3131 constructor ( ) {
@@ -87,6 +87,7 @@ module.exports = React.createClass({
8787 Phase : {
8888 RoomMemberList : 'RoomMemberList' ,
8989 GroupMemberList : 'GroupMemberList' ,
90+ GroupRoomList : 'GroupRoomList' ,
9091 FilePanel : 'FilePanel' ,
9192 NotificationPanel : 'NotificationPanel' ,
9293 RoomMemberInfo : 'RoomMemberInfo' ,
@@ -132,6 +133,10 @@ module.exports = React.createClass({
132133
133134 if ( this . state . phase === this . Phase . GroupMemberList ) {
134135 showGroupInviteDialog ( this . props . groupId ) ;
136+ } else if ( this . state . phase === this . Phase . GroupRoomList ) {
137+ showGroupAddRoomDialog ( this . props . groupId ) . then ( ( ) => {
138+ this . forceUpdate ( ) ;
139+ } ) ;
135140 } else {
136141 // call AddressPickerDialog
137142 dis . dispatch ( {
@@ -205,10 +210,16 @@ module.exports = React.createClass({
205210
206211 render : function ( ) {
207212 const MemberList = sdk . getComponent ( 'rooms.MemberList' ) ;
208- const GroupMemberList = sdk . getComponent ( 'groups.GroupMemberList ' ) ;
213+ const MemberInfo = sdk . getComponent ( 'rooms.MemberInfo ' ) ;
209214 const NotificationPanel = sdk . getComponent ( 'structures.NotificationPanel' ) ;
210215 const FilePanel = sdk . getComponent ( 'structures.FilePanel' ) ;
216+
217+ const GroupMemberList = sdk . getComponent ( 'groups.GroupMemberList' ) ;
218+ const GroupMemberInfo = sdk . getComponent ( 'groups.GroupMemberInfo' ) ;
219+ const GroupRoomList = sdk . getComponent ( 'groups.GroupRoomList' ) ;
220+
211221 const TintableSvg = sdk . getComponent ( "elements.TintableSvg" ) ;
222+
212223 let inviteGroup ;
213224
214225 let membersBadge ;
@@ -256,6 +267,19 @@ module.exports = React.createClass({
256267 analytics = { [ 'Right Panel' , 'Notification List Button' , 'click' ] }
257268 /> ,
258269 ] ;
270+ } else if ( this . props . groupId ) {
271+ headerButtons = [
272+ < HeaderButton key = "_groupMembersButton" title = { _t ( 'Members' ) } iconSrc = "img/icons-people.svg"
273+ isHighlighted = { this . state . phase === this . Phase . GroupMemberList }
274+ clickPhase = { this . Phase . GroupMemberList }
275+ analytics = { [ 'Right Panel' , 'Group Member List Button' , 'click' ] }
276+ /> ,
277+ < HeaderButton key = "_roomsButton" title = { _t ( 'Rooms' ) } iconSrc = "img/icons-files.svg"
278+ isHighlighted = { this . state . phase === this . Phase . GroupRoomList }
279+ clickPhase = { this . Phase . GroupRoomList }
280+ analytics = { [ 'Right Panel' , 'Group Room List Button' , 'click' ] }
281+ /> ,
282+ ] ;
259283 }
260284
261285 if ( this . props . roomId || this . props . groupId ) {
@@ -277,19 +301,11 @@ module.exports = React.createClass({
277301 panel = < MemberList roomId = { this . props . roomId } key = { this . props . roomId } /> ;
278302 } else if ( this . props . groupId && this . state . phase == this . Phase . GroupMemberList ) {
279303 panel = < GroupMemberList groupId = { this . props . groupId } key = { this . props . groupId } /> ;
280- inviteGroup = (
281- < AccessibleButton className = "mx_RightPanel_invite" onClick = { this . onInviteButtonClick } >
282- < div className = "mx_RightPanel_icon" >
283- < TintableSvg src = "img/icon-invite-people.svg" width = "35" height = "35" />
284- </ div >
285- < div className = "mx_RightPanel_message" > { _t ( 'Invite to this group' ) } </ div >
286- </ AccessibleButton >
287- ) ;
304+ } else if ( this . state . phase === this . Phase . GroupRoomList ) {
305+ panel = < GroupRoomList groupId = { this . props . groupId } key = { this . props . groupId } /> ;
288306 } else if ( this . state . phase == this . Phase . RoomMemberInfo ) {
289- const MemberInfo = sdk . getComponent ( 'rooms.MemberInfo' ) ;
290307 panel = < MemberInfo member = { this . state . member } key = { this . props . roomId || this . state . member . userId } /> ;
291308 } else if ( this . state . phase == this . Phase . GroupMemberInfo ) {
292- const GroupMemberInfo = sdk . getComponent ( 'groups.GroupMemberInfo' ) ;
293309 panel = < GroupMemberInfo
294310 groupMember = { this . state . member }
295311 groupId = { this . props . groupId }
@@ -305,6 +321,24 @@ module.exports = React.createClass({
305321 panel = < div className = "mx_RightPanel_blank" > </ div > ;
306322 }
307323
324+ if ( this . props . groupId ) {
325+ inviteGroup = this . state . phase === this . Phase . GroupMemberList ? (
326+ < AccessibleButton className = "mx_RightPanel_invite" onClick = { this . onInviteButtonClick } >
327+ < div className = "mx_RightPanel_icon" >
328+ < TintableSvg src = "img/icon-invite-people.svg" width = "35" height = "35" />
329+ </ div >
330+ < div className = "mx_RightPanel_message" > { _t ( 'Invite to this group' ) } </ div >
331+ </ AccessibleButton >
332+ ) : (
333+ < AccessibleButton className = "mx_RightPanel_invite" onClick = { this . onInviteButtonClick } >
334+ < div className = "mx_RightPanel_icon" >
335+ < TintableSvg src = "img/icons-files.svg" width = "35" height = "35" />
336+ </ div >
337+ < div className = "mx_RightPanel_message" > { _t ( 'Add room to this group' ) } </ div >
338+ </ AccessibleButton >
339+ ) ;
340+ }
341+
308342 let classes = "mx_RightPanel mx_fadable" ;
309343 if ( this . props . collapsed ) {
310344 classes += " collapsed" ;
0 commit comments