summaryrefslogtreecommitdiffstats
path: root/src/templates/draft.zmpl
diff options
context:
space:
mode:
authorsadbeast <sadbeast@sadbeast.com>2024-07-16 18:16:29 -0700
committersadbeast <sadbeast@sadbeast.com>2024-10-05 16:40:55 -0700
commit6bd24af2ffbea91db1b10a5d5258980ce2068c7f (patch)
tree66634833f2d45260be5fcaf9111400eda12f03cc /src/templates/draft.zmpl
downloadteamdraft-main.tar.gz
teamdraft-main.tar.bz2
let's goHEADmain
Diffstat (limited to 'src/templates/draft.zmpl')
-rw-r--r--src/templates/draft.zmpl60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/templates/draft.zmpl b/src/templates/draft.zmpl
new file mode 100644
index 0000000..8957b29
--- /dev/null
+++ b/src/templates/draft.zmpl
@@ -0,0 +1,60 @@
+@zig {
+const can_pick = data.getPresence("can_pick");
+ if (!data.getPresence("running")) {
+ <div id="qrcode"></div>
+ @html HTML
+ <script>
+ const qrcode = new QRCode(document.getElementById('qrcode'), {
+ text: 'https://teamdraft.net/invite/{{.code}}',
+ width: 128,
+ height: 128,
+ colorDark : '#000',
+ colorLight : '#fff',
+ correctLevel : QRCode.CorrectLevel.H
+ });
+ </script>
+ HTML
+ <p><pre>https://teamdraft.net/invite/{{.code}}</pre></p>
+ }
+<div hx-select="#draft" id="draft" hx-get="/drafts/{{.draft_id}}" hx-trigger="every 1s">
+<div class="sticky">
+ if (data.getPresence("running")) {
+ <br/>Round Time Remaining: {{.round_time_remaining}}
+ }
+ <br/>{{.message}}
+</div>
+ if (zmpl.get("teams")) |teams| {
+ <div>
+ <table class="striped">
+ <thead>
+ <tr>
+ <th>Team</th>
+ <th colspan="2">Rank</th>
+ </tr>
+ </thead>
+ <tbody>
+ for (teams.items(.array)) |team| {
+ const id = team.get("id");
+ const rank = team.get("rank");
+ const name = team.get("name");
+ const picked: bool = team.getT(.boolean, "picked") orelse true;
+ const pick_user = team.get("pick_user");
+ <tr>
+ <td>{{name}}</td>
+ <td>{{rank}}</td>
+ <td>
+ {{pick_user}}
+ if (can_pick and !picked) {
+ <form method="post" action="/drafts/{{.draft_id}}/pick?team_id={{id}}">
+ <input type="submit" value="Pick" style="" />
+ </form>
+ }
+ </td>
+ </tr>
+ }
+ </tbody>
+ </table>
+ </div>
+ }
+}
+</div>