user Delegates showing up

This commit is contained in:
Luis Fernando Molina committed 2021-06-24 16:21:06 +02:00
1 parent 0de05a8532
commit 80184b6d2e
4 files changed
+184 -32

No files matched your search

@@ -288,6 +288,10 @@ function newGovernanceFunctionLibraryVotingProgram() {
}
return
}
if (node.type === 'User Profile Vote') {
drawUserNode(node, votes, percentage)
return
}
if (
node.type === 'Position' ||
node.type === 'Position Class' ||
@@ -334,6 +338,30 @@ function newGovernanceFunctionLibraryVotingProgram() {
}
}
function drawUserNode(node, votes, percentage) {
if (node.payload !== undefined) {
const outgoingPowerText = parseFloat(votes.toFixed(2)).toLocaleString('en')
node.payload.uiObject.valueAngleOffset = 180
node.payload.uiObject.valueAtAngle = true
node.payload.uiObject.setValue(outgoingPowerText + ' Voting Power')
node.payload.uiObject.percentageAngleOffset = 180
node.payload.uiObject.percentageAtAngle = true
node.payload.uiObject.setPercentage(percentage)
if (node.payload.referenceParent !== undefined) {
node.payload.uiObject.statusAngleOffset = 0
node.payload.uiObject.statusAtAngle = true
node.payload.uiObject.setStatus(outgoingPowerText + ' ' + ' Outgoing Power')
}
}
}
function drawProgram(node) {
if (node.payload !== undefined) {