feat(profileShowcase): Sync collectibles context menu with account visibility
This commit is contained in:
parent
9596e3c7aa
commit
24d6c6d273
|
@ -19,7 +19,10 @@ StatusDraggableListItem {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property alias actionComponent: additionalActionsLoader.sourceComponent
|
property alias actionComponent: additionalActionsLoader.sourceComponent
|
||||||
|
|
||||||
property int showcaseVisibility: Constants.ShowcaseVisibility.NoOne
|
property int showcaseVisibility: Constants.ShowcaseVisibility.NoOne
|
||||||
|
property int showcaseMaxVisibility: Constants.ShowcaseVisibility.Everyone
|
||||||
|
|
||||||
property bool blurState: false
|
property bool blurState: false
|
||||||
property bool contextMenuEnabled: true
|
property bool contextMenuEnabled: true
|
||||||
property string tooltipTextWhenContextMenuDisabled
|
property string tooltipTextWhenContextMenuDisabled
|
||||||
|
@ -27,9 +30,15 @@ StatusDraggableListItem {
|
||||||
signal showcaseVisibilityRequested(int value)
|
signal showcaseVisibilityRequested(int value)
|
||||||
|
|
||||||
component ShowcaseVisibilityAction: StatusMenuItem {
|
component ShowcaseVisibilityAction: StatusMenuItem {
|
||||||
property int showcaseVisibility: Constants.ShowcaseVisibility.NoOne
|
id: menuItem
|
||||||
|
required property int showcaseVisibility
|
||||||
|
|
||||||
|
ButtonGroup.group: showcaseVisibilityGroup
|
||||||
icon.name: ProfileUtils.visibilityIcon(showcaseVisibility)
|
icon.name: ProfileUtils.visibilityIcon(showcaseVisibility)
|
||||||
icon.color: Theme.palette.primaryColor1
|
icon.color: Theme.palette.primaryColor1
|
||||||
|
checked: root.showcaseVisibility === showcaseVisibility
|
||||||
|
|
||||||
|
enabled: root.showcaseMaxVisibility >= showcaseVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
layer.enabled: root.blurState
|
layer.enabled: root.blurState
|
||||||
|
@ -87,32 +96,32 @@ StatusDraggableListItem {
|
||||||
onClosed: menuLoader.active = false
|
onClosed: menuLoader.active = false
|
||||||
StatusMenuHeadline { text: qsTr("Show to") }
|
StatusMenuHeadline { text: qsTr("Show to") }
|
||||||
|
|
||||||
|
Binding on width {
|
||||||
|
value: Math.max(implicitWidth, everyoneAction.implicitWidth, contactsAction.implicitWidth, idVerifiedContactsAction.implicitWidth) + margins * 2
|
||||||
|
delayed: true
|
||||||
|
}
|
||||||
|
|
||||||
ShowcaseVisibilityAction {
|
ShowcaseVisibilityAction {
|
||||||
ButtonGroup.group: showcaseVisibilityGroup
|
id: everyoneAction
|
||||||
showcaseVisibility: Constants.ShowcaseVisibility.Everyone
|
showcaseVisibility: Constants.ShowcaseVisibility.Everyone
|
||||||
text: qsTr("Everyone")
|
text: enabled ? qsTr("Everyone") : qsTr("Everyone (set account to Everyone)")
|
||||||
checked: root.showcaseVisibility === showcaseVisibility
|
|
||||||
}
|
}
|
||||||
ShowcaseVisibilityAction {
|
ShowcaseVisibilityAction {
|
||||||
ButtonGroup.group: showcaseVisibilityGroup
|
id: contactsAction
|
||||||
showcaseVisibility: Constants.ShowcaseVisibility.Contacts
|
showcaseVisibility: Constants.ShowcaseVisibility.Contacts
|
||||||
text: qsTr("Contacts")
|
text: enabled ? qsTr("Contacts") : qsTr("Contacts (set account to Contacts)")
|
||||||
checked: root.showcaseVisibility === showcaseVisibility
|
|
||||||
}
|
}
|
||||||
ShowcaseVisibilityAction {
|
ShowcaseVisibilityAction {
|
||||||
ButtonGroup.group: showcaseVisibilityGroup
|
id: idVerifiedContactsAction
|
||||||
showcaseVisibility: Constants.ShowcaseVisibility.IdVerifiedContacts
|
showcaseVisibility: Constants.ShowcaseVisibility.IdVerifiedContacts
|
||||||
text: qsTr("ID verified contacts")
|
text: enabled ? qsTr("ID verified contacts") : qsTr("ID verified contacts (set account to ID verified contacts)")
|
||||||
checked: root.showcaseVisibility === showcaseVisibility
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusMenuSeparator {}
|
StatusMenuSeparator {}
|
||||||
|
|
||||||
ShowcaseVisibilityAction {
|
ShowcaseVisibilityAction {
|
||||||
ButtonGroup.group: showcaseVisibilityGroup
|
|
||||||
showcaseVisibility: Constants.ShowcaseVisibility.NoOne
|
showcaseVisibility: Constants.ShowcaseVisibility.NoOne
|
||||||
text: qsTr("No one")
|
text: qsTr("No one")
|
||||||
checked: root.showcaseVisibility === showcaseVisibility
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ ProfileShowcasePanel {
|
||||||
additionalFooterComponent: root.addAccountsButtonVisible ? addMoreAccountsComponent : null
|
additionalFooterComponent: root.addAccountsButtonVisible ? addMoreAccountsComponent : null
|
||||||
|
|
||||||
delegate: ProfileShowcasePanelDelegate {
|
delegate: ProfileShowcasePanelDelegate {
|
||||||
|
id: delegate
|
||||||
title: !!model ? `${model.name}` || `#${model.id}` : ""
|
title: !!model ? `${model.name}` || `#${model.id}` : ""
|
||||||
secondaryTitle: !!model && !!model.collectionName ? model.collectionName : ""
|
secondaryTitle: !!model && !!model.collectionName ? model.collectionName : ""
|
||||||
hasImage: !!model && !!model.imageUrl
|
hasImage: !!model && !!model.imageUrl
|
||||||
|
@ -34,6 +35,12 @@ ProfileShowcasePanel {
|
||||||
assetBgColor: !!model && !!model.backgroundColor ? model.backgroundColor : "transparent"
|
assetBgColor: !!model && !!model.backgroundColor ? model.backgroundColor : "transparent"
|
||||||
|
|
||||||
actionComponent: model && !!model.communityId ? communityTokenTagComponent : null
|
actionComponent: model && !!model.communityId ? communityTokenTagComponent : null
|
||||||
|
showcaseMaxVisibility: model ? model.maxVisibility : Constants.ShowcaseVisibility.Everyone
|
||||||
|
onShowcaseMaxVisibilityChanged: {
|
||||||
|
if (delegate.showcaseVisibility > delegate.showcaseMaxVisibility) {
|
||||||
|
root.setVisibilityRequested(delegate.key, delegate.showcaseMaxVisibility)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: communityTokenTagComponent
|
id: communityTokenTagComponent
|
||||||
|
|
|
@ -69,6 +69,8 @@ DoubleFlickableWithFolding {
|
||||||
|
|
||||||
property bool startAnimation: false
|
property bool startAnimation: false
|
||||||
|
|
||||||
|
property var dragItem: null
|
||||||
|
|
||||||
signal setVisibilityInternalRequested(var key, int toVisibility)
|
signal setVisibilityInternalRequested(var key, int toVisibility)
|
||||||
onSetVisibilityInternalRequested: {
|
onSetVisibilityInternalRequested: {
|
||||||
if(toVisibility !== Constants.ShowcaseVisibility.NoOne) {
|
if(toVisibility !== Constants.ShowcaseVisibility.NoOne) {
|
||||||
|
@ -297,6 +299,7 @@ DoubleFlickableWithFolding {
|
||||||
height: ProfileUtils.defaultDelegateHeight - Style.current.padding
|
height: ProfileUtils.defaultDelegateHeight - Style.current.padding
|
||||||
text: qsTr("Hide")
|
text: qsTr("Hide")
|
||||||
dropAreaKeys: d.dragShowcaseItemKey
|
dropAreaKeys: d.dragShowcaseItemKey
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -316,6 +319,8 @@ DoubleFlickableWithFolding {
|
||||||
|
|
||||||
icon.color: Theme.palette.primaryColor1
|
icon.color: Theme.palette.primaryColor1
|
||||||
|
|
||||||
|
visible: d.dragItem && d.dragItem.showcaseMaxVisibility >= showcaseVisibility
|
||||||
|
|
||||||
background: ShapeRectangle {
|
background: ShapeRectangle {
|
||||||
path.strokeColor: dropArea.containsDrag ? Theme.palette.primaryColor2 : Theme.palette.directColor7
|
path.strokeColor: dropArea.containsDrag ? Theme.palette.primaryColor2 : Theme.palette.directColor7
|
||||||
path.fillColor: dropArea.containsDrag ? Theme.palette.primaryColor3 : Theme.palette.getColor(Theme.palette.baseColor4, 0.7)
|
path.fillColor: dropArea.containsDrag ? Theme.palette.primaryColor3 : Theme.palette.getColor(Theme.palette.baseColor4, 0.7)
|
||||||
|
@ -503,6 +508,14 @@ DoubleFlickableWithFolding {
|
||||||
restoreMode: Binding.RestoreBindingOrValue
|
restoreMode: Binding.RestoreBindingOrValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binding {
|
||||||
|
when: showcaseDraggableDelegateLoader.item && showcaseDraggableDelegateLoader.item.dragActive
|
||||||
|
target: d
|
||||||
|
property: "dragItem"
|
||||||
|
value: showcaseDraggableDelegateLoader.item
|
||||||
|
restoreMode: Binding.RestoreBindingOrValue
|
||||||
|
}
|
||||||
|
|
||||||
// Delegate shadow background when dragging:
|
// Delegate shadow background when dragging:
|
||||||
ShadowDelegate {
|
ShadowDelegate {
|
||||||
id: showcaseShadow
|
id: showcaseShadow
|
||||||
|
|
Loading…
Reference in New Issue