2024-09-19 00:41:40 +01:00
<%- include("../base/header", { title: "Home", userId: session.userId }) %>
2024-04-23 00:58:07 +01:00
<div class="row">
2024-07-15 23:31:50 +01:00
<div class="col text-center pb-5 lg-sm-0">
2024-04-23 00:58:07 +01:00
<h1>Welcome back <%= user.Username %>!</h1>
<h3>What would you like to do?</h3>
2024-07-15 23:31:50 +01:00
<div class="mt-3 text-nowrap">
2024-04-23 00:58:07 +01:00
<div>
2024-09-26 00:47:08 +01:00
<a class="btn btn-primary btn-lg me-2" href="/account/changeusername">Change Username</a>
2024-09-28 01:31:46 +01:00
<a class="btn btn-primary btn-lg disabled" href="/account/password">Change Password</a>
2024-04-23 00:58:07 +01:00
</div>
<div class="mt-3">
2024-04-23 17:01:25 +01:00
<a class="btn btn-primary btn-lg me-2" href="/party/create">Create Party</a>
2024-09-28 01:31:46 +01:00
<a class="btn btn-primary btn-lg" href="/party/join">Join Party</a>
2024-04-23 00:58:07 +01:00
</div>
2024-09-29 21:35:36 +01:00
<% if (user.UserLevel === UserLevel.BadgeEditor) { %>
<div class="mt-3">
<a class="btn btn-primary btn-lg" href="/admin/badges">Badge Management</a>
</div>
<% } %>
2024-09-28 01:31:46 +01:00
<% if (user.UserLevel === UserLevel.Admin) { %>
<div class="mt-3">
<a class="btn btn-primary btn-lg" href="/admin">Admin Dashboard</a>
</div>
<% } %>
2024-04-23 00:58:07 +01:00
</div>
</div>
2024-10-08 11:04:46 +01:00
<div class="col pb-5">
2024-04-23 00:58:07 +01:00
<h3>Your Parties</h3>
<% if (parties.length > 0) { %>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Name</th>
2024-04-23 17:01:25 +01:00
<th scope="col">Code</th>
2024-04-23 00:58:07 +01:00
<th scope="col"></th>
</tr>
2024-04-23 17:01:25 +01:00
</thead>
<tbody>
<% for (const party of parties) { %>
<tr>
<td><%= party.Name %></td>
2024-09-28 01:31:46 +01:00
<td class="align-middle"><%= party.PartyRef %></td>
<td class="text-end text-nowrap align-middle">
2024-04-24 00:05:57 +01:00
<% if (activeUserParty && activeUserParty.PartyId === party.Id) { %>
<a href="/party/deactivate" class="btn btn-sm btn-success me-2">Deactivate</a>
<% } else { %>
2024-09-28 01:31:46 +01:00
<a href="/party/setactive?id=<%= party.Id %>" class="btn btn-sm btn-success me-2"> Activate </a>
2024-04-24 00:05:57 +01:00
<% } %>
2024-04-23 17:01:25 +01:00
<% if (party.CreatedByUserId === user.Id) { %>
2024-09-23 23:55:00 +01:00
<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>
2024-04-23 17:01:25 +01:00
<% } else { %>
2024-09-28 01:31:46 +01:00
<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>
2024-04-23 17:01:25 +01:00
<% } %>
</td>
</tr>
<% } %>
</tbody>
2024-04-23 00:58:07 +01:00
</table>
<% } else { %>
<div class="alert alert-primary" role="alert">You are not in any parties.</div>
<% } %>
</div>
</div>
2024-10-08 09:41:47 +01:00
<div class="row">
<div class="col">
<h3>Badges</h3>
<div class="row mt-4">
<div class="col">
2024-10-08 11:04:46 +01:00
<% for (const badgeKey of badgeById.keys) { %>
<% const badge = badgeById.get(badgeKey); const unlockedBadge = unlockedBadgesById.get(badgeKey); %>
<% if (unlockedBadge) { %>
2024-10-12 11:52:13 +01:00
<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>">
2024-10-08 11:04:46 +01:00
<img width="32" height="32" src="<%= badge.ImageUrl %>">
</span>
<% } else if (!badge.IsSecret) { %>
2024-10-08 11:25:24 +01:00
<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="???">
2024-10-08 11:04:46 +01:00
<img src="https://eusv.net/Mu6LedXkxrZDUB">
</span>
<% } %>
2024-10-08 09:41:47 +01:00
<% } %>
</div>
</div>
</div>
</div>
2024-10-08 11:04:46 +01:00
<script>
const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]');
const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl, { html: true }));
</script>
2024-09-19 00:41:40 +01:00
<%- include("../base/footer") %>