mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-25 04:55:59 +00:00
Truncate long 3 words name. Fixes #1830
This commit is contained in:
parent
3420593774
commit
6494d45b44
@ -86,7 +86,7 @@ PopupMenu {
|
||||
|
||||
StyledText {
|
||||
id: username
|
||||
text: Utils.removeStatusEns(userName)
|
||||
text: Utils.truncateName(Utils.removeStatusEns(userName))
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.top: profileImage.bottom
|
||||
|
@ -67,7 +67,7 @@ ModalPopup {
|
||||
|
||||
StyledTextEdit {
|
||||
id: profileName
|
||||
text: Utils.removeStatusEns(userName)
|
||||
text: Utils.truncateName(Utils.removeStatusEns(userName))
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Style.current.padding
|
||||
anchors.left: profilePic.right
|
||||
|
@ -74,6 +74,14 @@ 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