Add members to community page on mobile

This commit is contained in:
Rogerio Chaves 2020-04-25 13:01:14 +02:00
parent 0076b4f456
commit 35481a61e3
No known key found for this signature in database
GPG Key ID: E6AF5440509B1D94
3 changed files with 32 additions and 11 deletions

View File

@ -90,10 +90,13 @@ module.exports.setupRoutes = (router) => {
async (req, res) => {
const name = req.params.name;
const posts = await queries.getCommunityPosts(name);
const [posts, members] = await Promise.all([
queries.getCommunityPosts(name),
queries.getCommunityMembers(name),
]);
res.render("mobile/communities/community", {
community: { name },
community: { name, members },
posts,
layout: "mobile/_layout",
});

View File

@ -196,3 +196,8 @@ a.compose-new-button {
margin-top: 8px;
border: 1px solid #bbb;
}
.link-block {
padding: 5px 0;
margin: 0;
}

View File

@ -8,13 +8,26 @@
<div style="font-size: 40px; color: #FFF">+</div>
</a>
</div>
<div>
<% posts.map(post => { %>
<a href="/communities/<%= community.name %>/<%= post.key.replace("%", "") %>" class="columns community-topic-link">
<div class="community-topic-name">
<%= topicTitle(post.value) %>
</div>
<div class="community-topic-replies" style="text-align: right;">💬 <%= post.value.replies.length %> replies</div>
</a>
<% }) %>
<div class="tabs" style="padding: 0 10px; background: #fbb">
<button class="tab-title tab-selected js-tab-button">
Wall
</button>
<button class="tab-title js-tab-button">
Members
</button>
</div>
<div class="tab-content">
<div class="tab-item js-tab-item">
<% posts.map(post => { %>
<a href="/communities/<%= community.name %>/<%= post.key.replace("%", "") %>" class="columns community-topic-link">
<div class="community-topic-name">
<%= topicTitle(post.value) %>
</div>
<div class="community-topic-replies" style="text-align: right;">💬 <%= post.value.replies.length %> replies</div>
</a>
<% }) %>
</div>
<div class="tab-item js-tab-item" style="display: none; padding: 10px">
<%- include('../_friends', { friends: community.members }) %>
</div>
</div>