refactor: don't make StatusChatList scrollable by default

This is because we ran into issues where some component compositions
caused scrollviews to be nested which rendered them non-functional.

For now we're rolling back the idea of components being smart enough
to become scrollable by themselves and have StatusQ consumers handle
scroll behaviour.
This commit is contained in:
Pascal Precht 2021-06-22 10:37:59 +02:00 committed by Michał Cieślak
parent eab95c1c7b
commit 11e6429068
2 changed files with 63 additions and 51 deletions

View File

@ -173,13 +173,13 @@ Rectangle {
text: "Chat" text: "Chat"
} }
StatusChatListAndCategories { StatusChatList {
anchors.top: headline.bottom anchors.top: headline.bottom
anchors.topMargin: 16 anchors.topMargin: 16
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: parent.width anchors.horizontalCenter: parent.horizontalCenter
chatList.model: demoChatListItems chatListItems.model: demoChatListItems
selectedChatId: "0" selectedChatId: "0"
onChatItemSelected: selectedChatId = id onChatItemSelected: selectedChatId = id
onChatItemUnmuted: { onChatItemUnmuted: {
@ -247,6 +247,7 @@ Rectangle {
StatusAppTwoPanelLayout { StatusAppTwoPanelLayout {
leftPanel: Item { leftPanel: Item {
id: leftPanel
anchors.fill: parent anchors.fill: parent
StatusChatInfoToolBar { StatusChatInfoToolBar {
@ -255,7 +256,7 @@ Rectangle {
anchors.top: parent.top anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
chatInfoButton.title: "Cryptokitties" chatInfoButton.title: "CryptoKitties"
chatInfoButton.subTitle: "128 Members" chatInfoButton.subTitle: "128 Members"
chatInfoButton.image.source: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg" chatInfoButton.image.source: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg"
chatInfoButton.icon.color: Theme.palette.miscColor6 chatInfoButton.icon.color: Theme.palette.miscColor6
@ -283,63 +284,74 @@ Rectangle {
} }
} }
StatusChatListAndCategories { ScrollView {
id: scrollView
anchors.top: statusChatInfoToolBar.bottom anchors.top: statusChatInfoToolBar.bottom
anchors.topMargin: 8 anchors.topMargin: 8
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: parent.width width: leftPanel.width
chatList.model: demoCommunityChatListItems contentHeight: communityCategories.height
categoryList.model: demoCommunityCategoryItems clip: true
showCategoryActionButtons: true StatusChatListAndCategories {
onChatItemSelected: selectedChatId = id id: communityCategories
height: implicitHeight > (leftPanel.height - 64) ? implicitHeight + 8 : leftPanel.height - 64
width: leftPanel.width
categoryPopupMenu: StatusPopupMenu { chatList.model: demoCommunityChatListItems
categoryList.model: demoCommunityCategoryItems
property string categoryId showCategoryActionButtons: true
onChatItemSelected: selectedChatId = id
StatusMenuItem { categoryPopupMenu: StatusPopupMenu {
text: "Mute Category"
icon.name: "notification" property string categoryId
StatusMenuItem {
text: "Mute Category"
icon.name: "notification"
}
StatusMenuItem {
text: "Mark as Read"
icon.name: "checkmark-circle"
}
StatusMenuItem {
text: "Edit Category"
icon.name: "edit"
}
StatusMenuSeparator {}
StatusMenuItem {
text: "Delete Category"
icon.name: "delete"
type: StatusMenuItem.Type.Danger
}
} }
StatusMenuItem {
text: "Mark as Read"
icon.name: "checkmark-circle"
}
StatusMenuItem { popupMenu: StatusPopupMenu {
text: "Edit Category" StatusMenuItem {
icon.name: "edit" text: "Create channel"
} icon.name: "channel"
}
StatusMenuSeparator {} StatusMenuItem {
text: "Create category"
icon.name: "channel-category"
}
StatusMenuItem { StatusMenuSeparator {}
text: "Delete Category"
icon.name: "delete"
type: StatusMenuItem.Type.Danger
}
}
StatusMenuItem {
popupMenu: StatusPopupMenu { text: "Invite people"
StatusMenuItem { icon.name: "share-ios"
text: "Create channel" }
icon.name: "channel"
}
StatusMenuItem {
text: "Create category"
icon.name: "channel-category"
}
StatusMenuSeparator {}
StatusMenuItem {
text: "Invite people"
icon.name: "share-ios"
} }
} }
} }

View File

@ -4,11 +4,11 @@ import QtQuick.Controls 2.14
import StatusQ.Components 0.1 import StatusQ.Components 0.1
import StatusQ.Popups 0.1 import StatusQ.Popups 0.1
ScrollView { Item {
id: statusChatListAndCategories id: statusChatListAndCategories
clip: true implicitHeight: chatListsAndCategories.height
contentHeight: chatListsAndCategories.height + 8 implicitWidth: chatListsAndCategories.width
property string selectedChatId: "" property string selectedChatId: ""
property bool showCategoryActionButtons: false property bool showCategoryActionButtons: false
@ -32,7 +32,7 @@ ScrollView {
MouseArea { MouseArea {
id: sensor id: sensor
anchors.top: parent.top anchors.top: parent.top
width: parent.width width: statusChatListAndCategories.width
height: statusChatListAndCategories.height height: statusChatListAndCategories.height
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: { onClicked: {