Skip to content

Commit b79723d

Browse files
authored
feat: Improvements to the results announcement (#1009)
1 parent 0771e74 commit b79723d

File tree

10 files changed

+24
-12
lines changed

10 files changed

+24
-12
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% load components %}
22
<div class="flex gap-2 items-center shrink-0">
3-
<span class="iconify shrink-0 shadow-lg"
3+
<span class="iconify shrink-0 shadow-lg h-4 aspect-4/3"
44
data-icon="flag:{{ attributes.code|lower }}-4x3"></span>
55
<span>{{ attributes.name }}</span>
66
</div>

bullet/bullet_admin/templates/bullet_admin/generic/list_countries.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
{% if request.GET.country == country %}
2121
{% anavitem url=url active=True %}
2222
<div class="flex gap-2 items-center flex-wrap">
23-
<span class="iconify shrink-0 shadow-lg"
23+
<span class="iconify shrink-0 shadow-lg h-4 aspect-4/3"
2424
data-icon="flag:{{ country_info.code|lower }}-4x3"></span>
2525
<span>{{ country_info.name }}</span>
2626
</div>
2727
{% endanavitem %}
2828
{% else %}
2929
{% anavitem url=url active=False %}
3030
<div class="flex gap-2 items-center flex-wrap">
31-
<span class="iconify shrink-0 shadow-lg"
31+
<span class="iconify shrink-0 shadow-lg h-4 aspect-4/3"
3232
data-icon="flag:{{ country_info.code|lower }}-4x3"></span>
3333
<span>{{ country_info.name }}</span>
3434
</div>

bullet/bullet_admin/templates/bullet_admin/results/announce.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@
3939
<span>{{ position }}.</span>
4040
<button class="btn-admin-sm bg-primary hover:bg-primary-dark"
4141
hx-get="{{ links.prev }}"
42-
hx-trigger="click, keyup[key=='ArrowDown'||key=='Backspace'] from:body">
42+
hx-trigger="click, keyup[key=='ArrowDown'||key=='ArrowLeft'||key=='PageUp'||key=='Backspace'] from:body">
4343
<i class="fas fa-arrow-down"></i>
4444
</button>
4545
<button class="btn-admin-sm bg-primary hover:bg-primary-dark"
4646
hx-get="{{ links.hide }}"
47-
hx-trigger="click, keyup[key=='h'] from:body">
47+
hx-trigger="click, keyup[key=='h'||key=='b'||key=='.'] from:body">
4848
<i class="fas fa-eye-slash"></i>
4949
</button>
5050
<button class="btn-admin-sm bg-primary hover:bg-primary-dark"
5151
hx-get="{{ links.next }}"
52-
hx-trigger="click, keyup[key=='ArrowUp'||key==' '] from:body">
52+
hx-trigger="click, keyup[key=='ArrowUp'||key=='ArrowRight'||key=='PageDown'||key==' '] from:body">
5353
<i class="fas fa-arrow-up"></i>
5454
</button>
5555
</div>

bullet/bullet_admin/templates/bullet_admin/venues/field__venue.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="flex gap-2 items-center">
2-
<span class="iconify shrink-0"
2+
<span class="iconify shrink-0 h-4 aspect-4/3"
33
data-icon="flag:{{ object.country.code|lower }}-4x3"></span>
44
<div>
55
<span class="font-bold">{{ object.shortcode }}</span>

bullet/competitions/templates/teams/list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h1 class="text-4xl md:text-6xl font-bold mt-8 md:mt-24 mb-4 md:mb-16">
2525
{% for c in countries %}
2626
<a href="?country={{ c }}"
2727
class="{% if c == country %} bg-primary text-white font-bold {% else %} bg-gray-100 {% endif %} whitespace-nowrap py-1 px-2 rounded flex gap-2 items-center flex-wrap">
28-
<span class="iconify shrink-0 shadow-lg"
28+
<span class="iconify shrink-0 shadow-lg h-4 aspect-4/3"
2929
data-icon="flag:{{ c|lower }}-4x3"></span>
3030
{% get_country c as country_data %}
3131
{{ country_data.name }}

bullet/gallery/templates/gallery/list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h1 class="text-4xl md:text-6xl font-bold mt-8 md:mt-24">{% translate "Albums" %
1515
{% for country in countries %}
1616
<div>
1717
<h2 class="flex items-center text-3xl font-bold mb-4">
18-
<span class="iconify h-5 mr-2"
18+
<span class="iconify h-5 aspect-4/3 mr-2"
1919
data-icon="flag:{{ country.grouper.code|lower }}-4x3"></span>
2020
{{ country.grouper.name }}
2121
</h2>

bullet/problems/templates/problems/results.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ <h2 class="text-2xl md:text-4xl mt-4 font-semibold">
3535
{% for c in countries %}
3636
<a href="{% if competition_number %}{% country_url "archive_results_category" category=category.identifier competition_number=competition_number country=c.code|lower %}{% else %}{% country_url "results_category" category=category.identifier country=c.code|lower %}{% endif %}{% query_transform %}"
3737
class="{% if c == country %} bg-primary text-white font-bold {% else %} bg-gray-100 {% endif %} whitespace-nowrap py-1 px-2 rounded flex gap-2 items-center flex-wrap">
38-
<iconify-icon icon="flag:{{ c.code|lower }}-4x3" width="none" class="h-4"></iconify-icon>
38+
<iconify-icon icon="flag:{{ c.code|lower }}-4x3" width="none" class="h-4 aspect-4/3"></iconify-icon>
3939
{{ c.name }}
4040
</a>
4141
{% endfor %}

bullet/users/templates/partials/team_name.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{% if team.school %}
33
<div class="flex items-center gap-2">
44
{% if flag %}
5-
<iconify-icon icon="flag:{{ team.school.country.code|lower }}-4x3" width="none" class="h-5"></iconify-icon>
5+
<iconify-icon icon="flag:{{ team.school.country.code|lower }}-4x3" width="none" class="h-5 aspect-4/3"></iconify-icon>
66
{% endif %}
77
<div>
88
<div class="font-medium leading-4">

bullet/web/static/js/live-results.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
}
1616

1717
document.getElementById("js-title-"+i).innerText = screens[i].title
18-
htmx.ajax("GET", screens[i].url, "#js-screen-"+i)
18+
try {
19+
htmx.ajax("GET", screens[i].url, "#js-screen-"+i)
20+
} catch (e) {
21+
console.log(`Unable to load screen #${i}: ${e}`)
22+
}
1923
}
2024

2125
setTimeout(scrollMore, 5000)
@@ -36,6 +40,11 @@
3640
const oldScroll = document.scrollingElement.scrollTop
3741

3842
const row = document.querySelector("#js-results-content tr")
43+
if (!row) {
44+
console.error("No results are loaded, trying to reload results in 1s")
45+
setTimeout(nextScreen, 1000)
46+
return;
47+
}
3948
const offset = Math.max(Math.round(row.clientHeight / 40), 1)
4049
const divided = row.clientHeight / offset
4150
document.scrollingElement.scrollTop += offset

tailwind.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ module.exports = {
88
],
99
theme: {
1010
extend: {
11+
aspectRatio: {
12+
'4/3': '4 / 3',
13+
},
1114
colors: {
1215
primary: "var(--primary)",
1316
"primary-light": "var(--primary-light)",

0 commit comments

Comments
 (0)