Skip to content

Commit 1da1ff5

Browse files
committed
Make the summary footer sticky on desktop
This bundles some of the inlince CSS and adds a z-index per sortorder to make the sliding natural. In case of the same z-index the order of creation in the DOM is picked as how to stack. Given that creating the DOM from bottom to top is unmaintable the less worse option is introducing a lot of z-indexes. Perfect solution would be to put this in a class to remove the inline styles but that is left for another time. Unrelated to this PR, it seems in chromium based browser the border/shadow of the sticky elements gets lost. The misalignment of the `tbody` is because we check for the sortorder, when there are multiple we close and open a new one which looks misaligned due to the twig `if` condition.
1 parent 7e1430f commit 1da1ff5

File tree

3 files changed

+41
-7
lines changed

3 files changed

+41
-7
lines changed

webapp/public/style_domjudge.css

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,18 @@ tr.ignore td, td.ignore, span.ignore {
612612
background-color: #05264c;
613613
}
614614

615+
.scoreboard .problem-summary {
616+
text-align: left;
617+
}
618+
619+
.scoreboard .summaryline {
620+
border-top: 2px solid black;
621+
}
622+
623+
.summaryline .problem-summary-title {
624+
font-size:90%;
625+
}
626+
615627
.select_readonly {
616628
background-color: #e9ecef !important;
617629
opacity: 1;
@@ -649,4 +661,23 @@ blockquote {
649661

650662
.right {
651663
text-align: right;
664+
665+
/* Disable the sticky footer on mobile */
666+
@media only screen and (min-width: 600px) {
667+
.scoreheader th {
668+
z-index: 100;
669+
}
670+
671+
.summaryline td {
672+
position: sticky;
673+
bottom: 0;
674+
box-shadow: 0 -1px 0 0 black,
675+
0 1px 0 0 black;
676+
background: var(--background-color);
677+
}
678+
679+
tbody.scoreboard-sortorder-body {
680+
position: relative;
681+
z-index: 50;
682+
}
652683
}

webapp/templates/partials/scoreboard_summary.html.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% if limitToTeamIds is null %}
22
{% if showTeamSubmissions or jury %}
3-
<tr style="border-top: 2px solid black;">
3+
<tr class="summaryline">
44
{% set summaryColspan = 3 %}
55
{% if showAffiliationLogos %}
66
{% set summaryColspan = summaryColspan + 1 %}
@@ -16,32 +16,32 @@
1616
<td></td>
1717
{% for problem in scoreboard.problems %}
1818
{% set summary = scoreboard.summary.problem(problem.probid) %}
19-
<td style="text-align: left;">
19+
<td class="problem-summary">
2020
{% set link = null %}
2121
{% if jury %}
2222
{% set link = path('jury_problem', {'probId': problem.probid}) %}
2323
{% endif %}
2424
<a {% if link %}href="{{ link }}"{% endif %}>
2525
<i class="fas fa-thumbs-up fa-fw"></i>
26-
<span class="submcorrect" style="font-size:90%;" title="number of accepted submissions">
26+
<span class="submcorrect problem-summary-title" title="number of accepted submissions">
2727
{{ summary.numSubmissionsCorrect[sortOrder] ?? 0 }}
2828
</span>
2929
<br/>
3030

3131
<i class="fas fa-thumbs-down fa-fw"></i>
32-
<span class="submreject" style="font-size:90%;" title="number of rejected submissions">
32+
<span class="submreject problem-summary-title" title="number of rejected submissions">
3333
{{ summary.numSubmissions[sortOrder] ?? 0 - summary.numSubmissionsCorrect[sortOrder] ?? 0 }}
3434
</span>
3535
<br/>
3636

3737
<i class="fas fa-question-circle fa-fw"></i>
38-
<span class="submpend" style="font-size:90%;" title="number of pending submissions">
38+
<span class="submpend problem-summary-title" title="number of pending submissions">
3939
{{ summary.numSubmissionsPending[sortOrder] ?? 0 }}
4040
</span>
4141
<br/>
4242

4343
<i class="fas fa-clock fa-fw"></i>
44-
<span style="font-size:90%;" title="first solved">
44+
<span class="problem-summary-title" title="first solved">
4545
{% if summary.bestTimeInMinutes(sortOrder) is not null %}
4646
{{ summary.bestTimeInMinutes(sortOrder) }}min
4747
{% else %}

webapp/templates/partials/scoreboard_table.html.twig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
{% endif %}
9797
</tr>
9898
</thead>
99-
<tbody>
99+
<tbody class="scoreboard-sortorder-body">
100100
{% set previousSortOrder = -1 %}
101101
{% set previousTeam = null %}
102102
{% set backgroundColors = {"#FFFFFF": 1} %}
@@ -107,6 +107,8 @@
107107
{% if previousSortOrder != -1 %}
108108
{# Output summary of previous sort order #}
109109
{% include 'partials/scoreboard_summary.html.twig' with {sortOrder: previousSortOrder} %}
110+
</tbody>
111+
<tbody class="scoreboard-sortorder-body" style="z-index: {{ 100-score.team.category.sortorder }};">
110112
{% endif %}
111113
{% set classes = classes | merge(['sortorderswitch']) %}
112114
{% set previousSortOrder = score.team.category.sortorder %}
@@ -392,6 +394,7 @@
392394
393395
.cl{{ colorClass }} {
394396
background-color: {{ color }};
397+
background-clip: content-box;
395398
}
396399
397400
{% set cMin = color|hexColorToRGBA(0) %}

0 commit comments

Comments
 (0)