summaryrefslogtreecommitdiff
path: root/src/match_up/templates/macros.j2
blob: 3e6c4d6a638a377f55ba3912a707b3d2208f1203 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{% macro court_button(id, status) -%}
<button class= "button is-responsive {% if status %}is-success{% else %}is-danger{% endif %}" 
        hx-post="{{ "/court-toggle/" ~ id}}" 
        hx-swap="outerHTML"> Court {{ id }}</button>
{%- endmacro %}

{% macro player_button(player) -%}
<button class="button is-responsive {% if player.status %}is-success{% else %}is-danger {% endif %}" 
        hx-post="{{ "/player-toggle/" ~ player.id}}"
        hx-swap="outerHTML"> {{ player.first + " " + player.last}} </button>
{%- endmacro %}

{% macro guest_control(level, value) -%}
<div class="field has-addons" id="guests_{{level}}">
    <div class="control">
        <button class="button is-responsive is-dark" 
                hx-post="/decrement_guest" 
                hx-swap="outerHTML"
                hx-vals='{"level": "{{ level }}"}'
                hx-target="#guests_{{ level }}"><span class="icon"><i class="fas fa-light fa-minus"></i></span></button>
    </div>
    <div class="control">
        <input class="input is-responsive" type="text" style="text-align:center" value="{{ value }}" disabled>
    </div>
    <div class="control">
        <button class="button is-responsive is-dark" 
                hx-post="/increment_guest"
                hx-swap="outerHTML"
                hx-vals='{"level": "{{ level }}"}'
                hx-target="#guests_{{ level }}"><span class="icon"><i class="fas fa-light fa-plus"></i></span></button>
    </div>
</div>
{%- endmacro %}

{% macro header(url_for) -%}
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Match Up!</title>
    <link rel="icon" type="image/x-icon" href="{{ url_for('static', filename='favicon.ico') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='bulma.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='notyf.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='custom.css') }}">
    <script src="{{ url_for('static', filename='htmx.min.js') }}"></script>
    <script src="{{ url_for('static', filename='notyf.min.js') }}"></script>
    <script src="{{ url_for('static', filename='fontawesome.js') }}"></script>
    <script defer src="{{ url_for('static', filename='custom.js') }}"></script>
</head>
{%- endmacro %}

{% macro footer() -%}
<div class="content has-text-centered">Made by <a href="https://karanjayachandra.com/">Karan</a> using <a href="https://flask.palletsprojects.com">Flask</a>, <a href="https://htmx.org/">HTMX</a>, <a href="https://carlosroso.com/notyf/">Notyf</a> and <a href="https://bulma.io">Bulma</a></div>
{%- endmacro %}

{% macro navbar(url_for) -%}
<nav class="level">
    <p class="level-item has-text-centered">
        <button class="button is-link" onclick="location.href = '/';">Games</button>
    </p>
    <p class="level-item has-text-centered">
        <button class="button is-link" onclick="location.href = '/players';">Players</button>
    </p>
    <div class="level-item has-text-centered"></div>
    <div class="level-left">
        <div class="level-item">
            <figure class="image container is-128x128">
                <img src="{{ url_for('static', filename='logo.png') }}"/>
            </figure>
        </div>
    </div>
    <div class="level-item has-text-centered">
        <p class="title">Match Up!</p>
    </div>
    <div class="level-item has-text-centered"></div>
    <div class="level-item has-text-centered"></div>
    <div class="level-right">
        <div class="field has-addons has-addons-centered">
            <div class="control"><button class="button is-dark" id="timer-dec">
                <span class="icon"><i class="fas fa-light fa-minus"></i></span>
            </button></div>
            <p class="control has-icons-left has-icons-right">
                <input class="input is-responsive" id="timer-display" type="text" style="text-align:center; " readonly>
                <span class="icon is-small is-left">
                    <i class="fas fa-light fa-clock"></i>
                </span>
            </p>
            <div class="control"><button class="button is-dark" id="timer-inc">
                <span class="icon"><i class="fas fa-light fa-plus"></i></span>
            </button></div>
            <div class="control"><button class="button is-dark" id="timer-start">
                <span class="icon"><i class="fas fa-light fa-play"></i></span>
            </button></div>
            <div class="control"><button class="button is-dark" id="timer-stop">
                <span class="icon"><i class="fas fa-light fa-stop"></i></span>
            </button></div>
        </div>
    </div>
</nav>
{%- endmacro %}