diff options
Diffstat (limited to 'src/templates/draft.zmpl')
-rw-r--r-- | src/templates/draft.zmpl | 60 |
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> |