Add lag icons to challenge view

Hover tip not implemented.
challangeViewLag
Isaac Levy 2017-07-05 22:16:36 -04:00
parent 272361de34
commit d0ad489f16
3 changed files with 6 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package lila.challenge
import play.api.libs.json._
import lila.common.PimpedJson._
import lila.socket.UserLagCache
final class JsonView(
getLightUser: lila.common.LightUser.GetterSync,
@ -67,7 +68,8 @@ final class JsonView(
"rating" -> r.rating.int,
"provisional" -> r.rating.provisional,
"patron" -> light.??(_.isPatron).option(true),
"online" -> isOnline(r.id).option(true)
"online" -> isOnline(r.id).option(true),
"lag" -> UserLagCache.getLagRating(r.id)
).noNull
}
}

View File

@ -25,6 +25,7 @@ export interface ChallengeUser {
title?: string
online?: boolean
patron?: boolean
lag?: number
}
export interface TimeControl {

View File

@ -136,7 +136,8 @@ function renderUser(u?: ChallengeUser): VNode {
class: { online: !!u.online }
}, [
h('i.line' + (u.patron ? '.patron' : '')),
h('name', (u.title ? u.title + ' ' : '') + u.name + ' (' + rating + ')')
h('name', (u.title ? u.title + ' ' : '') + u.name + ' (' + rating + ') '),
h('signal', Array.apply(null, {length: u.lag || 0}).map(() => h('i')))
]);
}