21 lines
558 B
JavaScript
21 lines
558 B
JavaScript
export function sizeShort(size) {
|
|
return size.replace(/\s*models?$/, '')
|
|
}
|
|
|
|
export function pctLabel(pct) {
|
|
if (pct === null || pct === undefined) return '—'
|
|
const sign = pct > 0 ? '+' : ''
|
|
return `${sign}${pct.toFixed(1)}%`
|
|
}
|
|
|
|
export function ptsLabel(pts) {
|
|
if (pts === null || pts === undefined) return '—'
|
|
return pts > 0 ? `+${pts}` : `${pts}`
|
|
}
|
|
|
|
export function changeColor(val) {
|
|
if (val === null || val === undefined) return 'text.secondary'
|
|
if (val > 0) return '#f85149'
|
|
if (val < 0) return '#3fb950'
|
|
return 'text.secondary'
|
|
} |