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) => { async (req, res) => {
const name = req.params.name; 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", { res.render("mobile/communities/community", {
community: { name }, community: { name, members },
posts, posts,
layout: "mobile/_layout", layout: "mobile/_layout",
}); });

View File

@ -196,3 +196,8 @@ a.compose-new-button {
margin-top: 8px; margin-top: 8px;
border: 1px solid #bbb; 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> <div style="font-size: 40px; color: #FFF">+</div>
</a> </a>
</div> </div>
<div> <div class="tabs" style="padding: 0 10px; background: #fbb">
<% posts.map(post => { %> <button class="tab-title tab-selected js-tab-button">
<a href="/communities/<%= community.name %>/<%= post.key.replace("%", "") %>" class="columns community-topic-link"> Wall
<div class="community-topic-name"> </button>
<%= topicTitle(post.value) %> <button class="tab-title js-tab-button">
</div> Members
<div class="community-topic-replies" style="text-align: right;">💬 <%= post.value.replies.length %> replies</div> </button>
</a> </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> </div>