Skip to content

Commit

Permalink
broadcast group selector render on demand
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Mar 15, 2024
1 parent 7808e07 commit a0b9577
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
20 changes: 11 additions & 9 deletions ui/analyse/css/study/relay/_tour.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,25 @@
&__mselect {
flex: auto;
@include fluid-size('font-size', 12px, 20px);
.mselect__list a {
gap: 1em;
}
}
&__round-select {
.fullscreen-mask {
display: block;
}
.mselect__list {
display: table;
left: unset;
right: 0;
overflow: hidden;
transform: unset;
> * {
opacity: unset;
}
a {
gap: 1em;
}
}
}
&__round-select {
.mselect__list {
display: table;
left: unset;
right: 0;
overflow: hidden;
tr {
display: table-row;
&.current-round {
Expand Down
1 change: 1 addition & 0 deletions ui/analyse/src/study/relay/relayCtrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default class RelayCtrl {
cooldown = false;
tourShow: Toggle;
roundSelectShow = toggle(false);
groupSelectShow = toggle(false);
tab: Prop<RelayTab>;
teams?: RelayTeams;
leaderboard?: RelayLeaderboard;
Expand Down
29 changes: 16 additions & 13 deletions ui/analyse/src/study/relay/relayTourView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,26 @@ const overview = (relay: RelayCtrl, ctrl: AnalyseCtrl) => [

const groupSelect = (relay: RelayCtrl, group: RelayGroup) =>
h('div.mselect.relay-tour__header__mselect.relay-tour__group-select', [
h('input#mselect-relay-group.mselect__toggle.fullscreen-toggle', { attrs: { type: 'checkbox' } }),
h(
'label.mselect__label',
{ attrs: { for: 'mselect-relay-group' } },
{ hook: bind('click', relay.groupSelectShow.toggle, relay.redraw) },
group.tours.find(t => t.id == relay.data.tour.id)?.name || relay.data.tour.name,
),
h('label.fullscreen-mask', { attrs: { for: 'mselect-relay-group' } }),
h(
'nav.mselect__list',
group.tours.map(tour =>
h(
`a${tour.id == relay.data.tour.id ? '.current' : ''}`,
{ attrs: { href: `/broadcast/-/${tour.id}` } },
tour.name,
),
),
),
...(relay.groupSelectShow()
? [
h('label.fullscreen-mask', { hook: bind('click', relay.groupSelectShow.toggle, relay.redraw) }),
h(
'nav.mselect__list',
group.tours.map(tour =>
h(
`a${tour.id == relay.data.tour.id ? '.current' : ''}`,
{ attrs: { href: `/broadcast/-/${tour.id}` } },
tour.name,
),
),
),
]
: []),
]);

const roundSelect = (relay: RelayCtrl, study: StudyCtrl) =>
Expand Down

0 comments on commit a0b9577

Please sign in to comment.