feat(ProfileShowcase): Remove unnecessary roles renamings from profile showcase models

This commit is contained in:
Alex Jbanca 2024-03-11 20:54:51 +02:00 committed by Alex Jbanca
parent b77d6ab76f
commit 7f78c03e6a
2 changed files with 8 additions and 154 deletions

View File

@ -13,31 +13,25 @@ QObject {
// Communities input models
property alias communitiesSourceModel: communitySFPM.sourceModel
property alias communitiesShowcaseModel: communityShowcaseRenaming.sourceModel
// adapted models
readonly property alias adaptedCommunitiesSourceModel: communitySFPM
readonly property alias adaptedCommunitiesShowcaseModel: communityShowcaseRenaming
// Accounts input models
property alias accountsSourceModel: accountsSFPM.sourceModel
property alias accountsShowcaseModel: accountsRenamingShowcase.sourceModel
// adapted models
readonly property alias adaptedAccountsSourceModel: accountsSFPM
readonly property alias adaptedAccountsShowcaseModel: accountsRenamingShowcase
// Collectibles input models
property alias collectiblesSourceModel: collectiblesSFPM.sourceModel
property alias collectiblesShowcaseModel: collectiblesRenamingShowcase.sourceModel
// adapted models
readonly property alias adaptedCollectiblesSourceModel: collectiblesSFPM
readonly property alias adaptedCollectiblesShowcaseModel: collectiblesRenamingShowcase
// Social links input models
property alias socialLinksSourceModel: socialLinksRoleRenaming.sourceModel
property alias socialLinksSourceModel: socialLinksSFPM.sourceModel
// adapted models
readonly property alias adaptedSocialLinksSourceModel: socialLinksSFPM
@ -52,51 +46,6 @@ QObject {
]
}
RolesRenamingModel {
id: communityShowcaseRenaming
mapping: [
RoleRename {
from: "id"
to: "showcaseKey"
},
RoleRename {
from: "order"
to: "showcasePosition"
},
// Removing model duplicates
// TODO: remove this when the lightweigth model is used
// https://github.com/status-im/status-desktop/issues/13688
RoleRename {
from: "name"
to: "_name"
},
RoleRename {
from: "memberRole"
to: "_memberRole"
},
RoleRename {
from: "image"
to: "_image"
},
RoleRename {
from: "color"
to: "_color"
},
RoleRename {
from: "description"
to: "_description"
},
RoleRename {
from: "membersCount"
to: "_membersCount"
},
RoleRename {
from: "loading"
to: "_loading"
}
]
}
SortFilterProxyModel {
id: accountsSFPM
proxyRoles: [
@ -108,35 +57,6 @@ QObject {
]
}
RolesRenamingModel {
id: accountsRenamingShowcase
mapping: [
RoleRename {
from: "address"
to: "showcaseKey"
},
RoleRename {
from: "order"
to: "showcasePosition"
},
// Removing model duplicates
// TODO: remove this when the lightweigth model is used
// https://github.com/status-im/status-desktop/issues/13688
RoleRename {
from: "name"
to: "_name"
},
RoleRename {
from: "emoji"
to: "_emoji"
},
RoleRename {
from: "colorId"
to: "_colorId"
}
]
}
SortFilterProxyModel {
id: collectiblesSFPM
proxyRoles: [
@ -148,76 +68,13 @@ QObject {
]
}
RolesRenamingModel {
id: collectiblesRenamingShowcase
mapping: [
RoleRename {
from: "uid"
to: "showcaseKey"
},
RoleRename {
from: "order"
to: "showcasePosition"
},
// Removing model duplicates
// TODO: remove this when the lightweigth model is used
// https://github.com/status-im/status-desktop/issues/13688
RoleRename {
from: "chainId"
to: "_chainId"
},
RoleRename {
from: "contractAddress"
to: "_contractAddress"
},
RoleRename {
from: "tokenId"
to: "_tokenId"
},
RoleRename {
from: "name"
to: "_name"
},
RoleRename {
from: "imageUrl"
to: "_imageUrl"
},
RoleRename {
from: "backgroundColor"
to: "_backgroundColor"
},
RoleRename {
from: "collectionName"
to: "_collectionName"
},
RoleRename {
from: "isLoading"
to: "_isLoading"
},
RoleRename {
from: "communityId"
to: "_communityId"
}
]
}
RolesRenamingModel {
id: socialLinksRoleRenaming
mapping: [
RoleRename {
from: "uuid"
to: "showcaseKey"
}
]
}
SortFilterProxyModel {
id: socialLinksSFPM
sourceModel: socialLinksRoleRenaming
proxyRoles: [
FastExpressionRole {
name: "showcasePosition"
expression: index
name: "showcaseKey"
expression: model.url
expectedRoles: ["url"]
},
FastExpressionRole {
name: "showcaseVisibility"

View File

@ -24,7 +24,7 @@ QObject {
// Input models
property alias communitiesSourceModel: modelAdapter.communitiesSourceModel
property alias communitiesShowcaseModel: modelAdapter.communitiesShowcaseModel
property alias communitiesShowcaseModel: communities.showcaseModel
property string communitiesSearcherText
// Output models
@ -48,7 +48,7 @@ QObject {
// Input models
property alias accountsSourceModel: modelAdapter.accountsSourceModel
property alias accountsShowcaseModel: modelAdapter.accountsShowcaseModel
property alias accountsShowcaseModel: accounts.showcaseModel
property string accountsSearcherText
// Output models
@ -79,7 +79,7 @@ QObject {
// Input models
property alias collectiblesSourceModel: modelAdapter.collectiblesSourceModel
property alias collectiblesShowcaseModel: modelAdapter.collectiblesShowcaseModel
property alias collectiblesShowcaseModel: collectibles.showcaseModel
property string collectiblesSearcherText
// Output models
@ -151,7 +151,6 @@ QObject {
}
sourceModel: modelAdapter.adaptedCommunitiesSourceModel
showcaseModel: modelAdapter.adaptedCommunitiesShowcaseModel
searcherFilter: FastExpressionFilter {
expression: {
root.communitiesSearcherText
@ -166,7 +165,6 @@ QObject {
id: accounts
sourceModel: modelAdapter.adaptedAccountsSourceModel
showcaseModel: modelAdapter.adaptedAccountsShowcaseModel
searcherFilter: FastExpressionFilter {
expression: {
root.accountsSearcherText
@ -181,7 +179,6 @@ QObject {
id: collectibles
sourceModel: collectiblesFilter
showcaseModel: modelAdapter.adaptedCollectiblesShowcaseModel
searcherFilter: FastExpressionFilter {
expression: {
root.collectiblesSearcherText