Skip to content

Commit fccd9b5

Browse files
committed
only show inputs of analysable games
closes lichess-org/tavern#40
1 parent 2323167 commit fccd9b5

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

app/views/mod/games.scala

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,13 @@ object games {
7070
table(cls := "mod-games game-list slist")(
7171
thead(
7272
tr(
73-
sortNoneTh(input(tpe := "checkbox", name := s"game[]", st.value := "all")),
73+
sortNoneTh(
74+
input(
75+
tpe := "checkbox",
76+
name := s"game[]",
77+
st.value := "all"
78+
)
79+
),
7480
sortNumberTh("Opponent"),
7581
sortNumberTh("Speed"),
7682
th(iconTag('g')),
@@ -85,8 +91,8 @@ object games {
8591
tbody(
8692
games.map { case (pov, assessment) =>
8793
tr(
88-
td(
89-
input(
94+
td(cls := pov.game.analysable.option("input"))(
95+
pov.game.analysable option input(
9096
tpe := "checkbox",
9197
name := s"game[]",
9298
st.value := pov.gameId

ui/site/css/mod/_games.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
background: mix($c-bad, $c-bg-box, 50%);
1515
}
1616

17-
td:first-child {
17+
td.input {
1818
cursor: pointer;
1919
&:hover {
2020
background: $c-bg-zebra2;

ui/site/src/modGames.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ const expandCheckboxZone = (table: HTMLTableElement, onSelect: OnSelect) =>
7272
$(table).on('click', 'td:first-child', (e: MouseEvent) => {
7373
if ((e.target as HTMLElement).tagName == 'INPUT') onSelect(e.target as HTMLInputElement, e.shiftKey);
7474
else {
75-
const input = (e.target as HTMLTableDataCellElement).querySelector('input') as HTMLInputElement;
76-
input.checked = !input.checked;
77-
onSelect(input, e.shiftKey);
75+
const input = (e.target as HTMLTableDataCellElement).querySelector('input') as HTMLInputElement | undefined;
76+
if (input) {
77+
input.checked = !input.checked;
78+
onSelect(input, e.shiftKey);
79+
}
7880
}
7981
});
8082

0 commit comments

Comments
 (0)