Fix tournament scores types
This commit is contained in:
parent
bb00361f7b
commit
3116f0ed8e
|
@ -3,6 +3,8 @@ import { VNode } from 'snabbdom';
|
|||
export type MaybeVNode = VNode | string | null | undefined;
|
||||
export type MaybeVNodes = MaybeVNode[];
|
||||
|
||||
export type Score = number | [number] | [number, number];
|
||||
|
||||
export interface StandingPlayer extends SimplePlayer {
|
||||
id: string;
|
||||
withdraw: boolean;
|
||||
|
@ -12,7 +14,7 @@ export interface StandingPlayer extends SimplePlayer {
|
|||
sheet: {
|
||||
fire: boolean;
|
||||
total: number;
|
||||
scores: unknown[];
|
||||
scores: Score[];
|
||||
};
|
||||
nb: Nb;
|
||||
team?: string;
|
||||
|
|
|
@ -2,14 +2,14 @@ import { h, VNode } from 'snabbdom';
|
|||
import TournamentController from '../ctrl';
|
||||
import { player as renderPlayer, ratio2percent, bind, dataIcon, playerName } from './util';
|
||||
import { teamName } from './battle';
|
||||
import { MaybeVNodes, Pagination, PodiumPlayer, StandingPlayer } from '../interfaces';
|
||||
import { MaybeVNodes, Pagination, PodiumPlayer, Score, StandingPlayer } from '../interfaces';
|
||||
import * as button from './button';
|
||||
import * as pagination from '../pagination';
|
||||
|
||||
const scoreTagNames = ['score', 'streak', 'double'];
|
||||
|
||||
function scoreTag(s: [number, number] | number) {
|
||||
const [score, tag] = Array.isArray(s) ? s : [s, 1];
|
||||
function scoreTag(s: Score) {
|
||||
const [score, tag] = Array.isArray(s) ? s : [s];
|
||||
return h(scoreTagNames[(tag || 1) - 1], [score]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue