extends ../../layouts/main
block page-footer
block content-container

  include ../components/user-list-entry
  include ../components/room-list

  section.site-chat-section
    div(uk-grid).uk-height-1-1
      div(class="uk-width-1-1 uk-width-1-5@l uk-flex-last uk-flex-first@l").uk-height-1-1.uk-overflow-auto
        .site-chat-sidebar-widget.uk-border-rounded.uk-margin
          +renderRoomList(ownedChatRooms, { title: "Your Rooms", emptyPrompt: "You don't own any chat rooms" })

        .site-chat-sidebar-widget.uk-border-rounded
          +renderRoomList(joinedChatRooms, { title: "Joined Rooms", emptyPrompt: "You haven't joined any chat rooms", hideCreate: true })

      div(class="uk-width-1-1 uk-width-expand@l").uk-height-1-1
        #chat-room.uk-height-1-1
          block content

      div(class="uk-width-1-1 uk-width-1-5@l").uk-height-1-1.uk-overflow-auto
        if room
          .site-chat-sidebar-widget.uk-border-rounded
            ul#room-member-list.uk-nav.uk-nav-default
              li.uk-nav-header Room Owner
              li
                +renderUserListEntry(room.owner, 'owner')

              if room.moderators && (room.moderators.length > 0)
                li.uk-nav-header Moderators
                each membership in room.moderators
                  li
                    +renderUserListEntry(membership.member, 'moderator')

              if Array.isArray(room.members) && (room.members.length > 0)
                li.uk-nav-header Members
                each membership in room.members
                  li
                    +renderUserListEntry(membership.member, 'member')