90 lines
No EOL
3.9 KiB
Text
90 lines
No EOL
3.9 KiB
Text
<%- include("../base/header", { title: "Home", userId: session.userId }) %>
|
|
<div class="row">
|
|
<div class="col text-center pb-5 lg-sm-0">
|
|
<h1>Welcome back <%= user.Username %>!</h1>
|
|
<h3>What would you like to do?</h3>
|
|
<div class="mt-3 text-nowrap">
|
|
<div>
|
|
<a class="btn btn-primary btn-lg me-2" href="/account/changeusername">Change Username</a>
|
|
<a class="btn btn-primary btn-lg disabled" href="/account/password">Change Password</a>
|
|
</div>
|
|
<div class="mt-3">
|
|
<a class="btn btn-primary btn-lg me-2" href="/party/create">Create Party</a>
|
|
<a class="btn btn-primary btn-lg" href="/party/join">Join Party</a>
|
|
</div>
|
|
<% if (user.UserLevel === UserLevel.BadgeEditor) { %>
|
|
<div class="mt-3">
|
|
<a class="btn btn-primary btn-lg" href="/admin/badges">Badge Management</a>
|
|
</div>
|
|
<% } %>
|
|
<% if (user.UserLevel === UserLevel.Admin) { %>
|
|
<div class="mt-3">
|
|
<a class="btn btn-primary btn-lg" href="/admin">Admin Dashboard</a>
|
|
</div>
|
|
<% } %>
|
|
</div>
|
|
</div>
|
|
<div class="col pb-5">
|
|
<h3>Your Parties</h3>
|
|
<% if (parties.length > 0) { %>
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Name</th>
|
|
<th scope="col">Code</th>
|
|
<th scope="col"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% for (const party of parties) { %>
|
|
<tr>
|
|
<td><%= party.Name %></td>
|
|
<td class="align-middle"><%= party.PartyRef %></td>
|
|
<td class="text-end text-nowrap align-middle">
|
|
<% if (activeUserParty && activeUserParty.PartyId === party.Id) { %>
|
|
<a href="/party/deactivate" class="btn btn-sm btn-success me-2">Deactivate</a>
|
|
<% } else { %>
|
|
<a href="/party/setactive?id=<%= party.Id %>" class="btn btn-sm btn-success me-2"> Activate </a>
|
|
<% } %>
|
|
<% if (party.CreatedByUserId === user.Id) { %>
|
|
<a href="/party/delete?id=<%= party.Id %>" class="btn btn-sm btn-danger" onclick="return confirm(`Are you sure you want to delete '<%= party.Name %>'?\nThis will remove all users in this party from it.\nThis action cannot be undone.`)">Delete</a>
|
|
<% } else { %>
|
|
<a href="/party/leave?id=<%= party.Id %>" class="btn btn-sm btn-danger" style="width:4.275rem" onclick="return confirm(`Are you sure you want to leave '<%= party.Name %>'?`)">Leave</a>
|
|
<% } %>
|
|
</td>
|
|
</tr>
|
|
<% } %>
|
|
</tbody>
|
|
</table>
|
|
<% } else { %>
|
|
<div class="alert alert-primary" role="alert">You are not in any parties.</div>
|
|
<% } %>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col">
|
|
<h3>Badges</h3>
|
|
<div class="row mt-4">
|
|
<div class="col">
|
|
<% for (const badgeKey of badgeById.keys) { %>
|
|
<% const badge = badgeById.get(badgeKey); const unlockedBadge = unlockedBadgesById.get(badgeKey); %>
|
|
<% if (unlockedBadge) { %>
|
|
<span class="d-inline-block mb-3" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="top" data-bs-title="<%= badge.Name %>" data-bs-content="<%= badge.Description.replaceAll("\r", "").replaceAll("\n", "<br>") %><br><%= badge.Id === 13 ? `<small>You've been Dame'd ${user.DameCount} times</small><br>` : "" %><small>Unlocked on <%= unlockedBadge.CreatedDatetime.toString().split(" ").slice(1, 4).join(" ") %></small>">
|
|
<img width="32" height="32" src="<%= badge.ImageUrl %>">
|
|
</span>
|
|
<% } else if (!badge.IsSecret) { %>
|
|
<span class="d-inline-block mb-3" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="top" data-bs-title="???" data-bs-content="<%= badge.Hint %>">
|
|
<img src="https://eusv.net/Mu6LedXkxrZDUB">
|
|
</span>
|
|
<% } %>
|
|
<% } %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]');
|
|
const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl, { html: true }));
|
|
</script>
|
|
<%- include("../base/footer", { apiKey: session.apiKey, username: session.username }) %> |