allow for a starting date and hidden hunt if it hasnt started
All checks were successful
Build Images and Deploy / Update-PROD-Stack (push) Successful in 31s

This commit is contained in:
2026-03-19 14:39:06 -04:00
parent 79c0b883f7
commit 34b3a4cbd0
12 changed files with 107 additions and 30 deletions

View File

@@ -40,6 +40,18 @@
<div class="form-hint">Leave blank for no expiry.</div>
</div>
<div class="form-group">
<label for="start_date">Start Date (optional)</label>
<input type="datetime-local" id="start_date" name="start_date" class="form-control">
<div class="form-hint">When the hunt becomes active. Leave blank to start immediately.</div>
</div>
<div class="form-group" style="display: flex; align-items: center; gap: 0.5rem;">
<input type="checkbox" id="hidden_until_start" name="hidden_until_start" value="1">
<label for="hidden_until_start" style="margin: 0; cursor: pointer;">Hidden until start date</label>
<div class="form-hint" style="margin-left: auto;">Keep this hunt secret until the start time.</div>
</div>
<button type="submit" class="btn btn-primary" style="width: 100%; justify-content: center;">Create Hunt</button>
</form>
</div>

View File

@@ -18,10 +18,18 @@
<h3><%= hunt.name %></h3>
<span class="meta"><%= hunt.short_name %> &middot; <%= hunt.package_count %> packages
<% if (isAdmin && hunt.creator_name) { %> &middot; by <%= hunt.creator_name %><% } %>
<% if (hunt.expiry_date) { %> &middot; Expires: <%= new Date(hunt.expiry_date).toLocaleDateString() %><% } %>
<% if (hunt.expiry_date) { %> &middot; Expires <time datetime="<%= hunt.expiry_date %>"><%= new Date(hunt.expiry_date).toLocaleDateString() %></time><% } %>
<% if (hunt.start_date) { %> &middot; Starts <time datetime="<%= hunt.start_date %>"><%= new Date(hunt.start_date).toLocaleDateString() %></time><% } %>
</span>
</div>
<span class="badge">Manage</span>
<div style="display: flex; gap: 0.4rem; align-items: center;">
<% if (hunt.hidden_until_start && hunt.start_date && new Date(hunt.start_date + 'Z') > new Date()) { %>
<span class="badge expired" style="font-size: 0.7rem;">Hidden</span>
<% } else if (hunt.start_date && new Date(hunt.start_date + 'Z') > new Date()) { %>
<span class="badge" style="font-size: 0.7rem;">Upcoming</span>
<% } %>
<span class="badge">Manage</span>
</div>
</a>
<% }) %>
<% } %>

View File

@@ -36,6 +36,19 @@
<div class="form-hint">Leave blank for no expiry.</div>
</div>
<div class="form-group">
<label for="start_date">Start Date (optional)</label>
<input type="datetime-local" id="start_date" name="start_date" class="form-control"
value="<%= hunt.start_date ? new Date(hunt.start_date).toISOString().slice(0, 16) : '' %>">
<div class="form-hint">When the hunt becomes active. Leave blank to start immediately.</div>
</div>
<div class="form-group" style="display: flex; align-items: center; gap: 0.5rem;">
<input type="checkbox" id="hidden_until_start" name="hidden_until_start" value="1" <%= hunt.hidden_until_start ? 'checked' : '' %>>
<label for="hidden_until_start" style="margin: 0; cursor: pointer;">Hidden until start date</label>
<div class="form-hint" style="margin-left: auto;">Keep this hunt secret until the start time.</div>
</div>
<button type="submit" class="btn btn-primary" style="width: 100%; justify-content: center;">Save Changes</button>
</form>
</div>

View File

@@ -42,9 +42,15 @@
<div class="label">Discovery Rate</div>
</div>
<div class="stat-box">
<div class="value"><%= hunt.expiry_date ? new Date(hunt.expiry_date).toLocaleDateString() : 'Never' %></div>
<div class="value"><% if (hunt.expiry_date) { %><time datetime="<%= hunt.expiry_date %>"><%= new Date(hunt.expiry_date).toLocaleDateString() %></time><% } else { %>Never<% } %></div>
<div class="label">Expires</div>
</div>
<% if (hunt.start_date) { %>
<div class="stat-box">
<div class="value"><time datetime="<%= hunt.start_date %>"><%= new Date(hunt.start_date).toLocaleDateString() %></time></div>
<div class="label">Starts</div>
</div>
<% } %>
</div>
<% if (typeof stats !== 'undefined' && stats.topFinders.length > 0) { %>

View File

@@ -52,10 +52,14 @@
<a href="/hunt/<%= hunt.short_name %>" class="hunt-card">
<div class="hunt-info">
<h3><%= hunt.name %></h3>
<span class="meta"><%= hunt.short_name %> &middot; <%= hunt.package_count %> packages &middot; by <%= hunt.creator_name %></span>
<span class="meta"><%= hunt.short_name %> &middot; <%= hunt.package_count %> packages &middot; by <%= hunt.creator_name %>
<% if (hunt.expiry_date) { %> &middot; Expires <time datetime="<%= hunt.expiry_date %>"><%= new Date(hunt.expiry_date).toLocaleDateString() %></time><% } %>
</span>
</div>
<% if (hunt.expiry_date && new Date(hunt.expiry_date) < new Date()) { %>
<% if (hunt.expiry_date && new Date(hunt.expiry_date + 'Z') < new Date()) { %>
<span class="badge expired">Expired</span>
<% } else if (hunt.start_date && new Date(hunt.start_date + 'Z') > new Date()) { %>
<span class="badge">Upcoming</span>
<% } else { %>
<span class="badge"><%= hunt.package_count %> packages</span>
<% } %>

View File

@@ -14,12 +14,17 @@
<h3><%= hunt.name %></h3>
<span class="meta"><%= hunt.short_name %> &middot; <%= hunt.package_count %> packages &middot; by <%= hunt.creator_name %>
<% if (hunt.expiry_date) { %>
&middot; Expires: <%= new Date(hunt.expiry_date).toLocaleDateString() %>
&middot; Expires <time datetime="<%= hunt.expiry_date %>"><%= new Date(hunt.expiry_date).toLocaleDateString() %></time>
<% } %>
<% if (hunt.start_date && new Date(hunt.start_date + 'Z') > new Date()) { %>
&middot; Starts <time datetime="<%= hunt.start_date %>"><%= new Date(hunt.start_date).toLocaleDateString() %></time>
<% } %>
</span>
</div>
<% if (hunt.expiry_date && new Date(hunt.expiry_date) < new Date()) { %>
<% if (hunt.expiry_date && new Date(hunt.expiry_date + 'Z') < new Date()) { %>
<span class="badge expired">Expired</span>
<% } else if (hunt.start_date && new Date(hunt.start_date + 'Z') > new Date()) { %>
<span class="badge">Upcoming</span>
<% } else { %>
<span class="badge"><%= hunt.package_count %> packages</span>
<% } %>