diff --git a/ui/app/AppLayouts/Profile/controls/ShowcaseDelegate.qml b/ui/app/AppLayouts/Profile/controls/ShowcaseDelegate.qml index e8b5d33ce6..7008afc5b4 100644 --- a/ui/app/AppLayouts/Profile/controls/ShowcaseDelegate.qml +++ b/ui/app/AppLayouts/Profile/controls/ShowcaseDelegate.qml @@ -19,7 +19,10 @@ StatusDraggableListItem { id: root property alias actionComponent: additionalActionsLoader.sourceComponent + property int showcaseVisibility: Constants.ShowcaseVisibility.NoOne + property int showcaseMaxVisibility: Constants.ShowcaseVisibility.Everyone + property bool blurState: false property bool contextMenuEnabled: true property string tooltipTextWhenContextMenuDisabled @@ -27,9 +30,15 @@ StatusDraggableListItem { signal showcaseVisibilityRequested(int value) component ShowcaseVisibilityAction: StatusMenuItem { - property int showcaseVisibility: Constants.ShowcaseVisibility.NoOne + id: menuItem + required property int showcaseVisibility + + ButtonGroup.group: showcaseVisibilityGroup icon.name: ProfileUtils.visibilityIcon(showcaseVisibility) icon.color: Theme.palette.primaryColor1 + checked: root.showcaseVisibility === showcaseVisibility + + enabled: root.showcaseMaxVisibility >= showcaseVisibility } layer.enabled: root.blurState @@ -87,32 +96,32 @@ StatusDraggableListItem { onClosed: menuLoader.active = false StatusMenuHeadline { text: qsTr("Show to") } + Binding on width { + value: Math.max(implicitWidth, everyoneAction.implicitWidth, contactsAction.implicitWidth, idVerifiedContactsAction.implicitWidth) + margins * 2 + delayed: true + } + ShowcaseVisibilityAction { - ButtonGroup.group: showcaseVisibilityGroup + id: everyoneAction showcaseVisibility: Constants.ShowcaseVisibility.Everyone - text: qsTr("Everyone") - checked: root.showcaseVisibility === showcaseVisibility + text: enabled ? qsTr("Everyone") : qsTr("Everyone (set account to Everyone)") } ShowcaseVisibilityAction { - ButtonGroup.group: showcaseVisibilityGroup + id: contactsAction showcaseVisibility: Constants.ShowcaseVisibility.Contacts - text: qsTr("Contacts") - checked: root.showcaseVisibility === showcaseVisibility + text: enabled ? qsTr("Contacts") : qsTr("Contacts (set account to Contacts)") } ShowcaseVisibilityAction { - ButtonGroup.group: showcaseVisibilityGroup + id: idVerifiedContactsAction showcaseVisibility: Constants.ShowcaseVisibility.IdVerifiedContacts - text: qsTr("ID verified contacts") - checked: root.showcaseVisibility === showcaseVisibility + text: enabled ? qsTr("ID verified contacts") : qsTr("ID verified contacts (set account to ID verified contacts)") } StatusMenuSeparator {} ShowcaseVisibilityAction { - ButtonGroup.group: showcaseVisibilityGroup showcaseVisibility: Constants.ShowcaseVisibility.NoOne text: qsTr("No one") - checked: root.showcaseVisibility === showcaseVisibility } } } diff --git a/ui/app/AppLayouts/Profile/panels/ProfileShowcaseCollectiblesPanel.qml b/ui/app/AppLayouts/Profile/panels/ProfileShowcaseCollectiblesPanel.qml index 1cf52c6a70..e46ce40659 100644 --- a/ui/app/AppLayouts/Profile/panels/ProfileShowcaseCollectiblesPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ProfileShowcaseCollectiblesPanel.qml @@ -25,6 +25,7 @@ ProfileShowcasePanel { additionalFooterComponent: root.addAccountsButtonVisible ? addMoreAccountsComponent : null delegate: ProfileShowcasePanelDelegate { + id: delegate title: !!model ? `${model.name}` || `#${model.id}` : "" secondaryTitle: !!model && !!model.collectionName ? model.collectionName : "" hasImage: !!model && !!model.imageUrl @@ -34,6 +35,12 @@ ProfileShowcasePanel { assetBgColor: !!model && !!model.backgroundColor ? model.backgroundColor : "transparent" 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 { id: communityTokenTagComponent diff --git a/ui/app/AppLayouts/Profile/panels/ProfileShowcasePanel.qml b/ui/app/AppLayouts/Profile/panels/ProfileShowcasePanel.qml index 34562b5c1a..961f109071 100644 --- a/ui/app/AppLayouts/Profile/panels/ProfileShowcasePanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ProfileShowcasePanel.qml @@ -69,6 +69,8 @@ DoubleFlickableWithFolding { property bool startAnimation: false + property var dragItem: null + signal setVisibilityInternalRequested(var key, int toVisibility) onSetVisibilityInternalRequested: { if(toVisibility !== Constants.ShowcaseVisibility.NoOne) { @@ -297,6 +299,7 @@ DoubleFlickableWithFolding { height: ProfileUtils.defaultDelegateHeight - Style.current.padding text: qsTr("Hide") dropAreaKeys: d.dragShowcaseItemKey + } } } @@ -316,6 +319,8 @@ DoubleFlickableWithFolding { icon.color: Theme.palette.primaryColor1 + visible: d.dragItem && d.dragItem.showcaseMaxVisibility >= showcaseVisibility + background: ShapeRectangle { 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) @@ -503,6 +508,14 @@ DoubleFlickableWithFolding { 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: ShadowDelegate { id: showcaseShadow