This commit is contained in:
Tim
2024-04-17 00:40:37 -04:00
parent 1a752d3080
commit a0d1772254
5 changed files with 139 additions and 70 deletions

View File

@@ -267,10 +267,19 @@ export function weightColors(weights, color) {
return adj.map((a) => a.string())
}
export function allocationText(amount, weight, symbol) {
// console.log('weight', weight, alloc, props.amount)
const a = amount * weight
return `${(weight * 100).toFixed(1)}% = ${a.toLocaleString('fullwide')} ${symbol}`
export function allocationText(weight, amount, symbol) {
let text = ''
const hasWeight = weight!==null && weight!==undefined
if (hasWeight)
text += `${(weight * 100).toFixed(1)}%`
const hasAmount = amount!==null && amount!==undefined
const hasSymbol = symbol!==null && symbol!==undefined
if (hasAmount && hasSymbol) {
if (hasWeight)
text += ' = '
text += `${amount.toLocaleString('fullwide')} ${symbol}`
}
return text
}
export function deleteBuilder(order, builder) {