fix(Createchat/EditGroupChat view): fixed spacing all over

Closes #7369
This commit is contained in:
Alexandra Betouni 2022-09-20 13:54:28 +03:00 committed by Alexandra Betouni
parent b94beff89f
commit 311cf5332c
4 changed files with 30 additions and 77 deletions

View File

@ -9,6 +9,8 @@ import StatusQ.Core.Theme 0.1
import StatusQ.Core.Utils 0.1 import StatusQ.Core.Utils 0.1
import StatusQ.Popups.Dialog 0.1 import StatusQ.Popups.Dialog 0.1
import utils 1.0
Item { Item {
id: root id: root
@ -33,46 +35,34 @@ Item {
RowLayout { RowLayout {
id: mainLayout id: mainLayout
spacing: 8
anchors.fill: parent anchors.fill: parent
spacing: Style.current.padding
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 44 Layout.preferredHeight: 44
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: Style.current.halfPadding
color: Theme.palette.baseColor2 color: Theme.palette.baseColor2
radius: 8 radius: Style.current.radius
RowLayout { RowLayout {
anchors { anchors.fill: parent
fill: parent spacing: Style.current.halfPadding
leftMargin: 16
rightMargin: 16
topMargin: 7
bottomMargin: 7
}
StatusBaseText { StatusBaseText {
id: label id: label
Layout.leftMargin: Style.current.padding
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
visible: text !== "" visible: text !== ""
font.pixelSize: 15 font.pixelSize: 15
color: Theme.palette.baseColor1 color: Theme.palette.baseColor1
} }
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
StatusScrollView { StatusScrollView {
id: scrollView id: scrollView
anchors.fill: parent anchors.fill: parent
padding: 0 padding: 0
onContentWidthChanged: { onContentWidthChanged: {
if (scrollView.contentWidth > scrollView.width) { if (scrollView.contentWidth > scrollView.width) {
scrollView.contentX = scrollView.contentWidth - scrollView.width scrollView.contentX = scrollView.contentWidth - scrollView.width
@ -83,36 +73,27 @@ Item {
RowLayout { RowLayout {
height: scrollView.height height: scrollView.height
spacing: 8
StatusListView { StatusListView {
id: listView id: listView
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.preferredHeight: 30
implicitWidth: contentWidth implicitWidth: contentWidth
orientation: ListView.Horizontal orientation: ListView.Horizontal
spacing: 8 spacing: Style.current.halfPadding
} }
TextInput { TextInput {
id: edit id: edit
Layout.fillHeight: true
Layout.minimumWidth: 4 Layout.minimumWidth: 4
Layout.fillHeight: true
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
font.pixelSize: 15 font.pixelSize: 15
color: Theme.palette.directColor1 color: Theme.palette.directColor1
cursorDelegate: Rectangle { cursorDelegate: Rectangle {
color: Theme.palette.primaryColor1 color: Theme.palette.primaryColor1
implicitWidth: 2 implicitWidth: 2
radius: 1 radius: 1
visible: edit.cursorVisible visible: edit.cursorVisible
SequentialAnimation on visible { SequentialAnimation on visible {
loops: Animation.Infinite loops: Animation.Infinite
running: edit.cursorVisible running: edit.cursorVisible
@ -163,8 +144,8 @@ Item {
StatusBaseText { StatusBaseText {
id: warningLabel id: warningLabel
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
Layout.alignment: Qt.AlignVCenter Layout.rightMargin: Style.current.padding
visible: text !== "" visible: text !== ""
font.pixelSize: 10 font.pixelSize: 10
color: Theme.palette.dangerColor1 color: Theme.palette.dangerColor1
@ -174,7 +155,6 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
propagateComposedEvents: true propagateComposedEvents: true
onPressed: { onPressed: {
edit.forceActiveFocus() edit.forceActiveFocus()
mouse.accepted = false mouse.accepted = false
@ -183,30 +163,26 @@ Item {
} }
StatusButton { StatusButton {
Layout.leftMargin: 10 Layout.alignment: Qt.AlignVCenter
text: qsTr("Confirm") text: qsTr("Confirm")
onClicked: root.confirmed() onClicked: root.confirmed()
} }
StatusButton { StatusButton {
Layout.alignment: Qt.AlignVCenter
text: qsTr("Reject") text: qsTr("Reject")
type: StatusBaseButton.Type.Danger type: StatusBaseButton.Type.Danger
onClicked: root.rejected() onClicked: root.rejected()
} }
} }
Popup { Popup {
id: suggestionsDialog id: suggestionsDialog
visible: edit.text !== "" && root.suggestionsModel.count
parent: edit parent: edit
y: parent.height x: (parent.contentWidth - Style.current.halfPadding)
y: (parent.height + Style.current.halfPadding)
padding: 8 visible: edit.text !== "" && root.suggestionsModel.count
padding: Style.current.halfPadding
background: StatusDialogBackground { background: StatusDialogBackground {
id: bg id: bg
layer.enabled: true layer.enabled: true
@ -223,11 +199,9 @@ Item {
StatusListView { StatusListView {
id: suggestionsListView id: suggestionsListView
anchors.fill: parent anchors.fill: parent
implicitWidth: contentItem.childrenRect.width implicitWidth: contentItem.childrenRect.width
implicitHeight: contentItem.childrenRect.height implicitHeight: contentItem.childrenRect.height
onVisibleChanged: currentIndex = 0 onVisibleChanged: currentIndex = 0
} }
} }

View File

@ -22,7 +22,7 @@ RowLayout {
property var rootStore property var rootStore
property var chatContentModule: root.rootStore.currentChatContentModule() property var chatContentModule: root.rootStore.currentChatContentModule()
property var emojiPopup property var emojiPopup
property int padding: 8 property int padding: Style.current.halfPadding
signal searchButtonClicked() signal searchButtonClicked()
@ -41,6 +41,7 @@ RowLayout {
Layout.fillHeight: true Layout.fillHeight: true
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
Layout.leftMargin: padding Layout.leftMargin: padding
Layout.rightMargin: Style.current.padding
sourceComponent: { sourceComponent: {
if (d.selectingMembers) return membersSelector if (d.selectingMembers) return membersSelector

View File

@ -31,22 +31,15 @@ Page {
header: Item { header: Item {
implicitHeight: headerLayout.implicitHeight + headerLayout.anchors.topMargin + headerLayout.anchors.bottomMargin implicitHeight: headerLayout.implicitHeight + headerLayout.anchors.topMargin + headerLayout.anchors.bottomMargin
RowLayout { RowLayout {
id: headerLayout id: headerLayout
anchors { anchors.fill: parent
fill: parent
topMargin: 8
}
MembersSelectorView { MembersSelectorView {
id: membersSelector id: membersSelector
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Layout.leftMargin: 16 Layout.leftMargin: Style.current.halfPadding
Layout.rightMargin: 16 Layout.rightMargin: Style.current.halfPadding
rootStore: root.rootStore rootStore: root.rootStore
enabled: root.rootStore.contactsModel.count > 0 enabled: root.rootStore.contactsModel.count > 0
@ -55,7 +48,6 @@ Page {
console.warn("Can't create chat with no members") console.warn("Can't create chat with no members")
return return
} }
if (model.count === 1) { if (model.count === 1) {
const member = model.get(0) const member = model.get(0)
const ensName = member.displayName.includes(".eth") ? member.displayName : "" const ensName = member.displayName.includes(".eth") ? member.displayName : ""
@ -90,9 +82,7 @@ Page {
} }
StatusActivityCenterButton { StatusActivityCenterButton {
Layout.preferredWidth: 32 Layout.alignment: Qt.AlignVCenter
Layout.preferredHeight: 32
unreadNotificationsCount: root.rootStore.unreadNotificationsCount unreadNotificationsCount: root.rootStore.unreadNotificationsCount
onClicked: Global.openActivityCenterPopup() onClicked: Global.openActivityCenterPopup()
} }
@ -103,17 +93,15 @@ Page {
ColumnLayout { ColumnLayout {
anchors { anchors {
fill: parent fill: parent
topMargin: 32 topMargin: Style.current.bigPadding
bottomMargin: 12 bottomMargin: Style.current.padding
leftMargin: 8 leftMargin: Style.current.halfPadding
} }
StatusBaseText { StatusBaseText {
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
Layout.leftMargin: 8 Layout.leftMargin: Style.current.halfPadding
visible: contactsList.visible visible: contactsList.visible
font.pixelSize: 15 font.pixelSize: 15
text: qsTr("Contacts") text: qsTr("Contacts")
color: Theme.palette.baseColor1 color: Theme.palette.baseColor1
@ -126,9 +114,7 @@ Page {
visible: membersSelector.suggestionsModel.count && visible: membersSelector.suggestionsModel.count &&
!(membersSelector.edit.text !== "") !(membersSelector.edit.text !== "")
implicitWidth: contentItem.childrenRect.width implicitWidth: contentItem.childrenRect.width
model: membersSelector.suggestionsModel model: membersSelector.suggestionsModel
delegate: ContactListItemDelegate { delegate: ContactListItemDelegate {
onClicked: membersSelector.entryAccepted(this) onClicked: membersSelector.entryAccepted(this)
@ -137,35 +123,28 @@ Page {
StatusChatInput { StatusChatInput {
id: chatInput id: chatInput
Layout.alignment: Qt.AlignBottom Layout.alignment: Qt.AlignBottom
Layout.fillWidth: true Layout.fillWidth: true
visible: membersSelector.model.count > 0 visible: membersSelector.model.count > 0
chatType: membersSelector.model.count === 1? Constants.chatType.oneToOne : Constants.chatType.privateGroupChat chatType: membersSelector.model.count === 1? Constants.chatType.oneToOne : Constants.chatType.privateGroupChat
emojiPopup: root.emojiPopup emojiPopup: root.emojiPopup
recentStickers: root.rootStore.stickersModuleInst.recent recentStickers: root.rootStore.stickersModuleInst.recent
stickerPackList: root.rootStore.stickersModuleInst.stickerPacks stickerPackList: root.rootStore.stickersModuleInst.stickerPacks
closeGifPopupAfterSelection: true closeGifPopupAfterSelection: true
onSendTransactionCommandButtonClicked: { onSendTransactionCommandButtonClicked: {
root.rootStore.createChatStartSendTransactionProcess = true; root.rootStore.createChatStartSendTransactionProcess = true;
root.createChat(); root.createChat();
} }
onReceiveTransactionCommandButtonClicked: { onReceiveTransactionCommandButtonClicked: {
root.rootStore.createChatStartReceiveTransactionProcess = true; root.rootStore.createChatStartReceiveTransactionProcess = true;
root.createChat(); root.createChat();
} }
onStickerSelected: { onStickerSelected: {
root.rootStore.createChatStickerHashId = hashId; root.rootStore.createChatStickerHashId = hashId;
root.rootStore.createChatStickerPackId = packId; root.rootStore.createChatStickerPackId = packId;
root.rootStore.createChatStickerUrl = url; root.rootStore.createChatStickerUrl = url;
root.createChat(); root.createChat();
} }
onSendMessage: { onSendMessage: {
root.rootStore.createChatFileUrls = chatInput.fileUrls; root.rootStore.createChatFileUrls = chatInput.fileUrls;
root.rootStore.createChatInitMessage = chatInput.textInput.text; root.rootStore.createChatInitMessage = chatInput.textInput.text;

View File

@ -36,7 +36,6 @@ MembersSelectorBase {
delegate: StatusTagItem { delegate: StatusTagItem {
readonly property string _pubKey: model.pubKey readonly property string _pubKey: model.pubKey
height: ListView.view.height height: ListView.view.height
text: model.displayName text: model.displayName