From c2f1a88fc40cc125ac0fc80b373aa56fa5dcd309 Mon Sep 17 00:00:00 2001 From: rob Date: Sun, 25 Sep 2022 05:45:11 -0400 Subject: [PATCH] add chat and public rooms --- app/views/chat/index.pug | 4 ++- app/views/chat/room/index.pug | 51 ++++++++++++++++++--------------- app/views/components/navbar.pug | 3 ++ 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/app/views/chat/index.pug b/app/views/chat/index.pug index b51e8d6..517ca93 100644 --- a/app/views/chat/index.pug +++ b/app/views/chat/index.pug @@ -5,11 +5,13 @@ block content #site-chat-container.uk-flex.uk-flex-column.uk-height-1-1 .chat-menubar.uk-padding-small - div(uk-grid).uk-grid-small + div(uk-grid).uk-grid-small.uk-flex-middle .uk-width-auto img(src=`/img/icon/${site.domainKey}/icon-48x48.png`, alt=`${site.name} icon`) .uk-width-expand h1.uk-margin-remove #{site.name} Chat Timeline + .uk-width-auto + a(href='/chat/room').uk-button.uk-button-secondary.uk-button-small.uk-border-rounded Public Rooms .chat-content-wrapper #chat-message-list-wrapper.uk-height-1-1 diff --git a/app/views/chat/room/index.pug b/app/views/chat/room/index.pug index 0711e78..cb155af 100644 --- a/app/views/chat/room/index.pug +++ b/app/views/chat/room/index.pug @@ -2,28 +2,33 @@ extends ../layouts/room block content mixin renderRoomTile (room) - div(data-room-id= room._id, data-room-name= room.name).uk-tile.uk-tile-default.uk-tile-small - .uk-tile-body - div(uk-grid).uk-grid-small - .uk-width-auto - .uk-width-expand - .uk-margin-small - div(title= room.name).uk-text-bold.uk-text-truncate= room.name - .uk-text-small.uk-text-truncate= room.description - div(uk-grid).uk-grid-small.uk-text-small.uk-text-muted.no-select - .uk-width-expand - a(href= getUserProfileUrl(room.owner))= room.owner.username - .uk-width-auto - span - i.fas.fa-users - span.uk-margin-small-left= formatCount(room.members.length) + a(href=`/chat/room/${room._id}`).uk-display-block.uk-link-reset + div(data-room-id= room._id, data-room-name= room.name).uk-tile.uk-tile-default.uk-tile-small + .uk-tile-body + div(uk-grid).uk-grid-small + .uk-width-auto + +renderProfileIcon(room.owner) + .uk-width-expand + .uk-margin-small + div(title= room.name).uk-text-bold.uk-text-truncate= room.name + .uk-text-small.uk-text-truncate= room.description + div(uk-grid).uk-grid-small.uk-text-small.uk-text-muted.no-select + .uk-width-expand + a(href= getUserProfileUrl(room.owner))= room.owner.username + .uk-width-auto + span + i.fas.fa-users + span.uk-margin-small-left= formatCount(room.members.length) .uk-height-1-1.uk-overflow-auto - - h1 Public Rooms - div(uk-grid) - each room in publicRooms - .uk-width-1-3 - +renderRoomTile(room) - - pre= JSON.stringify(publicRooms, null, 2) \ No newline at end of file + .uk-card.uk-card-default.uk-card-small + .uk-card-header + h1.uk-card-title Public Chat Rooms + .uk-card-body + if Array.isArray(publicRooms) && (publicRooms.length > 0) + div(uk-grid) + each room in publicRooms + div(class="uk-width-1-1 uk-width-1-2@m uk-width-1-3@l") + +renderRoomTile(room) + else + div #{site.name} has no public rooms. \ No newline at end of file diff --git a/app/views/components/navbar.pug b/app/views/components/navbar.pug index 594e1fc..9b86622 100644 --- a/app/views/components/navbar.pug +++ b/app/views/components/navbar.pug @@ -16,6 +16,9 @@ nav(uk-navbar).uk-navbar-container.uk-position-fixed.uk-position-top li(class={ 'uk-active': currentView === 'home' }) a(href="/", title= "Home") +renderButtonIcon('fa-home', 'Home') + li(class={ 'uk-active': currentView === 'chat' }) + a(href="/chat", title= "chat") + +renderButtonIcon('fa-comment-alt', 'Chat') div(class="uk-hidden@m").uk-navbar-center //- Site name