fix(@desktop/general): Improve UserStatusContextMenu

Fix #6090
This commit is contained in:
Michal Iskierko 2022-07-04 12:47:29 +02:00 committed by Michał Iskierko
parent c14ff47af8
commit 7d4d1747aa
6 changed files with 45 additions and 50 deletions

View File

@ -132,4 +132,10 @@ QtObject {
function hex2Eth(value) {
return globalUtils.hex2Eth(value)
}
function setCurrentUserStatus(newStatus) {
if (userProfileInst && userProfileInst.currentUserStatus !== newStatus) {
mainModuleInst.setCurrentUserStatus(newStatus)
}
}
}

View File

@ -361,7 +361,8 @@ Item {
UserStatusContextMenu {
id: userStatusContextMenu
y: profileButton.y - userStatusContextMenu.height
y: profileButton.y - userStatusContextMenu.height + profileButton.height
x: profileButton.x + profileButton.width + 5
store: appMain.rootStore
}
}

View File

@ -0,0 +1,4 @@
<svg width="19" height="12" viewBox="0 0 19 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="5.5" cy="6" r="4.5" fill="#939BA1" stroke="#F6F8FA" stroke-width="2"/>
<circle cx="13.5" cy="6" r="4.5" fill="#4EBC60" stroke="#F6F8FA" stroke-width="2"/>
</svg>

After

Width:  |  Height:  |  Size: 270 B

View File

@ -0,0 +1,3 @@
<svg width="11" height="12" viewBox="0 0 11 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="5.5" cy="6" r="4.5" fill="#939BA1" stroke="#F6F8FA" stroke-width="2"/>
</svg>

After

Width:  |  Height:  |  Size: 186 B

View File

@ -0,0 +1,3 @@
<svg width="11" height="12" viewBox="0 0 11 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="5.5" cy="6" r="4.5" fill="#4EBC60" stroke="#F6F8FA" stroke-width="2"/>
</svg>

After

Width:  |  Height:  |  Size: 186 B

View File

@ -1,5 +1,5 @@
import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.3
import QtQml.Models 2.3
@ -8,17 +8,14 @@ import shared.controls.chat 1.0
import shared.panels 1.0
import StatusQ.Components 0.1
import StatusQ.Popups 0.1
// TODO: replace with StatusPopupMenu
PopupMenu {
StatusPopupMenu {
id: root
property var store
width: 200
closePolicy: Popup.CloseOnReleaseOutsideParent | Popup.CloseOnEscape
overrideTextColor: Style.current.textColor
width: 210
ProfileHeader {
width: parent.width
@ -28,74 +25,55 @@ PopupMenu {
icon: root.store.userProfileInst.icon
}
Item {
height: root.topPadding
StatusMenuSeparator {
}
Separator {
}
Action {
StatusMenuItem {
text: qsTr("View My Profile")
icon.source: Style.svg("profile")
icon.width: 16
icon.height: 16
icon.name: "profile"
onTriggered: {
Global.openProfilePopup(root.store.userProfileInst.pubKey)
root.close()
}
}
Separator {
StatusMenuSeparator {
}
Action {
StatusMenuItem {
id: alwaysOnlineAction
text: qsTr("Always online")
image.source: Style.svg("statuses/online")
image.width: 12
image.height: 12
fontSettings.bold: root.store.userProfileInst.currentUserStatus === Constants.currentUserStatus.alwaysOnline
onTriggered: {
//TODO move this to the store as soon as #4274 is merged
if (userProfile.currentUserStatus !== Constants.currentUserStatus.alwaysOnline) {
mainModule.setCurrentUserStatus(Constants.currentUserStatus.alwaysOnline);
}
store.setCurrentUserStatus(Constants.currentUserStatus.alwaysOnline)
root.close();
}
icon.color: Style.current.green
icon.source: Style.svg("online")
icon.width: 16
icon.height: 16
}
Action {
StatusMenuItem {
id: inactiveAction
text: qsTr("Inactive")
image.source: Style.svg("statuses/inactive")
image.width: 12
image.height: 12
fontSettings.bold: root.store.userProfileInst.currentUserStatus === Constants.currentUserStatus.inactive
onTriggered: {
//TODO move this to the store as soon as #4274 is merged
if (userProfile.currentUserStatus !== Constants.currentUserStatus.inactive) {
mainModule.setCurrentUserStatus(Constants.currentUserStatus.inactive);
}
store.setCurrentUserStatus(Constants.currentUserStatus.inactive)
root.close();
}
icon.color: Style.current.midGrey
icon.source: Style.svg("offline")
icon.width: 16
icon.height: 16
}
Action {
StatusMenuItem {
id: automaticAction
text: qsTr("Set status automatically")
image.source: Style.svg("statuses/automatic")
fontSettings.bold: root.store.userProfileInst.currentUserStatus === Constants.currentUserStatus.automatic
onTriggered: {
//TODO move this to the store as soon as #4274 is merged
if (userProfile.currentUserStatus !== Constants.currentUserStatus.automatic) {
mainModule.setCurrentUserStatus(Constants.currentUserStatus.automatic);
}
store.setCurrentUserStatus(Constants.currentUserStatus.automatic)
root.close();
}
icon.color: Style.current.green
icon.source: Style.svg("online")
icon.width: 16
icon.height: 16
}
}