Skip to content

Commit

Permalink
hide empty round info
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Jun 29, 2024
1 parent b903f31 commit 83e61b9
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions ui/analyse/src/study/relay/relayTourView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,22 @@ const leaderboard = (ctx: RelayViewContext) => [
ctx.relay.leaderboard && leaderboardView(ctx.relay.leaderboard),
];

const showInfo = (i: RelayTourInfo, dates?: RelayTourDates) =>
h(
'div.relay-tour__info',
[
['dates', dates && showDates(dates), 'objects.calendar'],
['format', i.format, 'objects.crown'],
['tc', i.tc, 'objects.mantelpiece-clock'],
['players', i.players, 'activity.sparkles'],
].map(
const showInfo = (i: RelayTourInfo, dates?: RelayTourDates) => {
const contents = [
['dates', dates && showDates(dates), 'objects.calendar'],
['format', i.format, 'objects.crown'],
['tc', i.tc, 'objects.mantelpiece-clock'],
['players', i.players, 'activity.sparkles'],
]
.map(
([key, value, icon]) =>
value &&
icon &&
h('div.relay-tour__info__' + key, [h('img', { attrs: { src: site.asset.flairSrc(icon) } }), value]),
),
);
)
.filter(defined);
return contents.length ? h('div.relay-tour__info', contents) : undefined;
};

const dateFormat = memoize(() =>
window.Intl && Intl.DateTimeFormat
Expand Down

0 comments on commit 83e61b9

Please sign in to comment.