Skip to content

Commit f37cae7

Browse files
committed
qml: format BlockClock progress percentage according to the design file
1 parent e8fa39a commit f37cae7

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/qml/components/BlockClock.qml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Item {
9393
name: "IBD"; when: !synced && !paused && connected
9494
PropertyChanges {
9595
target: root
96-
header: Math.round(nodeModel.verificationProgress * 100) + "%"
96+
header: formatProgressPercentage(nodeModel.verificationProgress * 100)
9797
subText: formatRemainingSyncTime(nodeModel.remainingSyncTime)
9898
}
9999
},
@@ -144,6 +144,18 @@ Item {
144144
}
145145
]
146146

147+
function formatProgressPercentage(progress) {
148+
if (progress >= 1) {
149+
return Math.round(progress) + "%"
150+
} else if (progress >= 0.1) {
151+
return progress.toFixed(1) + "%"
152+
} else if (progress >= 0.01) {
153+
return progress.toFixed(2) + "%"
154+
} else {
155+
return "0%"
156+
}
157+
}
158+
147159
function formatRemainingSyncTime(milliseconds) {
148160
var minutes = Math.floor(milliseconds / 60000);
149161
var seconds = Math.floor((milliseconds % 60000) / 1000);

0 commit comments

Comments
 (0)