Skip to content

Commit cdf44f9

Browse files
committed
Merge #276: Format BlockClock progress percentage according to the design file
603d8b8 qml: format BlockClock progress percentage according to the design file (jarolrod) Pull request description: This formats the BlockClock's progress percentage to fit with the [design file](https://www.figma.com/file/ek8w3n3upbluw5UL2lGhRx/Bitcoin-Core-App-Design?node-id=5986%3A17926&t=jywAOeHntrNKOEcG-4) The design file shows: ![Block clock-3](https://user-images.githubusercontent.com/23396902/221780498-aa576c90-f2b3-4a20-b88a-f03ef3c59654.png) This PR implements | 0 | 0.01 | 0.1 | 1 | | - | ---- | --- | - | | <img width="752" alt="zero" src="https://user-images.githubusercontent.com/23396902/221780711-c8c31b20-cd5d-412b-af87-0060fb56eeec.png"> | <img width="752" alt="zero-dot-one" src="https://user-images.githubusercontent.com/23396902/221780804-ef35fa20-dd10-44ca-a22c-020404fdd775.png"> | <img width="752" alt="dot-one" src="https://user-images.githubusercontent.com/23396902/221780883-a20f865a-f22c-4a2c-a394-46537627dab9.png"> | <img width="752" alt="one" src="https://user-images.githubusercontent.com/23396902/221780949-57bb164d-dcb8-4e1c-a7b2-205b80073ddf.png"> | [![Windows](https://img.shields.io/badge/OS-Windows-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/276) [![Intel macOS](https://img.shields.io/badge/OS-Intel%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/276) [![Apple Silicon macOS](https://img.shields.io/badge/OS-Apple%20Silicon%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/276) [![ARM64 Android](https://img.shields.io/badge/OS-Android-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/276) ACKs for top commit: johnny9: ACK 603d8b8 Tree-SHA512: d2b54d52ebcccd8c440c204ada4f2bfd0447bcdab0de7ac7e82be13705c19416349d470133f0c6071b9871b59631b630017459ab0af1ece700c2379da5e1647b
2 parents 8c672b8 + 603d8b8 commit cdf44f9

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
@@ -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)