[#2707] Added "My Profile" button in new chat popup

My profile link was not shown when starting 1x1 chat
having someone in contacts as it is currently the case in
mobile app

Closes #2707
This commit is contained in:
Alexandra Betouni 2021-07-20 18:22:09 +03:00 committed by Iuri Matias
parent 7ac63b4451
commit 03db6a4985
10 changed files with 76 additions and 15 deletions

View File

@ -15,6 +15,7 @@ StatusAppTwoPanelLayout {
property alias chatColumn: chatColumn property alias chatColumn: chatColumn
property bool stickersLoaded: false property bool stickersLoaded: false
property bool profilePopupOpened: false property bool profilePopupOpened: false
signal profileButtonClicked()
Connections { Connections {
target: chatsModel.stickers target: chatsModel.stickers
@ -44,6 +45,9 @@ StatusAppTwoPanelLayout {
Component { Component {
id: contactsColumnComponent id: contactsColumnComponent
ContactsColumn { ContactsColumn {
onOpenProfileClicked: {
chatView.profileButtonClicked();
}
} }
} }

View File

@ -15,10 +15,10 @@ import StatusQ.Components 0.1
import StatusQ.Popups 0.1 import StatusQ.Popups 0.1
Item { Item {
id: contactsColumn
property int chatGroupsListViewCount: channelList.chatListItems.count property int chatGroupsListViewCount: channelList.chatListItems.count
property alias searchStr: searchBox.text property alias searchStr: searchBox.text
signal openProfileClicked()
id: contactsColumn
Layout.fillHeight: true Layout.fillHeight: true
width: 304 width: 304
@ -195,6 +195,9 @@ Item {
onClosed: { onClosed: {
destroy() destroy()
} }
onProfileClicked: {
contactsColumn.openProfileClicked();
}
} }
} }

View File

@ -7,15 +7,16 @@ import "../../../../shared/status"
import "./" import "./"
ModalPopup { ModalPopup {
id: popup
//% "New chat"
title: qsTrId("new-chat")
signal profileClicked()
function doJoin(pk, ensName) { function doJoin(pk, ensName) {
chatsModel.channelView.joinPrivateChat(pk, Utils.isChatKey(pk) ? "" : ensName); chatsModel.channelView.joinPrivateChat(pk, Utils.isChatKey(pk) ? "" : ensName);
popup.close(); popup.close();
} }
id: popup
//% "New chat"
title: qsTrId("new-chat")
onOpened: { onOpened: {
contactFieldAndList.chatKey.text = "" contactFieldAndList.chatKey.text = ""
contactFieldAndList.pubKey = "" contactFieldAndList.pubKey = ""
@ -36,6 +37,49 @@ ModalPopup {
popup.close(); popup.close();
} }
} }
Control {
width: 124
height: 36
anchors.bottom: parent.bottom
anchors.bottomMargin: 24
anchors.horizontalCenter: parent.horizontalCenter
background: Rectangle {
anchors.fill: parent
radius: 34
color: Style.current.roundedButtonSecondaryHoveredBackgroundColor
}
contentItem: Item {
anchors.fill: parent
SVGImage {
id: dollarEmoji
width: 32
height: 32
anchors.left: parent.left
anchors.leftMargin: 2
anchors.verticalCenter: parent.verticalCenter
source: Qt.resolvedUrl("../../../../imports/twemoji/svg/1f911.svg")
}
StyledText {
anchors.left: dollarEmoji.right
anchors.leftMargin: 6
anchors.verticalCenter: parent.verticalCenter
text: qsTr("My Profile")
font.pixelSize: 15
color: Style.current.white
}
}
MouseArea {
anchors.fill: parent
cursorShape: "PointingHandCursor"
onClicked: {
popup.profileClicked();
Config.currentMenuTab = 0;
popup.close();
}
}
}
} }
/*##^## /*##^##

View File

@ -4,7 +4,6 @@ import "../../../shared"
import "./LeftTab" import "./LeftTab"
Rectangle { Rectangle {
property alias currentTab: profileMenu.profileCurrentIndex
property alias changeProfileSection: profileMenu.changeProfileSection property alias changeProfileSection: profileMenu.changeProfileSection
id: profileInfoContainer id: profileInfoContainer

View File

@ -7,7 +7,6 @@ import "./components"
import "./constants.js" as ProfileConstants import "./constants.js" as ProfileConstants
ScrollView { ScrollView {
property int profileCurrentIndex: ProfileConstants.PROFILE
readonly property int btnheight: 42 readonly property int btnheight: 42
readonly property int w: 340 readonly property int w: 340
property var changeProfileSection: function (sectionId) { property var changeProfileSection: function (sectionId) {
@ -31,8 +30,8 @@ ScrollView {
active: profileMenu.profileCurrentIndex === modelData.id active: profileMenu.profileCurrentIndex === modelData.id
Layout.fillWidth: true Layout.fillWidth: true
width: profileMenu.width width: profileMenu.width
onClicked: function () { onClicked: {
profileMenu.profileCurrentIndex = modelData.id Config.currentMenuTab = modelData.id;
} }
} }
} }
@ -55,7 +54,7 @@ ScrollView {
Layout.fillWidth: true Layout.fillWidth: true
width: profileMenu.width width: profileMenu.width
onClicked: function () { onClicked: function () {
profileMenu.profileCurrentIndex = modelData.id Config.currentMenuTab = modelData.id;
} }
} }
} }
@ -77,7 +76,7 @@ ScrollView {
if (modelData.function === "exit") { if (modelData.function === "exit") {
return Qt.quit() return Qt.quit()
} }
profileMenu.profileCurrentIndex = modelData.id Config.currentMenuTab = modelData.id;
} }
} }
} }

View File

@ -11,7 +11,7 @@ Rectangle {
property bool active: false property bool active: false
property url source: "../../../../img/eye.svg" property url source: "../../../../img/eye.svg"
property string text: "My Profile" property string text: "My Profile"
property var onClicked: function () {} signal clicked()
id: menuButton id: menuButton
color: { color: {
@ -79,7 +79,7 @@ Rectangle {
menuButton.hovered = false menuButton.hovered = false
} }
onClicked: function () { onClicked: function () {
menuButton.onClicked() menuButton.clicked()
} }
} }
} }

View File

@ -26,7 +26,7 @@ StatusAppTwoPanelLayout {
property int profileContentWidth: Math.max(contentMinWidth, Math.min(profileContainer.width * 0.8, contentMaxWidth)) property int profileContentWidth: Math.max(contentMinWidth, Math.min(profileContainer.width * 0.8, contentMaxWidth))
anchors.fill: parent anchors.fill: parent
currentIndex: leftTab.currentTab currentIndex: Config.currentMenuTab
onCurrentIndexChanged: { onCurrentIndexChanged: {
if(visibleChildren[0] === ensContainer){ if(visibleChildren[0] === ensContainer){

View File

@ -271,6 +271,9 @@ StatusAppLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignLeft | Qt.AlignTop Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.fillHeight: true Layout.fillHeight: true
onProfileButtonClicked: {
appMain.changeAppSection(Constants.profile);
}
} }
WalletLayout { WalletLayout {

8
ui/imports/Config.qml Normal file
View File

@ -0,0 +1,8 @@
pragma Singleton
import QtQuick 2.13
QtObject {
property int currentMenuTab: 0
}

View File

@ -3,5 +3,6 @@ singleton Style 1.0 ./Style.qml
singleton Constants 1.0 ./Constants.qml singleton Constants 1.0 ./Constants.qml
singleton Utils 1.0 ./Utils.qml singleton Utils 1.0 ./Utils.qml
singleton Emoji 1.0 ./Emoji.qml singleton Emoji 1.0 ./Emoji.qml
singleton Config 1.0 ./Config.qml
singleton SelectedMessage 1.0 ./SelectedMessage.qml singleton SelectedMessage 1.0 ./SelectedMessage.qml
singleton Backpressure 1.0 ./Backpressure/Backpressure.qml singleton Backpressure 1.0 ./Backpressure/Backpressure.qml