Show communities on your home on desktop

This commit is contained in:
Rogerio Chaves 2020-04-26 19:07:37 +02:00
parent d5c3121cb7
commit ddd5bff147
No known key found for this signature in database
GPG Key ID: E6AF5440509B1D94
4 changed files with 19 additions and 3 deletions

View File

@ -164,15 +164,17 @@ router.get(
return res.render("index"); return res.render("index");
} }
const [posts, friends, secretMessages] = await Promise.all([ const [posts, friends, secretMessages, communities] = await Promise.all([
queries.getPosts(req.context.profile), queries.getPosts(req.context.profile),
queries.getFriends(req.context.profile), queries.getFriends(req.context.profile),
queries.getSecretMessages(req.context.profile), queries.getSecretMessages(req.context.profile),
queries.getProfileCommunities(req.context.profile.id),
]); ]);
res.render("home", { res.render("home", {
posts, posts,
friends, friends,
secretMessages, secretMessages,
communities,
profile: req.context.profile, profile: req.context.profile,
}); });
} }

View File

@ -46,6 +46,10 @@ nav {
border: 1px solid #600; border: 1px solid #600;
} }
.friends-communities p {
font-size: 14px;
}
.secret-chat { .secret-chat {
min-width: 200px; min-width: 200px;
max-width: 200px; max-width: 200px;

View File

@ -6,7 +6,7 @@
<p>You haven't joined any communities yet, explore some below to join</p> <p>You haven't joined any communities yet, explore some below to join</p>
<% } %> <% } %>
<% participating.map(community => { %> <% participating.map(community => { %>
<a href="/mobile/communities/<%= community %>" class="link-block"> <a href="/communities/<%= community %>" class="link-block">
#<%= community %> #<%= community %>
</a> </a>
<% }) %> <% }) %>
@ -14,7 +14,7 @@
<h1 style="margin-top: 40px; margin-bottom: 10px">Explore</h1> <h1 style="margin-top: 40px; margin-bottom: 10px">Explore</h1>
<% communities.map(community => { %> <% communities.map(community => { %>
<a href="/mobile/communities/<%= community %>" class="link-block"> <a href="/communities/<%= community %>" class="link-block">
#<%= community %> #<%= community %>
</a> </a>
<% }) %> <% }) %>

View File

@ -57,6 +57,16 @@
<h2 style="margin-top: 30px">Requests Sent</h2> <h2 style="margin-top: 30px">Requests Sent</h2>
<%- include('_friends', { friends: friends.requestsSent }) %> <%- include('_friends', { friends: friends.requestsSent }) %>
<% } %> <% } %>
<h2 style="margin-top: 30px">Communities</h2>
<% communities.map(community => { %>
<a href="/communities/<%= community %>" class="link-block">
#<%= community %>
</a>
<% }) %>
<% if (communities.length == 0) { %>
<p>You haven't joined any communities yet</p>
<% } %>
</div> </div>
</div> </div>