diff --git a/ui/app/AppLayouts/Profile/panels/ContactPanel.qml b/ui/app/AppLayouts/Profile/panels/ContactPanel.qml index ea64fd8d1d..5cc5246098 100644 --- a/ui/app/AppLayouts/Profile/panels/ContactPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ContactPanel.qml @@ -1,22 +1,11 @@ import QtQuick 2.15 -import QtQuick.Controls 2.15 -import QtQuick.Layouts 1.15 -import StatusQ.Core 0.1 -import StatusQ.Core.Theme 0.1 import StatusQ.Components 0.1 import StatusQ.Controls 0.1 -import StatusQ.Popups 0.1 +import StatusQ.Core 0.1 +import StatusQ.Core.Theme 0.1 import utils 1.0 -import shared 1.0 -import shared.panels 1.0 -import shared.status 1.0 -import shared.views 1.0 -import shared.controls.chat 1.0 -import shared.controls.chat.menuItems 1.0 - -import AppLayouts.Profile.stores 1.0 StatusListItem { id: root @@ -25,13 +14,12 @@ StatusListItem { height: visible ? implicitHeight : 0 title: root.name - property ContactsStore contactsStore - property string name property string publicKey - property string compressedPk // Needed for the tests + probably gonna be used more in the future property string iconSource - property bool ensVerified + + property color pubKeyColor + property var colorHash property bool isContact: false property bool isBlocked: false @@ -54,17 +42,15 @@ StatusListItem { signal rejectionRemoved(string publicKey) signal textClicked(string publicKey) - subTitle: root.ensVerified ? "" : Utils.getElidedCompressedPk(root.publicKey) - asset.width: 40 asset.height: 40 - asset.color: Utils.colorForPubkey(root.publicKey) + asset.color: root.pubKeyColor asset.letterSize: asset._twoLettersSize asset.charactersLen: 2 asset.name: root.iconSource asset.isLetterIdenticon: root.iconSource.toString() === "" ringSettings { - ringSpecModel: Utils.getColorHashAsJson(root.publicKey, root.ensVerified) + ringSpecModel: root.colorHash ringPxSize: Math.max(asset.width / 24.0) } diff --git a/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml b/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml index 50ac6e256b..8a5d21e2ca 100644 --- a/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml @@ -13,15 +13,12 @@ import shared.panels 1.0 import "../../Chat/popups" -import AppLayouts.Profile.stores 1.0 - import SortFilterProxyModel 0.2 Item { id: root implicitHeight: (title.height + contactsList.height) - property ContactsStore contactsStore property var contactsModel property int panelUsage: Constants.contactsPanelUsage.unknownPosition @@ -104,17 +101,18 @@ Item { id: panelDelegate width: ListView.view.width - contactsStore: root.contactsStore name: model.preferredDisplayName - ensVerified: model.isEnsVerified publicKey: model.pubKey - compressedPk: Utils.getCompressedPk(model.pubKey) iconSource: model.icon isContact: model.isContact isBlocked: model.isBlocked isVerified: model.isVerified isUntrustworthy: model.isUntrustworthy + subTitle: model.ensVerified ? "" : Utils.getElidedCompressedPk(model.pubKey) + pubKeyColor: Utils.colorForPubkey(model.pubKey) + colorHash: Utils.getColorHashAsJson(model.pubKey, model.ensVerified) + showSendMessageButton: isContact && !isBlocked onOpenContactContextMenu: function (publicKey, name, icon) { root.openContactContextMenu(publicKey, name, icon) diff --git a/ui/app/AppLayouts/Profile/panels/qmldir b/ui/app/AppLayouts/Profile/panels/qmldir index 3ec7580ea9..57d88abc5f 100644 --- a/ui/app/AppLayouts/Profile/panels/qmldir +++ b/ui/app/AppLayouts/Profile/panels/qmldir @@ -1,3 +1,4 @@ +ContactPanel 1.0 ContactPanel.qml ProfileDescriptionPanel 1.0 ProfileDescriptionPanel.qml ProfileShowcaseAccountsPanel 1.0 ProfileShowcaseAccountsPanel.qml ProfileShowcaseAssetsPanel 1.0 ProfileShowcaseAssetsPanel.qml diff --git a/ui/app/AppLayouts/Profile/views/ContactsView.qml b/ui/app/AppLayouts/Profile/views/ContactsView.qml index 4f23fd2648..97ad956250 100644 --- a/ui/app/AppLayouts/Profile/views/ContactsView.qml +++ b/ui/app/AppLayouts/Profile/views/ContactsView.qml @@ -172,7 +172,6 @@ SettingsContentBase { onOpenContactContextMenu: function (publicKey, name, icon) { root.openContextMenu(publicKey, name, icon) } - contactsStore: root.contactsStore panelUsage: Constants.contactsPanelUsage.verifiedMutualContacts onSendMessageActionTriggered: { root.contactsStore.joinPrivateChat(publicKey) @@ -186,7 +185,6 @@ SettingsContentBase { title: qsTr("Contacts") contactsModel: root.contactsStore.myContactsModel searchString: searchBox.text - contactsStore: root.contactsStore onOpenContactContextMenu: function (publicKey, name, icon) { root.openContextMenu(publicKey, name, icon) } @@ -227,7 +225,6 @@ SettingsContentBase { Layout.fillWidth: true title: qsTr("Received") searchString: searchBox.text - contactsStore: root.contactsStore visible: count > 0 onOpenContactContextMenu: function (publicKey, name, icon) { root.openContextMenu(publicKey, name, icon) @@ -254,7 +251,6 @@ SettingsContentBase { Layout.fillWidth: true title: qsTr("Sent") searchString: searchBox.text - contactsStore: root.contactsStore visible: count > 0 onOpenContactContextMenu: function (publicKey, name, icon) { root.openContextMenu(publicKey, name, icon) @@ -279,7 +275,6 @@ SettingsContentBase { // clip: true // title: qsTr("Received") // searchString: searchBox.text - // contactsStore: root.contactsStore // onOpenContactContextMenu: function (publicKey, name, icon) { // root.openContextMenu(publicKey, name, icon) // } @@ -297,7 +292,6 @@ SettingsContentBase { // clip: true // title: qsTr("Sent") // searchString: searchBox.text - // contactsStore: root.contactsStore // onOpenContactContextMenu: function (publicKey, name, icon) { // root.openContextMenu(publicKey, name, icon) // } @@ -316,7 +310,6 @@ SettingsContentBase { ContactsListPanel { Layout.fillWidth: true searchString: searchBox.text - contactsStore: root.contactsStore onOpenContactContextMenu: function (publicKey, name, icon) { root.openContextMenu(publicKey, name, icon) }