2023-03-20 12:29:05 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
import AppLayouts.Profile.controls 1.0
|
|
|
|
|
|
|
|
ProfileShowcasePanel {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
keyRole: "id"
|
2023-11-01 16:54:22 +00:00
|
|
|
roleNames: ["id", "name", "memberRole", "image", "color"].concat(showcaseRoles)
|
|
|
|
filterFunc: (modelData) => modelData.joined && !showcaseModel.hasItemInShowcase(modelData.id)
|
2023-03-20 12:29:05 +00:00
|
|
|
hiddenPlaceholderBanner: qsTr("Communities here will show on your profile")
|
|
|
|
showcasePlaceholderBanner: qsTr("Communities here will be hidden from your profile")
|
|
|
|
|
|
|
|
draggableDelegateComponent: CommunityShowcaseDelegate {
|
|
|
|
Drag.keys: ["x-status-draggable-showcase-item-hidden"]
|
|
|
|
showcaseObj: modelData
|
|
|
|
dragParent: dragParentData
|
|
|
|
visualIndex: visualIndexData
|
|
|
|
onShowcaseVisibilityRequested: {
|
|
|
|
var tmpObj = Object()
|
|
|
|
root.roleNames.forEach(role => tmpObj[role] = showcaseObj[role])
|
|
|
|
tmpObj.showcaseVisibility = value
|
2023-11-01 16:54:22 +00:00
|
|
|
showcaseModel.upsertItemJson(JSON.stringify(tmpObj))
|
|
|
|
root.showcaseEntryChanged()
|
2023-03-20 12:29:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
showcaseDraggableDelegateComponent: CommunityShowcaseDelegate {
|
|
|
|
Drag.keys: ["x-status-draggable-showcase-item"]
|
|
|
|
showcaseObj: modelData
|
|
|
|
dragParent: dragParentData
|
|
|
|
visualIndex: visualIndexData
|
|
|
|
dragAxis: Drag.YAxis
|
|
|
|
showcaseVisibility: !!modelData ? modelData.showcaseVisibility : Constants.ShowcaseVisibility.NoOne
|
|
|
|
onShowcaseVisibilityRequested: {
|
2023-11-01 16:54:22 +00:00
|
|
|
showcaseModel.setVisibility(showcaseObj.id, value)
|
|
|
|
root.showcaseEntryChanged()
|
2023-03-20 12:29:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|