status-desktop/ui/app/AppLayouts/Profile/panels/ProfileShowcaseAccountsPane...

46 lines
1.8 KiB
QML
Raw Normal View History

import QtQuick 2.15
import utils 1.0
import AppLayouts.Profile.controls 1.0
ProfileShowcasePanel {
id: root
property string currentWallet
keyRole: "address"
roleNames: ["address", "name", "walletType", "emoji", "colorId"].concat(showcaseRoles)
filterFunc: (modelData) => modelData.walletType !== Constants.keyWalletType && !showcaseModel.hasItemInShowcase(modelData.address)
emptyInShowcasePlaceholderText: qsTr("Accounts here will show on your profile")
emptyHiddenPlaceholderText: qsTr("Accounts here will be hidden from your profile")
hiddenDraggableDelegateComponent: AccountShowcaseDelegate {
Drag.keys: ["x-status-draggable-showcase-item-hidden"]
showcaseObj: modelData
dragParent: dragParentData
visualIndex: visualIndexData
highlighted: !!modelData && modelData.address === root.currentWallet
onShowcaseVisibilityRequested: {
var tmpObj = Object()
root.roleNames.forEach(role => tmpObj[role] = showcaseObj[role])
tmpObj.showcaseVisibility = value
showcaseModel.upsertItemJson(JSON.stringify(tmpObj))
root.showcaseEntryChanged()
}
}
showcaseDraggableDelegateComponent: AccountShowcaseDelegate {
Drag.keys: ["x-status-draggable-showcase-item"]
showcaseObj: modelData
dragParent: dragParentData
visualIndex: visualIndexData
highlighted: !!modelData && modelData.address === root.currentWallet
dragAxis: Drag.YAxis
showcaseVisibility: !!modelData ? modelData.showcaseVisibility : Constants.ShowcaseVisibility.NoOne
onShowcaseVisibilityRequested: {
showcaseModel.setVisibility(showcaseObj.address, value)
root.showcaseEntryChanged()
}
}
}