chore(ProfileShowcase): Cherry-pick profile showcase loading state

https://github.com/status-im/status-desktop/pull/14260
This commit is contained in:
Alex Jbanca 2024-04-08 13:55:09 +03:00 committed by Jonathan Rainville
parent 9cad3db60f
commit 32d70c1715
7 changed files with 17 additions and 5 deletions

View File

@ -338,9 +338,9 @@ method requestProfileShowcase*(self: Module, publicKey: string) =
if self.showcasePublicKey != publicKey:
self.view.clearShowcaseModels()
self.showcasePublicKey = publicKey
self.showcaseForAContactLoading = true
self.view.emitShowcaseForAContactLoadingChangedSignal()
self.controller.requestProfileShowcaseForContact(publicKey, false)
method onProfileShowcaseUpdated(self: Module, publicKey: string) =

View File

@ -278,9 +278,9 @@ QtObject:
proc showcaseForAContactLoadingChanged*(self: View) {.signal.}
proc emitShowcaseForAContactLoadingChangedSignal*(self: View) =
self.showcaseForAContactLoadingChanged()
proc isShowcaseForAContactLoading*(self: View): bool {.signal.} =
proc isShowcaseForAContactLoading*(self: View): bool {.slot.} =
return self.delegate.isShowcaseForAContactLoading()
QtProperty[QVariant] showcaseForAContactLoading:
QtProperty[bool] showcaseForAContactLoading:
read = isShowcaseForAContactLoading
notify = showcaseForAContactLoadingChanged

View File

@ -26,6 +26,7 @@ QObject {
//helpers
property var isAddressSaved: (address) => false
property bool isShowcaseLoading: false
// Collectibles input models
property alias collectiblesSourceModel: collectiblesSFPM.sourceModel
@ -65,6 +66,10 @@ QObject {
function getShowcaseVisibility() {
return Constants.ShowcaseVisibility.Everyone
}
},
FastExpressionRole {
name: "isShowcaseLoading"
expression: root.isShowcaseLoading
}
]
}

View File

@ -57,6 +57,10 @@ QObject {
name: "membersCount"
expression: model.members.count
expectedRoles: ["members"]
},
FastExpressionRole {
name: "isShowcaseLoading"
expression: false
}
]
filters: ValueFilter {

View File

@ -25,6 +25,8 @@ QtObject {
readonly property var showcaseContactAssetsModel: contactsModule.showcaseContactAssetsModel
readonly property var showcaseContactSocialLinksModel: contactsModule.showcaseContactSocialLinksModel
readonly property bool isShowcaseForAContactLoading: contactsModule.showcaseForAContactLoading
// Support models for showcase for a contact with showcasePublicKey
readonly property var showcaseCollectiblesModel: contactsModule.showcaseCollectiblesModel

View File

@ -201,6 +201,7 @@ QtObject {
isAddressSaved: (address) => {
return false
}
isShowcaseLoading: root.contactsStore.isShowcaseForAContactLoading
}
}

View File

@ -54,7 +54,7 @@ Item {
implicitHeight: GridView.view.cellHeight - Style.current.padding
titleFontSize: 15
communityId: model.id ?? ""
loaded: !!model.id
loaded: !!model.id && !model.isShowcaseLoading
asset.source: model.image ?? ""
asset.isImage: !!model.image
asset.width: 32