hardcode perf icons on the client side - the app should do the same

for veloce/lichobile#1724
This commit is contained in:
Thibault Duplessis 2021-06-15 14:23:26 +02:00
parent 2e287b1e5e
commit d933ca8ae3
2 changed files with 22 additions and 4 deletions

View file

@ -0,0 +1,18 @@
const perfIcons = {
ultraBullet: '',
bullet: '',
blitz: '',
rapid: '',
classical: '',
correspondence: '',
chess960: '',
kingOfTheHill: '',
antichess: '',
atomic: '',
threeCheck: '',
horde: '',
racingKings: '',
crazyhouse: '',
};
export default perfIcons;

View file

@ -1,5 +1,7 @@
import { h, VNode } from 'snabbdom';
import perfIcons from 'common/perfIcons';
const scale = 8;
let now: number, startTime: number, stopTime: number;
@ -113,9 +115,7 @@ function tournamentClass(tour) {
return classes;
}
function iconOf(tour, perfIcon) {
return tour.schedule && tour.schedule.freq === 'shield' ? '' : perfIcon;
}
const iconOf = tour => (tour.schedule?.freq === 'shield' ? '' : perfIcons[tour.perf.key]);
let mousedownAt: number[] | undefined;
@ -151,7 +151,7 @@ function renderTournament(ctrl, tour) {
tour.perf
? {
attrs: {
'data-icon': iconOf(tour, tour.perf.icon),
'data-icon': iconOf(tour),
title: tour.perf.name,
},
}