2020-07-21 21:03:22 +00:00
|
|
|
import QtQuick 2.13
|
2022-03-28 09:38:58 +00:00
|
|
|
import QtQuick.Controls 2.3
|
2020-07-21 21:03:22 +00:00
|
|
|
import QtQuick.Layouts 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.popups 1.0
|
2024-01-13 03:24:57 +00:00
|
|
|
import shared.stores 1.0
|
2022-03-16 21:20:03 +00:00
|
|
|
import shared.controls.chat 1.0
|
2020-07-21 21:03:22 +00:00
|
|
|
|
2021-10-06 09:16:39 +00:00
|
|
|
import "../popups"
|
2021-12-30 12:39:47 +00:00
|
|
|
import "../stores"
|
2022-06-22 12:16:21 +00:00
|
|
|
import "../controls"
|
|
|
|
import "./profile"
|
2021-10-06 09:16:39 +00:00
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
2021-09-09 14:03:17 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
2021-10-18 10:34:16 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2021-09-09 14:03:17 +00:00
|
|
|
|
2024-02-04 11:50:26 +00:00
|
|
|
import AppLayouts.Profile.panels 1.0
|
2024-01-13 03:24:57 +00:00
|
|
|
import AppLayouts.Wallet.stores 1.0
|
|
|
|
|
2022-05-07 11:45:15 +00:00
|
|
|
SettingsContentBase {
|
2021-10-06 09:16:39 +00:00
|
|
|
id: root
|
|
|
|
|
2022-06-22 12:16:21 +00:00
|
|
|
property WalletStore walletStore
|
2021-12-30 12:39:47 +00:00
|
|
|
property ProfileStore profileStore
|
2022-06-22 12:16:21 +00:00
|
|
|
property PrivacyStore privacyStore
|
2022-09-27 21:26:26 +00:00
|
|
|
property ContactsStore contactsStore
|
2024-02-02 09:55:56 +00:00
|
|
|
property NetworkConnectionStore networkConnectionStore
|
2024-01-13 03:24:57 +00:00
|
|
|
required property WalletAssetsStore walletAssetsStore
|
|
|
|
required property CurrenciesStore currencyStore
|
|
|
|
|
2023-02-28 15:00:10 +00:00
|
|
|
property var communitiesModel
|
2022-06-22 12:16:21 +00:00
|
|
|
|
2024-02-07 09:54:45 +00:00
|
|
|
property bool sideBySidePreview
|
|
|
|
|
|
|
|
property QtObject dirtyValues: QtObject {
|
|
|
|
property string displayName: descriptionPanel.displayName.text
|
|
|
|
property string bio: descriptionPanel.bio.text
|
|
|
|
property url profileLargeImage: profileHeader.previewIcon
|
|
|
|
}
|
|
|
|
|
|
|
|
titleRowComponentLoader.sourceComponent: StatusButton {
|
|
|
|
text: qsTr("Preview")
|
|
|
|
onClicked: Global.openPopup(profilePreview)
|
|
|
|
visible: !root.sideBySidePreview
|
2022-06-22 12:16:21 +00:00
|
|
|
}
|
|
|
|
|
2024-02-04 11:50:26 +00:00
|
|
|
dirty: (!descriptionPanel.isEnsName &&
|
|
|
|
descriptionPanel.displayName.text !== profileStore.displayName) ||
|
|
|
|
descriptionPanel.bio.text !== profileStore.bio ||
|
|
|
|
profileStore.socialLinksDirty ||
|
|
|
|
profileHeader.icon !== profileStore.profileLargeImage ||
|
|
|
|
priv.hasAnyProfileShowcaseChanges
|
|
|
|
saveChangesButtonEnabled: !!descriptionPanel.displayName.text && descriptionPanel.displayName.valid
|
2022-06-22 12:16:21 +00:00
|
|
|
|
2024-02-04 11:50:26 +00:00
|
|
|
onResetChangesClicked: priv.reset()
|
|
|
|
|
|
|
|
onSaveChangesClicked: priv.save()
|
2020-07-21 21:03:22 +00:00
|
|
|
|
2022-10-20 13:41:18 +00:00
|
|
|
bottomHeaderComponents: StatusTabBar {
|
2024-02-04 11:50:26 +00:00
|
|
|
id: profileTabBar
|
|
|
|
|
2022-10-20 13:41:18 +00:00
|
|
|
StatusTabButton {
|
2024-02-04 11:50:26 +00:00
|
|
|
width: implicitWidth
|
2023-09-22 09:58:02 +00:00
|
|
|
leftPadding: 0
|
2024-02-04 11:50:26 +00:00
|
|
|
text: qsTr("Identity")
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusTabButton {
|
2022-10-20 13:41:18 +00:00
|
|
|
width: implicitWidth
|
2024-02-04 11:50:26 +00:00
|
|
|
text: qsTr("Communities")
|
2022-10-20 13:41:18 +00:00
|
|
|
}
|
2024-02-04 11:50:26 +00:00
|
|
|
|
2022-10-20 13:41:18 +00:00
|
|
|
StatusTabButton {
|
|
|
|
width: implicitWidth
|
2024-02-04 11:50:26 +00:00
|
|
|
text: qsTr("Accounts")
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusTabButton {
|
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("Collectibles")
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusTabButton {
|
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("Assets")
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusTabButton {
|
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("Web")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onVisibleChanged: if (visible) profileStore.requestProfileShowcasePreferences()
|
|
|
|
Component.onCompleted: profileStore.requestProfileShowcasePreferences()
|
|
|
|
|
|
|
|
readonly property var priv: QtObject {
|
|
|
|
id: priv
|
|
|
|
|
|
|
|
property bool hasAnyProfileShowcaseChanges: false
|
|
|
|
|
|
|
|
function reset() {
|
|
|
|
descriptionPanel.displayName.text = Qt.binding(() => { return profileStore.displayName })
|
|
|
|
descriptionPanel.bio.text = Qt.binding(() => { return profileStore.bio })
|
|
|
|
profileStore.resetSocialLinks()
|
|
|
|
profileHeader.icon = Qt.binding(() => { return profileStore.profileLargeImage })
|
|
|
|
|
|
|
|
profileShowcaseCommunitiesPanel.reset()
|
|
|
|
profileShowcaseAccountsPanel.reset()
|
|
|
|
profileShowcaseCollectiblesPanel.reset()
|
|
|
|
profileShowcaseAssetsPanel.reset()
|
|
|
|
root.profileStore.requestProfileShowcasePreferences()
|
|
|
|
hasAnyProfileShowcaseChanges = false
|
|
|
|
}
|
|
|
|
|
|
|
|
function save() {
|
|
|
|
if (hasAnyProfileShowcaseChanges)
|
|
|
|
profileStore.storeProfileShowcasePreferences()
|
|
|
|
|
|
|
|
if (!descriptionPanel.isEnsName)
|
|
|
|
profileStore.setDisplayName(descriptionPanel.displayName.text)
|
|
|
|
profileStore.setBio(descriptionPanel.bio.text.trim())
|
|
|
|
profileStore.saveSocialLinks()
|
|
|
|
if (profileHeader.icon === "") {
|
|
|
|
root.profileStore.removeImage()
|
|
|
|
} else {
|
|
|
|
profileStore.uploadImage(profileHeader.icon,
|
|
|
|
profileHeader.cropRect.x.toFixed(),
|
|
|
|
profileHeader.cropRect.y.toFixed(),
|
|
|
|
(profileHeader.cropRect.x + profileHeader.cropRect.width).toFixed(),
|
|
|
|
(profileHeader.cropRect.y + profileHeader.cropRect.height).toFixed());
|
|
|
|
}
|
|
|
|
|
|
|
|
reset()
|
2022-10-20 13:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-07 11:45:15 +00:00
|
|
|
ColumnLayout {
|
|
|
|
width: root.contentWidth
|
2020-07-21 21:03:22 +00:00
|
|
|
|
2022-06-22 12:16:21 +00:00
|
|
|
StackLayout {
|
2022-11-11 16:46:35 +00:00
|
|
|
id: stackLayout
|
2024-02-04 11:50:26 +00:00
|
|
|
currentIndex: profileTabBar.currentIndex
|
2020-07-21 21:03:22 +00:00
|
|
|
|
2024-02-04 11:50:26 +00:00
|
|
|
// identity
|
|
|
|
ColumnLayout {
|
2022-11-29 10:30:51 +00:00
|
|
|
objectName: "myProfileSettingsView"
|
2024-02-04 11:50:26 +00:00
|
|
|
ProfileHeader {
|
|
|
|
id: profileHeader
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
Layout.rightMargin: Style.current.padding
|
|
|
|
|
|
|
|
store: root.profileStore
|
|
|
|
|
|
|
|
displayName: profileStore.name
|
|
|
|
pubkey: profileStore.pubkey
|
|
|
|
icon: profileStore.profileLargeImage
|
|
|
|
imageSize: ProfileHeader.ImageSize.Big
|
|
|
|
|
|
|
|
displayNameVisible: false
|
|
|
|
pubkeyVisible: false
|
|
|
|
emojiHashVisible: false
|
|
|
|
editImageButtonVisible: true
|
|
|
|
}
|
|
|
|
|
|
|
|
ProfileDescriptionPanel {
|
|
|
|
id: descriptionPanel
|
|
|
|
|
|
|
|
readonly property bool isEnsName: profileStore.preferredName
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
displayName.focus: !isEnsName
|
|
|
|
displayName.input.edit.readOnly: isEnsName
|
|
|
|
displayName.text: profileStore.name
|
|
|
|
displayName.validationMode: StatusInput.ValidationMode.Always
|
|
|
|
displayName.validators: isEnsName ? [] : Constants.validators.displayName
|
|
|
|
bio.text: profileStore.bio
|
|
|
|
}
|
2022-05-07 11:45:15 +00:00
|
|
|
}
|
2022-03-16 21:20:03 +00:00
|
|
|
|
2024-02-04 11:50:26 +00:00
|
|
|
// communities
|
|
|
|
ProfileShowcaseCommunitiesPanel {
|
|
|
|
id: profileShowcaseCommunitiesPanel
|
|
|
|
baseModel: root.communitiesModel
|
|
|
|
showcaseModel: root.profileStore.profileShowcaseCommunitiesModel
|
|
|
|
onShowcaseEntryChanged: priv.hasAnyProfileShowcaseChanges = true
|
|
|
|
}
|
|
|
|
|
|
|
|
// accounts
|
|
|
|
ProfileShowcaseAccountsPanel {
|
|
|
|
id: profileShowcaseAccountsPanel
|
|
|
|
baseModel: root.walletStore.accounts
|
|
|
|
showcaseModel: root.profileStore.profileShowcaseAccountsModel
|
|
|
|
currentWallet: root.walletStore.overview.mixedcaseAddress
|
|
|
|
onShowcaseEntryChanged: priv.hasAnyProfileShowcaseChanges = true
|
|
|
|
}
|
|
|
|
|
|
|
|
// collectibles
|
|
|
|
ProfileShowcaseCollectiblesPanel {
|
|
|
|
id: profileShowcaseCollectiblesPanel
|
|
|
|
baseModel: root.profileStore.collectiblesModel
|
|
|
|
showcaseModel: root.profileStore.profileShowcaseCollectiblesModel
|
|
|
|
onShowcaseEntryChanged: priv.hasAnyProfileShowcaseChanges = true
|
|
|
|
}
|
|
|
|
|
|
|
|
// assets
|
|
|
|
ProfileShowcaseAssetsPanel {
|
|
|
|
id: profileShowcaseAssetsPanel
|
|
|
|
baseModel: root.walletAssetsStore.groupedAccountAssetsModel // TODO: instantiate an assets model in profile module
|
|
|
|
showcaseModel: root.profileStore.profileShowcaseAssetsModel
|
|
|
|
onShowcaseEntryChanged: priv.hasAnyProfileShowcaseChanges = true
|
|
|
|
formatCurrencyAmount: function(amount, symbol) {
|
|
|
|
return root.currencyStore.formatCurrencyAmount(amount, symbol)
|
|
|
|
}
|
|
|
|
}
|
2022-11-11 16:46:35 +00:00
|
|
|
|
2024-02-04 11:50:26 +00:00
|
|
|
// web
|
|
|
|
ProfileSocialLinksPanel {
|
2022-06-22 12:16:21 +00:00
|
|
|
profileStore: root.profileStore
|
2024-02-04 11:50:26 +00:00
|
|
|
socialLinksModel: root.profileStore.temporarySocialLinksModel
|
|
|
|
}
|
2022-11-11 16:46:35 +00:00
|
|
|
|
2024-02-04 11:50:26 +00:00
|
|
|
Component {
|
|
|
|
id: changePasswordModal
|
|
|
|
ChangePasswordModal {
|
|
|
|
privacyStore: root.privacyStore
|
|
|
|
onPasswordChanged: Global.openPopup(successPopup)
|
|
|
|
}
|
2022-05-07 11:45:15 +00:00
|
|
|
}
|
2022-03-16 21:20:03 +00:00
|
|
|
|
2024-02-04 11:50:26 +00:00
|
|
|
Component {
|
|
|
|
id: successPopup
|
|
|
|
ChangePasswordSuccessModal {}
|
2023-05-23 12:46:16 +00:00
|
|
|
}
|
2020-07-21 21:03:22 +00:00
|
|
|
|
2024-02-04 11:50:26 +00:00
|
|
|
Component {
|
|
|
|
id: profilePreview
|
|
|
|
ProfileDialog {
|
|
|
|
publicKey: root.contactsStore.myPublicKey
|
|
|
|
profileStore: root.profileStore
|
|
|
|
contactsStore: root.contactsStore
|
|
|
|
networkConnectionStore: root.networkConnectionStore
|
|
|
|
communitiesModel: root.communitiesModel
|
|
|
|
onClosed: destroy()
|
|
|
|
}
|
|
|
|
}
|
2020-08-19 21:01:22 +00:00
|
|
|
}
|
|
|
|
}
|
2020-07-21 21:03:22 +00:00
|
|
|
}
|