Skip to content

Commit

Permalink
feat: frontend changes
Browse files Browse the repository at this point in the history
make menus collapsible, and show info if restaurant is closed
  • Loading branch information
lamtonylam committed Aug 2, 2024
1 parent 9d4c2df commit d2afc28
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 17 deletions.
14 changes: 10 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ def index():
onko_makkaraa_chemicum = True
break

print(chemicum_menu)

chemicum_suljettu = False
if len(chemicum_menu) == 0:
chemicum_suljettu = True

onko_makkaraa_exactum = False
exactum_menu = []
for object in response.json():
Expand All @@ -49,13 +51,17 @@ def index():
if "Meksikolainen uunimakkara" in exactum_menu:
onko_makkaraa_exactum = True
break

print(exactum_menu)

exactum_suljettu = False
if len(exactum_menu) == 0:
exactum_suljettu = True

return render_template(
"index.html",
chemicum_menu=chemicum_menu,
chemicum_suljettu=chemicum_suljettu,
exactum_menu=exactum_menu,
exactum_suljettu=exactum_suljettu,
onko_makkaraa_chemicum=onko_makkaraa_chemicum,
onko_makkaraa_exactum=onko_makkaraa_exactum,
date=date,
Expand Down
59 changes: 46 additions & 13 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,72 @@ <h4>Mekuma (Meksikolainen uunimakkara) tracker</h4>
<li class="list-group-item">
<h1>
Mekuma Chemicumissa: {% if onko_makkaraa_chemicum %} ✅ {%
else %} ❌ {% endif %}</h1
>
else %} ❌ {% endif %}
</h1>
</li>
<li class="list-group-item">
<h1>
Mekuma Exactumissa: {% if onko_makkaraa_exactum %} ✅ {%
else %} ❌ {% endif %}</h1
>
else %} ❌ {% endif %}
</h1>
</li>
</ul>
<br />
<b>Chemicumissa on tänään seuraavat ruuat:</b>
{% for message in chemicum_menu %}
<hr />
{{ message }} {% endfor %}
<br />
<button
class="btn btn-primary"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapseChemicum"
aria-expanded="false"
aria-controls="collapseChemicum"
>
Klikkaa tästä
</button>
<div class="collapse" id="collapseChemicum">
{% for message in chemicum_menu %}
<hr />
{{ message }} {% endfor %} {% if chemcim_suljettu %}
<hr />
Chemicumista ei ole dataa, se on todennäköisesti tänään suljettu
<hr />
{% endif %}
</div>

{% if not exactum_suljettu %}
<hr />

<b>Exactumissa on tänään seuraavat ruuat:</b>
{% for message in exactum_menu %}
<br />
<button
class="btn btn-primary"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapseExactum"
aria-expanded="false"
aria-controls="collapseExactum"
>
Klikkaa tästä
</button>
<div class="collapse" id="collapseExactum">
{% for message in exactum_menu %}
<hr />
{{ message }} {% endfor %}
<hr />
</div>
{% endif %} {% if exactum_suljettu %}
<hr />
{{ message }} {% endfor %}
<b>Exactumista ei ole dataa, se on todennäköisesti tänään suljettu</b>
<hr />
{% endif %}

<div class="btn-group-vertical">
<a
class="btn btn-primary btn"
href="https://www.cs.helsinki.fi/u/tonylam/"
>Tehnyt: Tony Lam</a
>
<a
class="btn btn-outline-primary btn"
href="https://unicafe.fi/"
<a class="btn btn-outline-primary btn" href="https://unicafe.fi/"
>API: Unicafe</a
>
</div>
Expand Down

0 comments on commit d2afc28

Please sign in to comment.