more types for ui/lobby
This commit is contained in:
parent
bf4615d6e6
commit
4de8f6d910
|
@ -34,6 +34,31 @@ export interface LobbyOpts extends Untyped {
|
|||
export interface LobbyData extends Untyped {
|
||||
hooks: Hook[];
|
||||
seeks: Seek[];
|
||||
nowPlaying: NowPlaying[];
|
||||
}
|
||||
|
||||
export interface NowPlaying {
|
||||
fullId: string;
|
||||
gameId: string;
|
||||
fen: Fen;
|
||||
color: Color;
|
||||
lastMove: String;
|
||||
variant: {
|
||||
key: string;
|
||||
name: string;
|
||||
};
|
||||
speed: string;
|
||||
perf: string;
|
||||
rated: boolean;
|
||||
hasMoved: boolean;
|
||||
opponent: {
|
||||
id: string;
|
||||
username: string;
|
||||
rating?: number;
|
||||
ai?: number;
|
||||
};
|
||||
isMyTurn: boolean;
|
||||
secondsLeft?: number;
|
||||
}
|
||||
|
||||
export interface PoolMember {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { h } from 'snabbdom';
|
||||
import LobbyController from '../ctrl';
|
||||
import { NowPlaying } from '../interfaces';
|
||||
|
||||
function timer(pov) {
|
||||
const date = Date.now() + pov.secondsLeft * 1000;
|
||||
function timer(pov: NowPlaying) {
|
||||
const date = Date.now() + pov.secondsLeft! * 1000;
|
||||
return h('time.timeago', {
|
||||
hook: {
|
||||
insert(vnode) {
|
||||
|
@ -13,6 +14,7 @@ function timer(pov) {
|
|||
}
|
||||
|
||||
export default function(ctrl: LobbyController) {
|
||||
|
||||
return h('div.now-playing',
|
||||
ctrl.data.nowPlaying.map(pov =>
|
||||
h('a.' + pov.variant.key, {
|
||||
|
|
Loading…
Reference in a new issue