Browse Source

chat room management updates

develop
Rob Colbert 2 years ago
parent
commit
40cae0d899
  1. 21
      app/views/chat/components/room-list.pug
  2. 19
      app/views/chat/layouts/room.pug

21
app/views/chat/components/room-list.pug

@ -1,4 +1,17 @@
mixin renderRoomList (rooms)
each room in rooms
li.uk-active
a(href=`/chat/room/${room._id}`)= room.name
mixin renderRoomList (rooms, options)
ul#room-list.uk-nav.uk-nav-default
li.uk-nav-header
div(uk-grid).uk-grid-small
.uk-text-bold.uk-width-expand= options.title
if !options.hideCreate
.uk-width-auto
a(href='/chat/room/create', title= "Create new chat room...").uk-link-reset
i.fas.fa-plus
if Array.isArray(rooms) && (rooms.length > 0)
each room in rooms
li.uk-active
a(href=`/chat/room/${room._id}`)= room.name
else
li= options.emptyPrompt

19
app/views/chat/layouts/room.pug

@ -9,25 +9,10 @@ block content-container
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
if Array.isArray(ownedChatRooms) && (ownedChatRooms.length > 0)
ul#room-list.uk-nav.uk-nav-default
li.uk-nav-header
div(uk-grid).uk-grid-small
.uk-text-bold.uk-width-expand Your Rooms
.uk-width-auto
a(href='/chat/room/create', title= "Create new chat room...").uk-link-reset
i.fas.fa-plus
+renderRoomList(ownedChatRooms)
else
div You don't own any chat rooms.
+renderRoomList(ownedChatRooms, { title: "Your Rooms", emptyPrompt: "You don't own any chat rooms" })
.site-chat-sidebar-widget.uk-border-rounded
if Array.isArray(joinedChatRooms) && (joinedChatRooms.length > 0)
ul#room-list.uk-nav.uk-nav-default
li.uk-nav-header Joined Rooms
+renderRoomList(joinedChatRooms)
else
div You haven't joined any chat rooms.
+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

Loading…
Cancel
Save