swiss/tour UI tweaks

pull/6572/head
Thibault Duplessis 2020-05-07 12:06:32 -06:00
parent 2709217eb0
commit 22ce418a6e
2 changed files with 3 additions and 9 deletions

View File

@ -51,16 +51,13 @@ export const ratio2percent = (r: number) => Math.round(100 * r) + '%';
export const userName = (u: LightUser) => u.title ? [h('span.title', u.title), ' ' + u.name] : [u.name];
export function player(p: Player, asLink: boolean, withRating: boolean) {
const fullName = userName(p.user);
return h('a.ulpt.user-link' + (((p.user.title || '') + p.user.name).length > 15 ? '.long' : ''), {
attrs: asLink ? { href: '/@/' + p.user.name } : { 'data-href': '/@/' + p.user.name },
hook: {
destroy: vnode => $.powerTip.destroy(vnode.elm as HTMLElement)
}
}, [
h('span.name', fullName),
h('span.name', userName(p.user)),
withRating ? h('span.rating', ' ' + p.rating + (p.provisional ? '?' : '')) : null
]);
}

View File

@ -55,10 +55,7 @@ export function playerName(p) {
}
export function player(p, asLink: boolean, withRating: boolean, defender: boolean = false, leader: boolean = false) {
const fullName = playerName(p);
return h('a.ulpt.user-link' + (fullName.length > 15 ? '.long' : ''), {
return h('a.ulpt.user-link' + (((p.user.title || '') + p.user.name).length > 15 ? '.long' : ''), {
attrs: asLink ? { href: '/@/' + p.name } : { 'data-href': '/@/' + p.name },
hook: {
destroy: vnode => $.powerTip.destroy(vnode.elm as HTMLElement)
@ -68,7 +65,7 @@ export function player(p, asLink: boolean, withRating: boolean, defender: boolea
'span.name' + (defender ? '.defender' : (leader ? '.leader' : '')),
defender ? { attrs: dataIcon('5') } : (
leader ? { attrs: dataIcon('8') } : {}
), fullName),
), playerName(p)),
withRating ? h('span.rating', ' ' + p.rating + (p.provisional ? '?' : '')) : null
]);
}