feat(StatusChatToolBar): Add flexible component in right toolbar position
- Added loader in right component position and removed `StatusChatInfoButton` specific. - Updated sandbox and added new example in Layouts with another different component than the `StatusChatInfoButton`. BREAKING CHANGES: The toolbar now expects a component to be loaded. The previous `StatusChatInfoButton` component has been removed and needs to be passed as a component from outside whenever needed. Breaking changes in `desktop` will be addressed in: https://github.com/status-im/status-desktop/pull/5823
This commit is contained in:
parent
46cd904ced
commit
1cadfc051b
|
@ -10,31 +10,92 @@ import StatusQ.Layout 0.1
|
||||||
import StatusQ.Popups 0.1
|
import StatusQ.Popups 0.1
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
spacing: 5
|
spacing: 10
|
||||||
|
|
||||||
StatusChatToolBar {
|
StatusChatToolBar {
|
||||||
chatInfoButton.title: "Some contact"
|
toolbarComponent: chatInfoButton1
|
||||||
chatInfoButton.subTitle: "Contact"
|
width: 518
|
||||||
chatInfoButton.icon.color: Theme.palette.miscColor7
|
|
||||||
chatInfoButton.type: StatusChatInfoButton.Type.OneToOneChat
|
Component {
|
||||||
|
id: chatInfoButton1
|
||||||
|
|
||||||
|
StatusChatInfoButton {
|
||||||
|
width: Math.min(implicitWidth, parent.width)
|
||||||
|
title: "Some contact"
|
||||||
|
subTitle: "Contact"
|
||||||
|
icon.color: Theme.palette.miscColor7
|
||||||
|
type: StatusChatInfoButton.Type.OneToOneChat
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusChatToolBar {
|
StatusChatToolBar {
|
||||||
chatInfoButton.title: "Some contact"
|
toolbarComponent: chatInfoButton2
|
||||||
chatInfoButton.subTitle: "Contact"
|
width: 518
|
||||||
chatInfoButton.icon.color: Theme.palette.miscColor7
|
|
||||||
chatInfoButton.type: StatusChatInfoButton.Type.PublicChat
|
Component {
|
||||||
chatInfoButton.pinnedMessagesCount: 1
|
id: chatInfoButton2
|
||||||
chatInfoButton.muted: true
|
StatusChatInfoButton {
|
||||||
|
width: Math.min(implicitWidth, parent.width)
|
||||||
|
title: "Some contact"
|
||||||
|
subTitle: "Contact"
|
||||||
|
icon.color: Theme.palette.miscColor7
|
||||||
|
type: StatusChatInfoButton.Type.PublicChat
|
||||||
|
pinnedMessagesCount: 1
|
||||||
|
muted: true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
StatusChatToolBar {
|
StatusChatToolBar {
|
||||||
chatInfoButton.title: "Some contact"
|
|
||||||
chatInfoButton.subTitle: "Contact"
|
|
||||||
chatInfoButton.icon.color: Theme.palette.miscColor7
|
|
||||||
chatInfoButton.type: StatusChatInfoButton.Type.OneToOneChat
|
|
||||||
chatInfoButton.pinnedMessagesCount: 1
|
|
||||||
notificationCount: 1
|
notificationCount: 1
|
||||||
|
toolbarComponent: chatInfoButton3
|
||||||
|
width: 518
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: chatInfoButton3
|
||||||
|
|
||||||
|
StatusChatInfoButton {
|
||||||
|
width: Math.min(implicitWidth, parent.width)
|
||||||
|
title: "Some contact"
|
||||||
|
subTitle: "Contact"
|
||||||
|
icon.color: Theme.palette.miscColor7
|
||||||
|
type: StatusChatInfoButton.Type.OneToOneChat
|
||||||
|
pinnedMessagesCount: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusChatToolBar {
|
||||||
|
notificationCount: 1
|
||||||
|
toolbarComponent: tagSelector
|
||||||
|
width: 518
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: tagSelector
|
||||||
|
|
||||||
|
StatusTagSelector {
|
||||||
|
namesModel: ListModel {
|
||||||
|
ListElement {
|
||||||
|
publicId: "0x0"
|
||||||
|
name: "Maria"
|
||||||
|
icon: ""
|
||||||
|
isIdenticon: false
|
||||||
|
onlineStatus: 3
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
publicId: "0x1"
|
||||||
|
name: "James"
|
||||||
|
icon: ""
|
||||||
|
isIdenticon: false
|
||||||
|
onlineStatus: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
toLabelText: qsTr("To: ")
|
||||||
|
warningText: qsTr("USER LIMIT REACHED")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
|
|
@ -145,15 +145,8 @@ StatusAppThreePanelLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
StatusChatToolBar {
|
StatusChatToolBar {
|
||||||
anchors.top: parent.top
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
toolbarComponent: statusChatInfoButton
|
||||||
chatInfoButton.title: "Amazing Funny Squirrel"
|
|
||||||
chatInfoButton.subTitle: "Contact"
|
|
||||||
chatInfoButton.icon.color: Theme.palette.miscColor7
|
|
||||||
chatInfoButton.type: StatusChatInfoButton.Type.OneToOneChat
|
|
||||||
chatInfoButton.pinnedMessagesCount: 1
|
|
||||||
|
|
||||||
searchButton.visible: false
|
searchButton.visible: false
|
||||||
membersButton.visible: false
|
membersButton.visible: false
|
||||||
notificationCount: 1
|
notificationCount: 1
|
||||||
|
@ -186,6 +179,19 @@ StatusAppThreePanelLayout {
|
||||||
type: StatusMenuItem.Type.Danger
|
type: StatusMenuItem.Type.Danger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: statusChatInfoButton
|
||||||
|
|
||||||
|
StatusChatInfoButton {
|
||||||
|
width: Math.min(implicitWidth, parent.width)
|
||||||
|
title: "Amazing Funny Squirrel"
|
||||||
|
subTitle: "Contact"
|
||||||
|
icon.color: Theme.palette.miscColor7
|
||||||
|
type: StatusChatInfoButton.Type.OneToOneChat
|
||||||
|
pinnedMessagesCount: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,13 +166,10 @@ StatusAppThreePanelLayout {
|
||||||
centerPanel: Item {
|
centerPanel: Item {
|
||||||
StatusChatToolBar {
|
StatusChatToolBar {
|
||||||
id: statusChatToolBar
|
id: statusChatToolBar
|
||||||
anchors.top: parent.top
|
|
||||||
width: parent.width
|
|
||||||
|
|
||||||
chatInfoButton.title: "general"
|
width: parent.width
|
||||||
chatInfoButton.subTitle: "Community Chat"
|
toolbarComponent: statusChatInfoButton
|
||||||
chatInfoButton.icon.color: Theme.palette.miscColor6
|
|
||||||
chatInfoButton.type: StatusChatInfoButton.Type.CommunityChat
|
|
||||||
onSearchButtonClicked: {
|
onSearchButtonClicked: {
|
||||||
searchButton.highlighted = !searchButton.highlighted;
|
searchButton.highlighted = !searchButton.highlighted;
|
||||||
searchPopup.setSearchSelection(communityDetailModalTitle,
|
searchPopup.setSearchSelection(communityDetailModalTitle,
|
||||||
|
@ -184,6 +181,18 @@ StatusAppThreePanelLayout {
|
||||||
onMembersButtonClicked: {
|
onMembersButtonClicked: {
|
||||||
root.showRightPanel = !root.showRightPanel;
|
root.showRightPanel = !root.showRightPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: statusChatInfoButton
|
||||||
|
|
||||||
|
StatusChatInfoButton {
|
||||||
|
width: Math.min(implicitWidth, parent.width)
|
||||||
|
title: "general"
|
||||||
|
subTitle: "Community Chat"
|
||||||
|
icon.color: Theme.palette.miscColor6
|
||||||
|
type: StatusChatInfoButton.Type.CommunityChat
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusSearchPopup {
|
StatusSearchPopup {
|
||||||
|
|
|
@ -1,24 +1,22 @@
|
||||||
import QtQuick 2.14
|
import QtQuick 2.14
|
||||||
import QtQuick.Controls 2.14
|
import QtQuick.Controls 2.14
|
||||||
|
import QtQuick.Layouts 1.13
|
||||||
|
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
|
Item {
|
||||||
Rectangle {
|
|
||||||
id: statusChatToolBar
|
id: statusChatToolBar
|
||||||
implicitWidth: 518
|
|
||||||
height: 56
|
|
||||||
color: Theme.palette.statusAppLayout.backgroundColor
|
|
||||||
|
|
||||||
property alias chatInfoButton: statusChatInfoButton
|
|
||||||
property alias menuButton: menuButton
|
property alias menuButton: menuButton
|
||||||
property alias notificationButton: notificationButton
|
property alias notificationButton: notificationButton
|
||||||
property alias membersButton: membersButton
|
property alias membersButton: membersButton
|
||||||
property alias searchButton: searchButton
|
property alias searchButton: searchButton
|
||||||
property int notificationCount: 0
|
|
||||||
|
|
||||||
|
property int padding: 8
|
||||||
|
property int notificationCount: 0
|
||||||
property Component popupMenu
|
property Component popupMenu
|
||||||
|
property var toolbarComponent
|
||||||
|
|
||||||
signal chatInfoButtonClicked()
|
signal chatInfoButtonClicked()
|
||||||
signal menuButtonClicked()
|
signal menuButtonClicked()
|
||||||
|
@ -26,27 +24,33 @@ Rectangle {
|
||||||
signal membersButtonClicked()
|
signal membersButtonClicked()
|
||||||
signal searchButtonClicked()
|
signal searchButtonClicked()
|
||||||
|
|
||||||
|
implicitWidth: 518
|
||||||
|
implicitHeight: 60
|
||||||
|
|
||||||
onPopupMenuChanged: {
|
onPopupMenuChanged: {
|
||||||
if (!!popupMenu) {
|
if (!!popupMenu) {
|
||||||
popupMenuSlot.sourceComponent = popupMenu
|
popupMenuSlot.sourceComponent = popupMenu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusChatInfoButton {
|
RowLayout {
|
||||||
id: statusChatInfoButton
|
width: parent.width
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
spacing: padding / 2
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: 12
|
Loader {
|
||||||
width: Math.min(implicitWidth, parent.width - actionButtons.implicitWidth - anchors.leftMargin * 2)
|
id: loader
|
||||||
onClicked: statusChatToolBar.chatInfoButtonClicked()
|
sourceComponent: statusChatToolBar.toolbarComponent
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
|
||||||
|
Layout.topMargin: padding
|
||||||
|
Layout.leftMargin: padding
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
RowLayout {
|
||||||
id: actionButtons
|
id: actionButtons
|
||||||
anchors.right: parent.right
|
Layout.alignment: Qt.AlignTop | Qt.AlignRight
|
||||||
anchors.rightMargin: 8
|
Layout.topMargin: padding
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
Layout.rightMargin: padding
|
||||||
|
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
StatusFlatRoundButton {
|
StatusFlatRoundButton {
|
||||||
|
@ -126,7 +130,7 @@ Rectangle {
|
||||||
height: 24
|
height: 24
|
||||||
width: 1
|
width: 1
|
||||||
color: Theme.palette.directColor7
|
color: Theme.palette.directColor7
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
visible: notificationButton.visible &&
|
visible: notificationButton.visible &&
|
||||||
(menuButton.visible || membersButton.visible || searchButton.visible)
|
(menuButton.visible || membersButton.visible || searchButton.visible)
|
||||||
}
|
}
|
||||||
|
@ -169,7 +173,7 @@ Rectangle {
|
||||||
border.color: parent.hovered ? Theme.palette.baseColor2 : Theme.palette.statusAppLayout.backgroundColor
|
border.color: parent.hovered ? Theme.palette.baseColor2 : Theme.palette.statusAppLayout.backgroundColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue