Updated truncate long name to use default Elide property. Fixes #1830

This commit is contained in:
ace-smart 2021-02-15 20:25:07 +04:00 committed by Iuri Matias
parent 29c555bd2d
commit 0f1b46097e
3 changed files with 11 additions and 16 deletions

View File

@ -86,9 +86,11 @@ PopupMenu {
StyledText {
id: username
text: Utils.truncateName(Utils.removeStatusEns(userName))
text: Utils.removeStatusEns(userName)
elide: Text.ElideRight
maximumLineCount: 3
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
wrapMode: Text.Wrap
anchors.top: profileImage.bottom
anchors.topMargin: 4
anchors.left: parent.left

View File

@ -65,22 +65,23 @@ ModalPopup {
source: identicon
}
StyledTextEdit {
StyledText {
id: profileName
text: Utils.truncateName(Utils.removeStatusEns(userName))
text: Utils.removeStatusEns(userName)
elide: Text.ElideRight
anchors.top: parent.top
anchors.topMargin: Style.current.padding
anchors.left: profilePic.right
anchors.leftMargin: Style.current.halfPadding
anchors.right: qrCodeButton.left
anchors.rightMargin: Style.current.padding
font.bold: true
font.pixelSize: 17
readOnly: true
wrapMode: Text.WordWrap
}
StyledText {
text: isEnsVerified ? Utils.truncateName(alias) : fromAuthor
elide: !isEnsVerified ? Text.ElideMiddle : Text.ElideNone
text: isEnsVerified ? alias : fromAuthor
elide: !isEnsVerified ? Text.ElideMiddle : Text.ElideRight
anchors.left: profilePic.right
anchors.leftMargin: Style.current.smallPadding
anchors.bottom: parent.bottom

View File

@ -74,14 +74,6 @@ QtObject {
return userName.endsWith(".stateofus.eth") ? userName.substr(0, userName.length - 14) : userName
}
function truncateName(name, num = 32) {
if (name.length <= num) {
return name;
}
return name.slice(0, num) + "...";
}
function isValidAddress(inputValue) {
return inputValue !== "0x" && /^0x[a-fA-F0-9]{40}$/.test(inputValue)
}