Skip to content

Commit 3094e36

Browse files
committed
qml: format BlockClock progress percentage according to the design file
1 parent 0fc3fdc commit 3094e36

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/qml/components/BlockClock.qml

+13-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Item {
8888
name: "IBD"; when: !synced && !paused && connected
8989
PropertyChanges {
9090
target: root
91-
header: Math.round(nodeModel.verificationProgress * 100) + "%"
91+
header: formatProgressPercentage(nodeModel.verificationProgress * 100)
9292
subText: formatRemainingSyncTime(nodeModel.remainingSyncTime)
9393
}
9494
},
@@ -139,6 +139,18 @@ Item {
139139
}
140140
]
141141

142+
function formatProgressPercentage(progress) {
143+
if (progress >= 1) {
144+
return Math.round(progress) + "%"
145+
} else if (progress >= 0.1) {
146+
return progress.toFixed(1) + "%"
147+
} else if (progress >= 0.01) {
148+
return progress.toFixed(2) + "%"
149+
} else {
150+
return "0%"
151+
}
152+
}
153+
142154
function formatRemainingSyncTime(milliseconds) {
143155
var minutes = Math.floor(milliseconds / 60000);
144156
var seconds = Math.floor((milliseconds % 60000) / 1000);

0 commit comments

Comments
 (0)