From 342510299081637936dbad9163d224a793cfd4ff Mon Sep 17 00:00:00 2001 From: Noelia Date: Mon, 26 Feb 2024 12:07:06 +0100 Subject: [PATCH] feat(ProfileShowcase): Adds drop area in collapsed headers - It adds an additional right component to `FoldableHeader.qml`. - It adds hidden button component in `hidden` foldable header. - It adds visibility buttons component in `in showcase` foldable header. Closes #13595 --- .../Profile/panels/ProfileShowcasePanel.qml | 31 +++++++++++++++++-- ui/imports/shared/controls/FoldableHeader.qml | 4 +++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/ui/app/AppLayouts/Profile/panels/ProfileShowcasePanel.qml b/ui/app/AppLayouts/Profile/panels/ProfileShowcasePanel.qml index 42c54582c0..2efc1ac665 100644 --- a/ui/app/AppLayouts/Profile/panels/ProfileShowcasePanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ProfileShowcasePanel.qml @@ -62,6 +62,9 @@ DoubleFlickableWithFolding { property bool isAnyShowcaseDragActive: false property bool isAnyHiddenDragActive: false + + property int additionalHeaderComponentWidth: 350 // by design + property int additionalHeaderComponentHeight: 40 // by design } clip: true @@ -85,6 +88,17 @@ DoubleFlickableWithFolding { width: ListView.view.width title: qsTr("In showcase") folded: root.flickable1Folded + rightAdditionalComponent: VisibilityDropAreaButtonsRow { + width: d.additionalHeaderComponentWidth + height: d.additionalHeaderComponentHeight + margins: 0 + visible: root.flickable1Folded && + (d.isAnyHiddenDragActive || + parent.containsDrag || + everyoneContainsDrag || + contactsContainsDrag || + verifiedContainsDrag) + } onToggleFolding: root.flip1Folding() } @@ -162,7 +176,6 @@ DoubleFlickableWithFolding { width: parent.width height: ProfileUtils.defaultDelegateHeight anchors.bottom: parent.bottom - visible: d.isAnyHiddenDragActive || parent.containsDrag || everyoneContainsDrag || @@ -188,6 +201,19 @@ DoubleFlickableWithFolding { width: ListView.view.width title: qsTr("Hidden") folded: root.flickable2Folded + rightAdditionalComponent: VisibilityDropAreaButton { + visible: root.flickable2Folded && (d.isAnyShowcaseDragActive || parent.containsDrag || containsDrag) + width: d.additionalHeaderComponentWidth + height: d.additionalHeaderComponentHeight + rightInset: 1 + text: qsTr("Hide") + dropAreaKeys: d.dragShowcaseItemKey + + onDropped: { + root.showcaseModel.setVisibilityByIndex(drop.source.visualIndex, visibility) + root.showcaseEntryChanged() + } + } onToggleFolding: root.flip2Folding() } @@ -337,6 +363,7 @@ DoubleFlickableWithFolding { readonly property bool everyoneContainsDrag: dropAreaEveryone.containsDrag readonly property bool contactsContainsDrag: dropAreaContacts.containsDrag readonly property bool verifiedContainsDrag: dropAreaVerified.containsDrag + property int margins: Style.current.halfPadding function dropped(drop, visibility) { var showcaseObj = drop.source.showcaseObj @@ -355,7 +382,7 @@ DoubleFlickableWithFolding { RowLayout { anchors.fill: parent - anchors.margins: Style.current.halfPadding + anchors.margins: visibilityDropAreaRow.margins spacing: Style.current.halfPadding VisibilityDropAreaButton { diff --git a/ui/imports/shared/controls/FoldableHeader.qml b/ui/imports/shared/controls/FoldableHeader.qml index 3848b45a50..a8c1435924 100644 --- a/ui/imports/shared/controls/FoldableHeader.qml +++ b/ui/imports/shared/controls/FoldableHeader.qml @@ -12,6 +12,7 @@ Rectangle { property alias title: label.text property alias switchText: modeSwitch.text property alias checked: modeSwitch.checked + property Component rightAdditionalComponent signal toggleFolding signal toggleSwitch @@ -60,5 +61,8 @@ Rectangle { font.pixelSize: 13 onToggled: root.toggleSwitch() } + Loader { + sourceComponent: root.rightAdditionalComponent + } } }