From 40cae0d899f8e11096e8f1c70f0b8773765f94cc Mon Sep 17 00:00:00 2001 From: rob Date: Thu, 25 Aug 2022 00:49:33 -0400 Subject: [PATCH] chat room management updates --- app/views/chat/components/room-list.pug | 21 +++++++++++++++++---- app/views/chat/layouts/room.pug | 19 ++----------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/app/views/chat/components/room-list.pug b/app/views/chat/components/room-list.pug index 0c07821..6244561 100644 --- a/app/views/chat/components/room-list.pug +++ b/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 \ No newline at end of file +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 \ No newline at end of file diff --git a/app/views/chat/layouts/room.pug b/app/views/chat/layouts/room.pug index 283389a..4da72bf 100644 --- a/app/views/chat/layouts/room.pug +++ b/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