@@ -26,9 +26,16 @@ var rate_limited_func = require('matrix-react-sdk/lib/ratelimitedfunc');
26
26
module . exports = React . createClass ( {
27
27
displayName : 'RightPanel' ,
28
28
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
+
29
35
Phase : {
30
36
MemberList : 'MemberList' ,
31
- FileList : 'FileList' ,
37
+ FilePanel : 'FilePanel' ,
38
+ NotificationPanel : 'NotificationPanel' ,
32
39
MemberInfo : 'MemberInfo' ,
33
40
} ,
34
41
@@ -61,7 +68,7 @@ module.exports = React.createClass({
61
68
} ,
62
69
63
70
onMemberListButtonClick : function ( ) {
64
- if ( this . props . collapsed ) {
71
+ if ( this . props . collapsed || this . state . phase !== this . Phase . MemberList ) {
65
72
this . setState ( { phase : this . Phase . MemberList } ) ;
66
73
dis . dispatch ( {
67
74
action : 'show_right_panel' ,
@@ -74,6 +81,34 @@ module.exports = React.createClass({
74
81
}
75
82
} ,
76
83
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
+
77
112
onRoomStateMember : function ( ev , state , member ) {
78
113
// redraw the badge on the membership list
79
114
if ( this . state . phase == this . Phase . MemberList && member . roomId === this . props . roomId ) {
@@ -118,42 +153,54 @@ module.exports = React.createClass({
118
153
119
154
render : function ( ) {
120
155
var MemberList = sdk . getComponent ( 'rooms.MemberList' ) ;
156
+ var NotificationPanel = sdk . getComponent ( 'structures.NotificationPanel' ) ;
157
+ var FilePanel = sdk . getComponent ( 'structures.FilePanel' ) ;
121
158
var TintableSvg = sdk . getComponent ( "elements.TintableSvg" ) ;
122
159
var buttonGroup ;
123
160
var panel ;
124
161
125
162
var filesHighlight ;
126
163
var membersHighlight ;
164
+ var notificationsHighlight ;
127
165
if ( ! this . props . collapsed ) {
128
166
if ( this . state . phase == this . Phase . MemberList || this . state . phase === this . Phase . MemberInfo ) {
129
167
membersHighlight = < div className = "mx_RightPanel_headerButton_highlight" > </ div > ;
130
168
}
131
- else if ( this . state . phase == this . Phase . FileList ) {
169
+ else if ( this . state . phase == this . Phase . FilePanel ) {
132
170
filesHighlight = < div className = "mx_RightPanel_headerButton_highlight" > </ div > ;
133
171
}
172
+ else if ( this . state . phase == this . Phase . NotificationPanel ) {
173
+ notificationsHighlight = < div className = "mx_RightPanel_headerButton_highlight" > </ div > ;
174
+ }
134
175
}
135
176
136
177
var membersBadge ;
137
178
if ( ( this . state . phase == this . Phase . MemberList || this . state . phase === this . Phase . MemberInfo ) && this . props . roomId ) {
138
179
var cli = MatrixClientPeg . get ( ) ;
139
180
var room = cli . getRoom ( this . props . roomId ) ;
140
181
if ( room ) {
141
- membersBadge = < div className = "mx_RightPanel_headerButton_badge" > { room . getJoinedMembers ( ) . length } </ div > ;
182
+ membersBadge = room . getJoinedMembers ( ) . length ;
142
183
}
143
184
}
144
185
145
186
if ( this . props . roomId ) {
146
187
buttonGroup =
147
188
< div className = "mx_RightPanel_headerButtonGroup" >
148
189
< div className = "mx_RightPanel_headerButton" title = "Members" onClick = { this . onMemberListButtonClick } >
149
- { membersBadge }
190
+ < div className = "mx_RightPanel_headerButton_badge" > { membersBadge ? membersBadge : < span > </ span > } </ div >
150
191
< TintableSvg src = "img/icons-people.svg" width = "25" height = "25" />
151
192
{ membersHighlight }
152
193
</ 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" />
155
197
{ filesHighlight }
156
198
</ 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 >
157
204
</ div > ;
158
205
}
159
206
@@ -165,6 +212,12 @@ module.exports = React.createClass({
165
212
var MemberInfo = sdk . getComponent ( 'rooms.MemberInfo' ) ;
166
213
panel = < MemberInfo member = { this . state . member } key = { this . props . roomId || this . props . userId } />
167
214
}
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
+ }
168
221
}
169
222
170
223
if ( ! panel ) {
0 commit comments