namespace Views { export class ChannelList extends SidebarMenu { constructor ( ) { super ( ) ; } public update ( channels , keys , activeChannelId ) { let source = ( key ) => { let channelId ; let className = "fa-minus" ; let name ; let closeable ; if ( + key != Controllers . HomeController . channelId ) { let channel = channels [ key ] ; channelId = channel . channelId ; if ( channel . channelType != null ) { switch ( channel . channelType ) { case Models . ChannelType . Room : className = 'fa-users' ; break ; case Models . ChannelType . List : className = 'fa-th' ; break ; case Models . ChannelType . Conversation : className = 'fa-commenting' ; break ; case Models . ChannelType . Game : className = 'fa-circle' ; break ; } } name = channel . name ; closeable = true ; } else { channelId = Controllers . HomeController . channelId ; name = "Home" ; className = "fa-home" ; closeable = false ; } if ( activeChannelId == channelId ) className += " active" ; return { id : channelId , name : name , className : className , closeable : closeable } ; } ; keys = keys . slice ( ) ; keys . unshift ( Controllers . HomeController . channelId ) ; this . bind ( source , keys , true ) ; } } }