chore: extract Utils.elideText()
This commit is contained in:
parent
ff747c2a5f
commit
51aa4a6d86
|
@ -30,7 +30,7 @@ StatusModal {
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
readonly property string elidedPkey: root.privateKey.substring(0, 15) + "..." + root.privateKey.substring(root.privateKey.length - 16)
|
readonly property string elidedPkey: Utils.elideText(root.privateKey, 16)
|
||||||
|
|
||||||
leftPadding: 0
|
leftPadding: 0
|
||||||
rightPadding: 0
|
rightPadding: 0
|
||||||
|
|
|
@ -684,7 +684,11 @@ QtObject {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
let compressedPk = getCompressedPk(publicKey)
|
let compressedPk = getCompressedPk(publicKey)
|
||||||
return compressedPk.substr(0, 6) + "..." + compressedPk.substr(compressedPk.length - 3)
|
return elideText(compressedPk, 6, 3)
|
||||||
|
}
|
||||||
|
|
||||||
|
function elideText(text, leftCharsCount, rightCharsCount = leftCharsCount) {
|
||||||
|
return text.substr(0, leftCharsCount) + "..." + text.substr(text.length - rightCharsCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTimeDifference(d1, d2) {
|
function getTimeDifference(d1, d2) {
|
||||||
|
|
Loading…
Reference in New Issue