@@ -26,9 +26,16 @@ var rate_limited_func = require('matrix-react-sdk/lib/ratelimitedfunc');
2626module . exports = React . createClass ( {
2727 displayName : 'RightPanel' ,
2828
29+ propTypes : {
30+ userId : React . PropTypes . string , // if showing an orphaned MemberInfo page, this is set
31+ roomId : React . PropTypes . string , // if showing panels for a given room, this is set
32+ collapsed : React . PropTypes . bool ,
33+ } ,
34+
2935 Phase : {
3036 MemberList : 'MemberList' ,
31- FileList : 'FileList' ,
37+ FilePanel : 'FilePanel' ,
38+ NotificationPanel : 'NotificationPanel' ,
3239 MemberInfo : 'MemberInfo' ,
3340 } ,
3441
@@ -61,7 +68,7 @@ module.exports = React.createClass({
6168 } ,
6269
6370 onMemberListButtonClick : function ( ) {
64- if ( this . props . collapsed ) {
71+ if ( this . props . collapsed || this . state . phase !== this . Phase . MemberList ) {
6572 this . setState ( { phase : this . Phase . MemberList } ) ;
6673 dis . dispatch ( {
6774 action : 'show_right_panel' ,
@@ -74,6 +81,34 @@ module.exports = React.createClass({
7481 }
7582 } ,
7683
84+ onFileListButtonClick : function ( ) {
85+ if ( this . props . collapsed || this . state . phase !== this . Phase . FilePanel ) {
86+ this . setState ( { phase : this . Phase . FilePanel } ) ;
87+ dis . dispatch ( {
88+ action : 'show_right_panel' ,
89+ } ) ;
90+ }
91+ else {
92+ dis . dispatch ( {
93+ action : 'hide_right_panel' ,
94+ } ) ;
95+ }
96+ } ,
97+
98+ onNotificationListButtonClick : function ( ) {
99+ if ( this . props . collapsed || this . state . phase !== this . Phase . NotificationPanel ) {
100+ this . setState ( { phase : this . Phase . NotificationPanel } ) ;
101+ dis . dispatch ( {
102+ action : 'show_right_panel' ,
103+ } ) ;
104+ }
105+ else {
106+ dis . dispatch ( {
107+ action : 'hide_right_panel' ,
108+ } ) ;
109+ }
110+ } ,
111+
77112 onRoomStateMember : function ( ev , state , member ) {
78113 // redraw the badge on the membership list
79114 if ( this . state . phase == this . Phase . MemberList && member . roomId === this . props . roomId ) {
@@ -118,42 +153,54 @@ module.exports = React.createClass({
118153
119154 render : function ( ) {
120155 var MemberList = sdk . getComponent ( 'rooms.MemberList' ) ;
156+ var NotificationPanel = sdk . getComponent ( 'structures.NotificationPanel' ) ;
157+ var FilePanel = sdk . getComponent ( 'structures.FilePanel' ) ;
121158 var TintableSvg = sdk . getComponent ( "elements.TintableSvg" ) ;
122159 var buttonGroup ;
123160 var panel ;
124161
125162 var filesHighlight ;
126163 var membersHighlight ;
164+ var notificationsHighlight ;
127165 if ( ! this . props . collapsed ) {
128166 if ( this . state . phase == this . Phase . MemberList || this . state . phase === this . Phase . MemberInfo ) {
129167 membersHighlight = < div className = "mx_RightPanel_headerButton_highlight" > </ div > ;
130168 }
131- else if ( this . state . phase == this . Phase . FileList ) {
169+ else if ( this . state . phase == this . Phase . FilePanel ) {
132170 filesHighlight = < div className = "mx_RightPanel_headerButton_highlight" > </ div > ;
133171 }
172+ else if ( this . state . phase == this . Phase . NotificationPanel ) {
173+ notificationsHighlight = < div className = "mx_RightPanel_headerButton_highlight" > </ div > ;
174+ }
134175 }
135176
136177 var membersBadge ;
137178 if ( ( this . state . phase == this . Phase . MemberList || this . state . phase === this . Phase . MemberInfo ) && this . props . roomId ) {
138179 var cli = MatrixClientPeg . get ( ) ;
139180 var room = cli . getRoom ( this . props . roomId ) ;
140181 if ( room ) {
141- membersBadge = < div className = "mx_RightPanel_headerButton_badge" > { room . getJoinedMembers ( ) . length } </ div > ;
182+ membersBadge = room . getJoinedMembers ( ) . length ;
142183 }
143184 }
144185
145186 if ( this . props . roomId ) {
146187 buttonGroup =
147188 < div className = "mx_RightPanel_headerButtonGroup" >
148189 < div className = "mx_RightPanel_headerButton" title = "Members" onClick = { this . onMemberListButtonClick } >
149- { membersBadge }
190+ < div className = "mx_RightPanel_headerButton_badge" > { membersBadge ? membersBadge : < span > </ span > } </ div >
150191 < TintableSvg src = "img/icons-people.svg" width = "25" height = "25" />
151192 { membersHighlight }
152193 </ div >
153- < div className = "mx_RightPanel_headerButton mx_RightPanel_filebutton" title = "Files" >
154- < TintableSvg src = "img/files.svg" width = "17" height = "22" />
194+ < div className = "mx_RightPanel_headerButton mx_RightPanel_filebutton" title = "Files" onClick = { this . onFileListButtonClick } >
195+ < div className = "mx_RightPanel_headerButton_badge" > </ div >
196+ < TintableSvg src = "img/icons-files.svg" width = "25" height = "25" />
155197 { filesHighlight }
156198 </ div >
199+ < div className = "mx_RightPanel_headerButton mx_RightPanel_notificationbutton" title = "Notifications" onClick = { this . onNotificationListButtonClick } >
200+ < div className = "mx_RightPanel_headerButton_badge" > </ div >
201+ < TintableSvg src = "img/icons-notifications.svg" width = "25" height = "25" />
202+ { notificationsHighlight }
203+ </ div >
157204 </ div > ;
158205 }
159206
@@ -165,6 +212,12 @@ module.exports = React.createClass({
165212 var MemberInfo = sdk . getComponent ( 'rooms.MemberInfo' ) ;
166213 panel = < MemberInfo member = { this . state . member } key = { this . props . roomId || this . props . userId } />
167214 }
215+ else if ( this . state . phase == this . Phase . NotificationPanel ) {
216+ panel = < NotificationPanel />
217+ }
218+ else if ( this . state . phase == this . Phase . FilePanel ) {
219+ panel = < FilePanel roomId = { this . props . roomId } />
220+ }
168221 }
169222
170223 if ( ! panel ) {
0 commit comments