Follower UI

This commit is contained in:
Tim Zöller 2025-12-03 23:05:37 +01:00
parent 301364b8a7
commit 8545a3f43b
5 changed files with 339 additions and 8 deletions

View file

@ -64,16 +64,20 @@
</div>
</div>
<div class="col-4">
<div class="stat-card">
<div class="stat-value" id="followersCount">0</div>
<div class="stat-label">Followers</div>
</div>
<a th:href="@{/profile/{username}/followers(username=${username})}" class="text-decoration-none text-dark">
<div class="stat-card stat-card-hover">
<div class="stat-value" id="followersCount">0</div>
<div class="stat-label">Followers</div>
</div>
</a>
</div>
<div class="col-4">
<div class="stat-card">
<div class="stat-value" id="followingCount">0</div>
<div class="stat-label">Following</div>
</div>
<a th:href="@{/profile/{username}/following(username=${username})}" class="text-decoration-none text-dark">
<div class="stat-card stat-card-hover">
<div class="stat-value" id="followingCount">0</div>
<div class="stat-label">Following</div>
</div>
</a>
</div>
</div>
@ -179,6 +183,14 @@
document.getElementById('avatarPlaceholder').classList.add('d-none');
}
// Follower/following counts
if (user.followersCount !== undefined) {
document.getElementById('followersCount').textContent = user.followersCount;
}
if (user.followingCount !== undefined) {
document.getElementById('followingCount').textContent = user.followingCount;
}
// Joined date
const joinedDate = new Date(user.createdAt);
document.getElementById('joinedDate').textContent = joinedDate.toLocaleDateString('en-US', { month: 'long', year: 'numeric' });