2023-02-28 15:00:10 +00:00
import QtQuick 2.15
import QtQuick . Controls 2.15
import QtQuick . Layouts 1.15
2024-02-27 17:11:03 +00:00
import QtQml . Models 2.15
2023-02-28 15:00:10 +00:00
2024-03-14 17:31:38 +00:00
import StatusQ 0.1
2023-02-28 15:00:10 +00:00
import StatusQ . Core 0.1
import StatusQ . Core . Theme 0.1
import StatusQ . Controls 0.1
import StatusQ . Components 0.1
import StatusQ . Popups . Dialog 0.1
import StatusQ . Core . Utils 0.1 as StatusQUtils
2024-02-15 09:25:40 +00:00
import SortFilterProxyModel 0.2
2023-02-28 15:00:10 +00:00
import utils 1.0
2024-05-22 08:13:39 +00:00
import AppLayouts . Wallet . stores 1.0 as WalletStores
2023-02-28 15:00:10 +00:00
Control {
id: root
property alias currentTabIndex: stackLayout . currentIndex
2024-03-25 13:29:31 +00:00
property int maxVisibility: Constants . ShowcaseVisibility . Everyone
2024-03-29 11:43:49 +00:00
property alias communitiesModel: communitiesProxyModel . sourceModel
property alias accountsModel: accountsProxyModel . sourceModel
property alias collectiblesModel: collectiblesProxyModel . sourceModel
property alias assetsModel: assetsProxyModel . sourceModel
property alias socialLinksModel: socialLinksProxyModel . sourceModel
2024-02-15 09:25:40 +00:00
property var globalAssetsModel
property var globalCollectiblesModel
2024-05-22 08:13:39 +00:00
property WalletStores . RootStore walletStore
2024-02-27 17:11:03 +00:00
2024-03-29 11:43:49 +00:00
required property string mainDisplayName
required property bool readOnly
required property bool sendToAccountEnabled
2024-02-15 09:25:40 +00:00
2023-02-28 15:00:10 +00:00
signal closeRequested ( )
2024-03-29 11:43:49 +00:00
signal copyToClipboard ( string text )
2023-10-31 15:26:15 +00:00
2023-02-28 15:00:10 +00:00
horizontalPadding: readOnly ? 20 : 40 // smaller in settings/preview
topPadding: Style . current . bigPadding
2024-03-14 17:31:38 +00:00
StatusQUtils . QObject {
2023-02-28 15:00:10 +00:00
id: d
2024-02-15 09:25:40 +00:00
property int delegateWidthS: 152
property int delegateHeightS: 152
property int delegateWidthM: 202
property int delegateHeightM: 160
2024-05-14 08:15:15 +00:00
readonly property string displayNameVerySmallEmoji: StatusQUtils . Emoji . parse ( root . mainDisplayName , StatusQUtils . Emoji . size . verySmall )
2024-03-29 11:43:49 +00:00
}
2023-02-28 15:00:10 +00:00
2024-03-29 11:43:49 +00:00
component PositionSFPM: SortFilterProxyModel {
sorters: [
RoleSorter {
roleName: "showcasePosition"
}
]
2024-03-25 13:29:31 +00:00
filters: [
AnyOf {
inverted: true
UndefinedFilter {
roleName: "showcaseVisibility"
}
ValueFilter {
roleName: "showcaseVisibility"
value: Constants . ShowcaseVisibility . NoOne
}
} ,
FastExpressionFilter {
expression: model . showcaseVisibility >= root . maxVisibility
expectedRoles: [ "showcaseVisibility" ]
2024-03-14 17:31:38 +00:00
}
2024-03-25 13:29:31 +00:00
]
}
2024-03-29 11:43:49 +00:00
PositionSFPM {
id: communitiesProxyModel
}
PositionSFPM {
id: accountsProxyModel
}
PositionSFPM {
id: collectiblesProxyModel
}
PositionSFPM {
id: assetsProxyModel
}
PositionSFPM {
id: socialLinksProxyModel
2023-02-28 15:00:10 +00:00
}
background: StatusDialogBackground {
color: Theme . palette . baseColor4
Rectangle {
anchors.left: parent . left
anchors.right: parent . right
anchors.top: parent . top
height: parent . radius
color: parent . color
}
2024-02-15 09:25:40 +00:00
Rectangle {
anchors.left: parent . left
anchors.right: parent . right
anchors.top: parent . top
height: 1
color: Theme . palette . baseColor2
}
2023-02-28 15:00:10 +00:00
}
contentItem: StackLayout {
id: stackLayout
2024-02-27 17:11:03 +00:00
2024-02-15 09:25:40 +00:00
anchors.fill: parent
2024-02-27 17:11:03 +00:00
ProfileShowcaseCommunitiesView {
2024-02-15 09:25:40 +00:00
width: parent . width
height: parent . height
2024-02-27 17:11:03 +00:00
cellWidth: d . delegateWidthM
cellHeight: d . delegateHeightM
2024-02-15 09:25:40 +00:00
2024-05-14 08:15:15 +00:00
mainDisplayName: d . displayNameVerySmallEmoji
2024-02-27 17:11:03 +00:00
readOnly: root . readOnly
globalAssetsModel: root . globalAssetsModel
globalCollectiblesModel: root . globalCollectiblesModel
communitiesProxyModel: communitiesProxyModel
onCloseRequested: root . closeRequested ( )
onCopyToClipboard: root . copyToClipboard ( text )
2023-02-28 15:00:10 +00:00
}
2024-02-27 17:11:03 +00:00
ProfileShowcaseAccountsView {
2024-02-15 09:25:40 +00:00
width: parent . width
height: parent . height
2024-02-27 17:11:03 +00:00
2024-05-14 08:15:15 +00:00
mainDisplayName: d . displayNameVerySmallEmoji
2024-02-27 17:11:03 +00:00
sendToAccountEnabled: root . sendToAccountEnabled
accountsModel: accountsProxyModel
walletStore: root . walletStore
cellWidth: d . delegateWidthM
cellHeight: d . delegateHeightM
onCopyToClipboard: root . copyToClipboard ( text )
2023-02-28 15:00:10 +00:00
}
2024-02-27 17:11:03 +00:00
ProfileShowcaseCollectiblesView {
width: parent . width
height: parent . height
2024-02-15 09:25:40 +00:00
2024-02-27 17:11:03 +00:00
cellWidth: d . delegateWidthS
cellHeight: d . delegateHeightS
2023-02-28 15:00:10 +00:00
2024-05-14 08:15:15 +00:00
mainDisplayName: d . displayNameVerySmallEmoji
2024-02-27 17:11:03 +00:00
collectiblesModel: collectiblesProxyModel
walletStore: root . walletStore
2023-02-28 15:00:10 +00:00
2024-02-27 17:11:03 +00:00
onCloseRequested: root . closeRequested ( )
onVisitCommunity: {
Global . openPopup ( visitComunityPopupComponent , { communityId: model . communityId , communityName: model . communityName ,
communityLogo: model . communityImage , tokenName: model . name ,
tokenImage: model . imageUrl , isAssetType: false } ) ;
2023-02-28 15:00:10 +00:00
}
}
2024-02-27 17:11:03 +00:00
// ProfileShowcaseAssetsView {
// width: parent.width
// height: parent.height
// mainDisplayName: root.mainDisplayName
// assetsModel: assetsProxyModel
// sendToAccountEnabled: root.sendToAccountEnabled
// delegatesActionsMenu: delegatesActionsMenu
// cellHeight: d.delegateHeightS
// cellWidth: d.delegateWidthS
// onCloseRequested: root.closeRequested()
// onVisitCommunity: {
// Global.openPopup(visitComunityPopupComponent, {communityId: model.communityId, communityName: model.communityName,
// communityLogo: model.communityImage, tokenName: model.name,
// tokenImage: Constants.tokenIcon(model.symbol), isAssetType: false });
// }
2024-02-15 09:25:40 +00:00
// }
2024-02-27 17:11:03 +00:00
ProfileShowcaseSocialLinksView {
width: parent . width
height: parent . height
2023-02-28 15:00:10 +00:00
2024-02-27 17:11:03 +00:00
cellWidth: d . delegateWidthS
cellHeight: d . delegateHeightS
2024-05-14 08:15:15 +00:00
mainDisplayName: d . displayNameVerySmallEmoji
2024-02-27 17:11:03 +00:00
socialLinksModel: socialLinksProxyModel
onCopyToClipboard: root . copyToClipboard ( text )
}
}
Component {
id: visitComunityPopupComponent
StatusDialog {
id: visitComunityPopup
// Community related props:
property string communityId
property string communityName
property string communityLogo
// Token related props:
property string tokenName
property string tokenImage
property bool isAssetType: false
width: 521 // by design
padding: 0
contentItem: StatusScrollView {
id: scrollView
padding: Style . current . padding
contentWidth: availableWidth
ColumnLayout {
width: scrollView . availableWidth
spacing: Style . current . padding
StatusBaseText {
Layout.fillWidth: true
text: visitComunityPopup . isAssetType ? qsTr ( "%1 is a community minted asset. Would you like to visit the community that minted it?" ) . arg ( visitComunityPopup . tokenName ) :
qsTr ( "%1 is a community minted collectible. Would you like to visit the community that minted it?" ) . arg ( visitComunityPopup . tokenName )
textFormat: Text . RichText
wrapMode: Text . WrapAtWordBoundaryOrAnywhere
lineHeight: 1.2
}
// Navigate to community button
StatusListItem {
Layout.fillWidth: true
Layout.bottomMargin: Style . current . halfPadding
title: visitComunityPopup . communityName
border.color: Theme . palette . baseColor2
asset.name: visitComunityPopup . communityLogo
asset.isImage: true
asset.isLetterIdenticon: ! asset . name
components: [
RowLayout {
StatusIcon {
Layout.alignment: Qt . AlignVCenter
icon: "arrow-right"
color: Theme . palette . primaryColor1
}
StatusBaseText {
Layout.alignment: Qt . AlignVCenter
Layout.rightMargin: Style . current . padding
text: visitComunityPopup . tokenName
font.pixelSize: Style . current . additionalTextSize
color: Theme . palette . primaryColor1
2024-02-15 09:25:40 +00:00
}
}
2024-02-27 17:11:03 +00:00
]
onClicked: {
Global . switchToCommunity ( visitComunityPopup . communityId ) ;
visitComunityPopup . close ( ) ;
root . closeRequested ( ) ;
2024-02-15 09:25:40 +00:00
}
}
}
2024-02-27 17:11:03 +00:00
}
2024-02-15 09:25:40 +00:00
2024-02-27 17:11:03 +00:00
header: StatusDialogHeader {
leftComponent: StatusRoundedImage {
Layout.alignment: Qt . AlignHCenter
Layout.margins: Style . current . padding
Layout.preferredWidth: 68
Layout.preferredHeight: Layout . preferredWidth
radius: visitComunityPopup . isAssetType ? width / 2 : 8
image.source: visitComunityPopup . tokenImage
showLoadingIndicator: false
image.fillMode: Image . PreserveAspectCrop
}
headline.title: visitComunityPopup . tokenName
headline.subtitle: qsTr ( "Minted by %1" ) . arg ( visitComunityPopup . communityName )
actions.closeButton.onClicked: { visitComunityPopup . close ( ) ; }
}
footer: StatusDialogFooter {
spacing: Style . current . padding
rightButtons: ObjectModel {
StatusFlatButton {
text: qsTr ( "Cancel" )
onClicked: {
visitComunityPopup . close ( ) ;
2023-02-28 15:00:10 +00:00
}
}
}
}
}
}
}