lottery
This commit is contained in:
parent
ef105e1cac
commit
b918b92a4d
6 changed files with 702 additions and 0 deletions
|
|
@ -258,6 +258,70 @@ h1 {
|
|||
min-width: min(100%, 360px);
|
||||
}
|
||||
|
||||
.lottery-grid {
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.lottery-hero {
|
||||
background:
|
||||
radial-gradient(circle at top left, rgba(255, 209, 102, 0.32), transparent 35%),
|
||||
linear-gradient(140deg, #10214d 0%, #1540d1 52%, #1b8f6a 100%);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.lottery-title {
|
||||
max-width: 12ch;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.lottery-hero .eyebrow,
|
||||
.lottery-hero .lede,
|
||||
.lottery-hero .meta-line {
|
||||
color: rgba(255, 255, 255, 0.82);
|
||||
}
|
||||
|
||||
.lottery-stat-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 14px;
|
||||
margin-top: 28px;
|
||||
}
|
||||
|
||||
.lottery-stat {
|
||||
padding: 16px 18px;
|
||||
border-radius: 18px;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
border: 1px solid rgba(255, 255, 255, 0.14);
|
||||
}
|
||||
|
||||
.lottery-stat span {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
color: rgba(255, 255, 255, 0.72);
|
||||
}
|
||||
|
||||
.lottery-stat strong {
|
||||
font-size: 1.35rem;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
|
||||
.lottery-banner {
|
||||
margin-top: 20px;
|
||||
padding: 14px 16px;
|
||||
border-radius: 16px;
|
||||
background: rgba(255, 255, 255, 0.14);
|
||||
}
|
||||
|
||||
.lottery-note {
|
||||
color: var(--muted);
|
||||
margin-bottom: 0;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.lottery-stats-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.stats-row {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
|
@ -427,4 +491,9 @@ h1 {
|
|||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.lottery-stat-row,
|
||||
.lottery-stats-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
<a href="/app">Dashboard</a>
|
||||
<a href="/leaderboard">Leaderboard</a>
|
||||
<a href="/app/transfer">Transfer</a>
|
||||
<a href="/app/lottery">Lottery</a>
|
||||
<a href="/app/transactions">Transactions</a>
|
||||
<form method="post" action="/logout" class="inline-form">
|
||||
<input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
|
||||
|
|
@ -61,6 +62,8 @@
|
|||
{{ template "leaderboard" . }}
|
||||
{{ else if eq .Page "transfer" }}
|
||||
{{ template "transfer" . }}
|
||||
{{ else if eq .Page "lottery" }}
|
||||
{{ template "lottery" . }}
|
||||
{{ else if eq .Page "transactions" }}
|
||||
{{ template "transactions" . }}
|
||||
{{ else if eq .Page "admin_dashboard" }}
|
||||
|
|
|
|||
|
|
@ -140,6 +140,94 @@
|
|||
</section>
|
||||
{{ end }}
|
||||
|
||||
{{ define "lottery" }}
|
||||
{{ $page := .Data }}
|
||||
<section class="stack-section">
|
||||
<div class="page-grid lottery-grid">
|
||||
<div class="card lottery-hero">
|
||||
<p class="eyebrow">Hourly pool</p>
|
||||
<h1 class="lottery-title">Deposit into the pool and wait for the next draw.</h1>
|
||||
<p class="lede">Each deposit joins the active round. When the draw deadline passes, the full pool is credited to one randomly selected ticket holder.</p>
|
||||
<div class="lottery-stat-row">
|
||||
<article class="lottery-stat">
|
||||
<span>Your balance</span>
|
||||
<strong>{{ money $page.User.BalanceMinor }}</strong>
|
||||
</article>
|
||||
<article class="lottery-stat">
|
||||
<span>Current pool</span>
|
||||
<strong>{{ if $page.Lottery.ActiveRound }}{{ money $page.Lottery.ActiveRound.PoolMinor }}{{ else }}0,00 CZK{{ end }}</strong>
|
||||
</article>
|
||||
</div>
|
||||
{{ if $page.LastPayout }}
|
||||
<div class="lottery-banner">
|
||||
Latest draw paid <strong>{{ money $page.LastPayout.PoolMinor }}</strong> to <strong>{{ $page.LastPayout.WinnerUsername }}</strong>.
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Join the round</h2>
|
||||
<form method="post" action="/app/lottery/deposit" class="stack-form">
|
||||
<input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}">
|
||||
<label>Amount in CZK<input type="text" name="amount" placeholder="100,00" required></label>
|
||||
<button class="button primary" type="submit">Deposit to lottery</button>
|
||||
</form>
|
||||
<p class="muted lottery-note">Each deposit creates one ticket. More deposits mean more chances in the same hourly round.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-grid lottery-grid">
|
||||
<div class="card">
|
||||
<h2>Active round</h2>
|
||||
{{ if $page.Lottery.ActiveRound }}
|
||||
<dl class="stats-grid lottery-stats-grid">
|
||||
<div>
|
||||
<dt>Draw at</dt>
|
||||
<dd>{{ dt $page.Lottery.ActiveRound.DrawAt }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Participants</dt>
|
||||
<dd>{{ $page.Lottery.ActiveRound.ParticipantCount }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Total tickets</dt>
|
||||
<dd>{{ $page.Lottery.ActiveRound.TicketCount }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Your tickets</dt>
|
||||
<dd>{{ $page.Lottery.ActiveRound.UserTicketCount }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<p class="meta-line">Your current contribution: <strong>{{ money $page.Lottery.ActiveRound.UserContributionMinor }}</strong></p>
|
||||
{{ else }}
|
||||
<p class="muted">No active round yet. The first deposit starts the next one-hour lottery window.</p>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Recent winners</h2>
|
||||
<div class="table-wrap">
|
||||
<table class="table">
|
||||
<thead><tr><th>When</th><th>Winner</th><th>Pool</th><th>Tickets</th></tr></thead>
|
||||
<tbody>
|
||||
{{ range $page.Lottery.RecentPayouts }}
|
||||
<tr>
|
||||
<td>{{ dt .CompletedAt }}</td>
|
||||
<td>{{ .WinnerUsername }}<div class="subtle">{{ .WinnerAccount }}</div></td>
|
||||
<td>{{ money .PoolMinor }}</td>
|
||||
<td>{{ .TicketCount }}</td>
|
||||
</tr>
|
||||
{{ else }}
|
||||
<tr><td colspan="4" class="muted">No lottery winners yet.</td></tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
{{ define "admin_dashboard" }}
|
||||
{{ $page := .Data }}
|
||||
<section class="stack-section">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue