status-desktop/ui/app/AppLayouts/Profile/panels/ProfileShowcaseAccountsPanel.qml
Mikhail Rogachev c7c5ec340d
feat(Profile): Profile showcase backend (#12510)
* feat(Profile): simplified approach to reuse existing models with profile

* feat(Profile): adapt nim models for view actions (move and change visibility)

* feat(Profile): save profile showcasse model changes to the db

* feat(Profile): update profile showcase models on changes from status-go

* feat(Profile): Various bug fixes for profile showcase

* fix(Profile): Fixes storing profile order and review fixes

* chore(Profile): Rename and minimise signals for updating base model filters
2023-11-01 20:54:22 +04:00

46 lines
1.7 KiB
QML

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)
hiddenPlaceholderBanner: qsTr("Accounts here will show on your profile")
showcasePlaceholderBanner: qsTr("Accounts here will be hidden from your profile")
draggableDelegateComponent: 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()
}
}
}