Skip to content

Commit

Permalink
Merge #276: Format BlockClock progress percentage according to the de…
Browse files Browse the repository at this point in the history
…sign 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
  • Loading branch information
hebasto committed Mar 2, 2023
2 parents 8c672b8 + 603d8b8 commit cdf44f9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/qml/components/BlockClock.qml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Item {
name: "IBD"; when: !synced && !paused && connected
PropertyChanges {
target: root
header: Math.round(nodeModel.verificationProgress * 100) + "%"
header: formatProgressPercentage(nodeModel.verificationProgress * 100)
subText: formatRemainingSyncTime(nodeModel.remainingSyncTime)
}
},
Expand Down Expand Up @@ -144,6 +144,18 @@ Item {
}
]

function formatProgressPercentage(progress) {
if (progress >= 1) {
return Math.round(progress) + "%"
} else if (progress >= 0.1) {
return progress.toFixed(1) + "%"
} else if (progress >= 0.01) {
return progress.toFixed(2) + "%"
} else {
return "0%"
}
}

function formatRemainingSyncTime(milliseconds) {
var minutes = Math.floor(milliseconds / 60000);
var seconds = Math.floor((milliseconds % 60000) / 1000);
Expand Down

0 comments on commit cdf44f9

Please sign in to comment.