mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-04 10:44:23 +00:00
Updated truncate long name to use default Elide property. Fixes #1830
This commit is contained in:
parent
29c555bd2d
commit
0f1b46097e
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user