2
0
mirror of https://github.com/status-im/status-desktop.git synced 2025-01-11 14:54:48 +00:00

chore: extract Utils.elideText()

This commit is contained in:
Patryk Osmaczko 2022-07-04 10:58:51 +02:00 committed by osmaczko
parent ff747c2a5f
commit 51aa4a6d86
2 changed files with 6 additions and 2 deletions
ui
app/AppLayouts/Chat/popups/community
imports/utils

@ -30,7 +30,7 @@ StatusModal {
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
rightPadding: 0

@ -684,7 +684,11 @@ QtObject {
return ""
}
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) {