Browse Source

Merge branch 'develop' of git.digitaltelepresence.com:digital-telepresence/dtp-base into develop

develop
Rob Colbert 2 years ago
parent
commit
45bf69ec7d
  1. 3
      app/services/chat.js
  2. 8
      app/views/chat/index.pug
  3. 53
      app/views/chat/room/index.pug
  4. 3
      app/views/components/navbar.pug

3
app/services/chat.js

@ -265,6 +265,7 @@ class ChatService extends SiteService {
skip: 0,
cpp: 50
}, pagination);
const totalPublicRooms = await ChatRoom.countDocuments({ visibility: 'public' });
const rooms = await ChatRoom
.find({ visibility: 'public' })
.sort({ lastActivity: -1, created: -1 })
@ -272,7 +273,7 @@ class ChatService extends SiteService {
.limit(pagination.cpp)
.populate(this.populateChatRoom)
.lean();
return rooms;
return { rooms, totalPublicRooms };
}
async getRoomById (roomId) {

8
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
@ -17,6 +19,4 @@ block content
each message in timeline
+renderChatMessage(message, { includeRoomInfo: true })
.chat-message-menu
button(type="button", onclick="return dtp.app.chat.resumeChatScroll(event);").chat-scroll-return Resume scrolling
//- pre= JSON.stringify(userTimeline, null, 2)
button(type="button", onclick="return dtp.app.chat.resumeChatScroll(event);").chat-scroll-return Resume scrolling

53
app/views/chat/room/index.pug

@ -1,29 +1,40 @@
extends ../layouts/room
block content
include ../../components/pagination-bar
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
.uk-card.uk-card-default.uk-card-small
.uk-card-header
h1.uk-card-title Public Chat Rooms
h1 Public Rooms
div(uk-grid)
each room in publicRooms
.uk-width-1-3
+renderRoomTile(room)
.uk-card-body
if Array.isArray(publicRooms.rooms) && (publicRooms.rooms.length > 0)
div(uk-grid)
each room in publicRooms.rooms
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.
pre= JSON.stringify(publicRooms, null, 2)
.uk-card-footer
+renderPaginationBar('/chat/room', publicRooms.totalRoomCount)

3
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

Loading…
Cancel
Save