From 3e33db039fa93245de8e4228bf0cd1adf760c593 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Mon, 12 Jul 2021 14:36:03 -0400 Subject: [PATCH] fix(search): fix 1-1 name, pic, icon and symbol --- src/app/chat/views/chat_item.nim | 14 ++++++-------- ui/app/AppLayouts/Chat/ChatColumn.qml | 7 +------ ui/app/AppLayouts/Chat/components/BadgeContent.qml | 4 +++- ui/app/AppLayouts/Chat/components/SearchPopup.qml | 9 +++++---- ui/app/img/search.svg | 4 ++-- ui/shared/SearchBox.qml | 4 ++-- 6 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/app/chat/views/chat_item.nim b/src/app/chat/views/chat_item.nim index edff34d2e2..86622af19e 100644 --- a/src/app/chat/views/chat_item.nim +++ b/src/app/chat/views/chat_item.nim @@ -65,15 +65,13 @@ QtObject: proc name*(self: ChatItemView): string {.slot.} = if self.chatItem != nil and self.chatItem.chatType.isOneToOne: - if self.chatItem.name == self.chatItem.id: - result = self.userNameOrAlias(self.chatItem.id) + if self.status.chat.contacts.hasKey(self.chatItem.id) and self.status.chat.contacts[self.chatItem.id].hasNickname(): + return self.status.chat.contacts[self.chatItem.id].localNickname + let username = self.userNameOrAlias(self.chatItem.id) + if username != "": + result = username.userName(true) else: - if self.status.chat.contacts.hasKey(self.chatItem.id) and self.status.chat.contacts[self.chatItem.id].hasNickname(): - return self.status.chat.contacts[self.chatItem.id].localNickname - if self.chatItem.ensName != "": - result = "@" & userName(self.chatItem.ensName).userName(true) - else: - result = self.chatItem.name + result = self.chatItem.name else: result = ?.self.chatItem.name diff --git a/ui/app/AppLayouts/Chat/ChatColumn.qml b/ui/app/AppLayouts/Chat/ChatColumn.qml index 1bf203e1ce..3fc0d0bec9 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn.qml @@ -234,12 +234,7 @@ StackLayout { property string chatId: chatsModel.channelView.activeChannel.id property string profileImage: appMain.getProfileImage(chatId) || "" - chatInfoButton.title: { - if (chatsModel.channelView.activeChannel.chatType === Constants.chatTypeOneToOne) { - return Utils.removeStatusEns(chatsModel.userNameOrAlias(chatsModel.channelView.activeChannel.id)) - } - return chatsModel.channelView.activeChannel.name - } + chatInfoButton.title: Utils.removeStatusEns(chatsModel.channelView.activeChannel.name) chatInfoButton.subTitle: { switch (chatsModel.channelView.activeChannel.chatType) { case Constants.chatTypeOneToOne: diff --git a/ui/app/AppLayouts/Chat/components/BadgeContent.qml b/ui/app/AppLayouts/Chat/components/BadgeContent.qml index cfd96fe991..50178961c5 100644 --- a/ui/app/AppLayouts/Chat/components/BadgeContent.qml +++ b/ui/app/AppLayouts/Chat/components/BadgeContent.qml @@ -12,6 +12,7 @@ Item { property string name: "channelName" property string identicon property string communityId + property bool hideSecondIcon: false property int chatType: chatsModel.channelView.chats.getChannelType(chatId) property int realChatType: { if (chatType === Constants.chatTypeCommunity) { @@ -49,6 +50,7 @@ Item { height: parent.height SVGImage { id: communityIcon + visible: !hideSecondIcon width: 16 height: 16 source: "../../../img/communities.svg" @@ -65,7 +67,7 @@ Item { Loader { id: communityImageLoader active: true - anchors.left: communityIcon.right + anchors.left: communityIcon.visible ? communityIcon.right : parent.left anchors.leftMargin: 2 anchors.verticalCenter: parent.verticalCenter sourceComponent: communityBadge.useLetterIdenticon ? letterIdenticon :imageIcon diff --git a/ui/app/AppLayouts/Chat/components/SearchPopup.qml b/ui/app/AppLayouts/Chat/components/SearchPopup.qml index 07d425a63e..a025a4709d 100644 --- a/ui/app/AppLayouts/Chat/components/SearchPopup.qml +++ b/ui/app/AppLayouts/Chat/components/SearchPopup.qml @@ -60,8 +60,8 @@ Popup { SVGImage { id: searchImage source: "../../../img/search.svg" - width: 28 - height: 28 + width: 40 + height: 40 anchors.left: parent.left anchors.leftMargin: Style.current.padding anchors.verticalCenter: parent.verticalCenter @@ -128,13 +128,14 @@ Popup { } BadgeContent { - chatId: chatId - name: chatsModel.channelView.activeChannel.name + chatId: popup.chatId + name: Utils.removeStatusEns(chatsModel.channelView.activeChannel.name) identicon: chatsModel.channelView.activeChannel.identicon communityId: chatsModel.channelView.activeChannel.communityId anchors.left: inText.right anchors.leftMargin: 4 anchors.verticalCenter: parent.verticalCenter + hideSecondIcon: true } } diff --git a/ui/app/img/search.svg b/ui/app/img/search.svg index 7e2b291a0e..57c04b6f16 100644 --- a/ui/app/img/search.svg +++ b/ui/app/img/search.svg @@ -1,3 +1,3 @@ - - + + diff --git a/ui/shared/SearchBox.qml b/ui/shared/SearchBox.qml index 814c62f022..b0b5543b68 100644 --- a/ui/shared/SearchBox.qml +++ b/ui/shared/SearchBox.qml @@ -6,8 +6,8 @@ Input { //% "Search" placeholderText: qsTrId("search") icon: "../app/img/search.svg" - iconWidth: 17 - iconHeight: 17 + iconWidth: 24 + iconHeight: 24 customHeight: 36 fontPixelSize: 15 }