From aa804ffaefec81a7f4f4d30d7e79227b224b86be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= Date: Thu, 7 Jul 2022 16:16:17 +0200 Subject: [PATCH] fix(CreateChatView): hide the Contacts label when no contacts - hide the TagSelector's `listLabel` and disable the `textEdit` when the contacts model is empty - add forgotten `qsTr()` - remove some no-op positioniers/anchors/width/height bindings (these are handled automatically for QQC2 Control's header and contentItem) --- .../AppLayouts/Chat/panels/GroupChatPanel.qml | 2 +- .../AppLayouts/Chat/views/CreateChatView.qml | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/ui/app/AppLayouts/Chat/panels/GroupChatPanel.qml b/ui/app/AppLayouts/Chat/panels/GroupChatPanel.qml index 4242f57032..7212a885b2 100644 --- a/ui/app/AppLayouts/Chat/panels/GroupChatPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/GroupChatPanel.qml @@ -165,7 +165,7 @@ RowLayout { id: confirmButton implicitHeight: 44 Layout.alignment: Qt.AlignTop - text: "Confirm" + text: qsTr("Confirm") onClicked: { if(root.chatContentModule.chatDetails.id &&((d.addedMembersIds.length > 0) || (d.removedMembersIds.length > 0))) { // Add request: diff --git a/ui/app/AppLayouts/Chat/views/CreateChatView.qml b/ui/app/AppLayouts/Chat/views/CreateChatView.qml index a757185540..d7a3c29f48 100644 --- a/ui/app/AppLayouts/Chat/views/CreateChatView.qml +++ b/ui/app/AppLayouts/Chat/views/CreateChatView.qml @@ -81,9 +81,7 @@ Page { // TODO: Could it be replaced to `GroupChatPanel`? header: RowLayout { id: headerRow - width: parent.width height: tagSelector.height - anchors.top: parent.top anchors.topMargin: 8 clip: true StatusTagSelector { @@ -93,7 +91,8 @@ Page { Layout.leftMargin: 17 maxHeight: root.height nameCountLimit: 20 - listLabel: qsTr("Contacts") + listLabel: contactsModel.count ? qsTr("Contacts") : "" + textEdit.enabled: contactsModel.count toLabelText: qsTr("To: ") warningText: qsTr("USER LIMIT REACHED") ringSpecModelGetter: function(pubKey) { @@ -114,8 +113,8 @@ Page { id: confirmButton implicitHeight: 44 Layout.alignment: Qt.AlignTop - enabled: (tagSelector.namesModel.count > 0) - text: "Confirm" + enabled: tagSelector.namesModel.count > 0 + text: qsTr("Confirm") onClicked: { root.rootStore.createChatInitMessage = chatInput.textInput.text; root.rootStore.createChatFileUrls = chatInput.fileUrls; @@ -138,9 +137,6 @@ Page { } contentItem: Item { - anchors.fill: parent - anchors.topMargin: headerRow.height + 32 - StatusChatInput { id: chatInput anchors.bottom: parent.bottom @@ -178,17 +174,16 @@ Page { } StatusBaseText { - width: parent.width - height: contentHeight + width: parent.width*.66 anchors.centerIn: parent horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - visible: (contactsModel.count === 0) + visible: contactsModel.count === 0 wrapMode: Text.WordWrap font.pixelSize: 15 color: Theme.palette.baseColor1 text: qsTr("You can only send direct messages to your Contacts.\n\n -Send a contact request to the person you would like to chat with, you will be able to +Send a contact request to the person you would like to chat with, you will be able to \ chat with them once they have accepted your contact request.") Component.onCompleted: { if (visible) {