Added support for following and unfollowing users and communities

This commit is contained in:
CaramelKat 2022-02-27 15:48:42 -06:00 committed by Jay
parent e90d172ffe
commit 8abf5841ac
3 changed files with 41 additions and 4 deletions

View File

@ -46,13 +46,22 @@
<div class="community-info">
<img class="user-icon" src="<%= cdnURL %>/icons/<%= community.community_id %>.png">
<h2 class="community-title"><%= community.name %></h2>
<%if(user.followed_communities.indexOf(community.community_id) !== -1){ %>
<div class="community-page-follow-button-wrapper selected">
<p class="community-page-follow-button-text" id="<%= community.community_id %>" onclick="followCommunity(this)" style="color: #FFFFFF"><%= lang.community.following %></p>
</div>
<%} else {%>
<div class="community-page-follow-button-wrapper" <%if(user.pid === 1000000000) {%> style="display: none" <%}%>>
<p class="community-page-follow-button-text" id="<%= community.community_id %>" onclick="followCommunity(this)"><%= lang.community.follow %></p>
</div>
<%}%>
</div>
<h4 class="community-description"><%= community.description %></h4>
<span class="community-page-follow-button-text" id="<%= community.community_id %>"></span>
<div class="info-boxes-wrapper">
<div>
<h4><%= lang.community.followers %></h4>
<h4><%= community.followers %></h4>
<h4 class="community-page-table-text"><%= community.followers %></h4>
</div>
<div>
<h4><%= lang.community.posts %></h4>

View File

@ -403,6 +403,7 @@ iframe {
.community-title {
padding-left: 0.5em;
font-size: larger;
padding-top: 0.5em;
}
.banner {
@ -410,6 +411,24 @@ iframe {
margin: -1em;
}
.community-page-follow-button-wrapper {
padding: 0.25em;
border: 2px solid var(--btn);
border-radius: 1em;
margin: 1.5em 0 auto auto;
cursor: pointer;
height: fit-content;
}
.community-page-follow-button-wrapper.selected {
background: var(--btn);
}
.community-page-follow-button-wrapper > p {
margin: 0.25em;
color: var(--text) !important;
}
@media screen and (max-width: 1350px) {
.communities-wrapper {
max-width: 600px;
@ -442,7 +461,7 @@ iframe {
}
.user-icon.verified {
border: none;
border: solid 2px var(--btn);
width: 2em;
height: 2em;
}

View File

@ -45,6 +45,15 @@
<div class="community-info">
<img class="user-icon <%if(user.official) {%>verified<%}%>" src="https://pretendo-cdn.b-cdn.net/mii/<%= user.pid %>/normal_face.png">
<h2 class="community-title"><%= user.user_id %> (<%= user.pnid %>)<span class="verified-badge" style="<%if(!user.official) {%>display: none;<%}%>">✓</span></h2>
<%if(parentUser.followed_users.indexOf(user.pid) !== -1){ %>
<div class="community-page-follow-button-wrapper user-page-follow-button-wrapper selected" <%if(parentUser.pid === 1000000000) {%> style="display: none" <%}%>>
<p class="community-page-follow-button-text user-page-follow-button-text" id="<%= user.pid %>" onclick="followUser(this)" style="color: #FFFFFF"><%= lang.user_page.following_user %></p>
</div>
<%} else {%>
<div class="community-page-follow-button-wrapper user-page-follow-button-wrapper" <%if(parentUser.pid === 1000000000) {%> style="display: none" <%}%>>
<p class="community-page-follow-button-text user-page-follow-button-text" id="<%= user.pid %>" onclick="followUser(this)"><%= lang.user_page.follow_user %></p>
</div>
<%}%>
</div>
<h4 class="community-description"><%if(user.profile_comment_visibility){%> <%= user.profile_comment %> <%}else {%><%= lang.global.private %><%}%></h4>
<div class="info-boxes-wrapper">
@ -75,8 +84,8 @@
</h4>
</div>
<div>
<h4><%= lang.global.yeahs %></h4>
<h4>0</h4>
<h4><%= lang.user_page.followers %></h4>
<h4 id="user-page-followers-tab"><%= user.followers %></h4>
</div>
</div>
</div>