@@ -14,16 +14,11 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17- 'use strict' ;
18-
19- var React = require ( 'react' ) ;
20- var ReactDOM = require ( 'react-dom' ) ;
21- var classNames = require ( 'classnames' ) ;
22- var sdk = require ( 'matrix-react-sdk' )
23- var FormattingUtils = require ( 'matrix-react-sdk/lib/utils/FormattingUtils' ) ;
24- var RoomNotifs = require ( 'matrix-react-sdk/lib/RoomNotifs' ) ;
25- var AccessibleButton = require ( 'matrix-react-sdk/lib/components/views/elements/AccessibleButton' ) ;
26- var ConstantTimeDispatcher = require ( 'matrix-react-sdk/lib/ConstantTimeDispatcher' ) ;
17+ import React from 'react' ;
18+ import classNames from 'classnames' ;
19+ import sdk from 'matrix-react-sdk' ;
20+ import FormattingUtils from 'matrix-react-sdk/lib/utils/FormattingUtils' ;
21+ import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton' ;
2722
2823module . exports = React . createClass ( {
2924 displayName : 'RoomSubListHeader' ,
@@ -42,6 +37,7 @@ module.exports = React.createClass({
4237 hidden : React . PropTypes . bool ,
4338 onClick : React . PropTypes . func ,
4439 onHeaderClick : React . PropTypes . func ,
40+ headerItems : React . PropTypes . node , // content shown in the sublist header
4541 } ,
4642
4743 getDefaultProps : function ( ) {
@@ -63,52 +59,52 @@ module.exports = React.createClass({
6359 // },
6460
6561 render : function ( ) {
66- var TintableSvg = sdk . getComponent ( "elements.TintableSvg" ) ;
62+ const TintableSvg = sdk . getComponent ( "elements.TintableSvg" ) ;
6763
68- var subListNotifications = this . props . roomNotificationCount ;
69- var subListNotifCount = subListNotifications [ 0 ] ;
70- var subListNotifHighlight = subListNotifications [ 1 ] ;
64+ const subListNotifications = this . props . roomNotificationCount ;
65+ const subListNotifCount = subListNotifications [ 0 ] ;
66+ const subListNotifHighlight = subListNotifications [ 1 ] ;
7167
72- var chevronClasses = classNames ( {
68+ const chevronClasses = classNames ( {
7369 'mx_RoomSubList_chevron' : true ,
7470 'mx_RoomSubList_chevronRight' : this . props . hidden ,
7571 'mx_RoomSubList_chevronDown' : ! this . props . hidden ,
7672 } ) ;
7773
78- var badgeClasses = classNames ( {
74+ const badgeClasses = classNames ( {
7975 'mx_RoomSubList_badge' : true ,
8076 'mx_RoomSubList_badgeHighlight' : subListNotifHighlight ,
8177 } ) ;
8278
83- var badge ;
79+ let badge ;
8480 if ( subListNotifCount > 0 ) {
8581 badge = < div className = { badgeClasses } > { FormattingUtils . formatCount ( subListNotifCount ) } </ div > ;
86- }
87- else if ( subListNotifHighlight ) {
82+ } else if ( subListNotifHighlight ) {
8883 badge = < div className = { badgeClasses } > !</ div > ;
8984 }
9085
9186 // When collapsed, allow a long hover on the header to show user
9287 // the full tag name and room count
93- var title ;
94- var roomCount = this . props . roomCount ;
88+ let title ;
89+ const roomCount = this . props . roomCount ;
9590 if ( this . props . collapsed ) {
9691 title = this . props . label ;
9792 if ( roomCount !== '' ) {
9893 title += " [" + roomCount + "]" ;
9994 }
10095 }
10196
102- var incomingCall ;
97+ let incomingCall ;
10398 if ( this . props . isIncomingCallRoom ) {
104- var IncomingCallBox = sdk . getComponent ( "voip.IncomingCallBox" ) ;
99+ const IncomingCallBox = sdk . getComponent ( "voip.IncomingCallBox" ) ;
105100 incomingCall = < IncomingCallBox className = "mx_RoomSubList_incomingCall" incomingCall = { this . props . incomingCall } /> ;
106101 }
107102
108103 return (
109104 < div className = "mx_RoomSubList_labelContainer" title = { title } ref = "header" >
110105 < AccessibleButton onClick = { this . props . onClick } className = "mx_RoomSubList_label" tabIndex = "0" >
111106 { this . props . collapsed ? '' : this . props . label }
107+ { this . props . headerItems }
112108 < div className = "mx_RoomSubList_roomCount" > { roomCount } </ div >
113109 < div className = { chevronClasses } > </ div >
114110 { badge }
0 commit comments