From a355423ff7566ff1d38bfa1627ec5b7ffa4b6bdc Mon Sep 17 00:00:00 2001 From: Karan Jayachandra Date: Wed, 16 Oct 2024 23:57:24 +0200 Subject: Cleaned up the layout a bit --- app.py | 5 +++++ templates/controls.j2 | 10 +++++++++- templates/index.j2 | 35 +++++++++++++++-------------------- templates/macros.j2 | 4 ++-- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/app.py b/app.py index f145354..2421ee9 100644 --- a/app.py +++ b/app.py @@ -27,6 +27,11 @@ def get_time(): return render_template(t, mins=mins, secs=secs) +@app.route("/control", methods=["GET"]) +def get_controls(): + return render_template("controls.j2", courts=rg.courts.get_courts()) + + @app.route("/guests", methods=["GET"]) def get_guests(): t = re.from_string('{% from "macros.j2" import guests %}{{guests(count)}}') diff --git a/templates/controls.j2 b/templates/controls.j2 index 1799e01..8e190c5 100644 --- a/templates/controls.j2 +++ b/templates/controls.j2 @@ -1,3 +1,5 @@ +{% from "macros.j2" import court %} +

Controls

@@ -48,4 +50,10 @@ hx-target="#games">Reset
-
+
+
+{% for key, value in courts.items() %} + {{ court(key, value) }} +{% endfor %} +
+
\ No newline at end of file diff --git a/templates/index.j2 b/templates/index.j2 index fcea4e3..22c72a0 100644 --- a/templates/index.j2 +++ b/templates/index.j2 @@ -11,29 +11,24 @@
- -
-
+
+
+
+ +

Games

- {% include 'controls.j2' %} -
-
-

Courts

-
+

Players

diff --git a/templates/macros.j2 b/templates/macros.j2 index 7117d11..65d886f 100644 --- a/templates/macros.j2 +++ b/templates/macros.j2 @@ -1,7 +1,7 @@ {% macro court(id, status) -%} + hx-swap="outerHTML"> Court {{ id }} {%- endmacro %} {% macro player(id, status, name) -%} @@ -18,6 +18,6 @@ {% macro timer(mins, secs) -%}
-

Timer: {{mins}}:{{secs}}

+

⏲️ {{mins}}:{{secs}}

{%- endmacro %} \ No newline at end of file -- cgit v1.3.1