feat(Profile): Fix storybook models according backend limitations
This commit is contained in:
parent
4a4f1b8bf9
commit
532066d3a4
|
@ -30,6 +30,7 @@ SplitView {
|
|||
|
||||
ListModel {
|
||||
id: accountsModel
|
||||
|
||||
ListElement {
|
||||
name: "My Status Account"
|
||||
address: "0xcdc2ea3b6ba8fed3a3402f8db8b2fab53e7b7420"
|
||||
|
@ -60,6 +61,41 @@ SplitView {
|
|||
}
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: inShowcaseAccountsModel
|
||||
|
||||
signal baseModelFilterConditionsMayHaveChanged()
|
||||
|
||||
function setVisibilityByIndex(index, visibility) {
|
||||
if (visibility === Constants.ShowcaseVisibility.NoOne) {
|
||||
remove(index)
|
||||
} else {
|
||||
get(index).showcaseVisibility = visibility
|
||||
}
|
||||
}
|
||||
|
||||
function setVisibility(address, visibility) {
|
||||
for (let i = 0; i < count; ++i) {
|
||||
if (get(i).address === address) {
|
||||
setVisibilityByIndex(i, visibility)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hasItemInShowcase(address) {
|
||||
for (let i = 0; i < count; ++i) {
|
||||
if (get(i).address === address) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function upsertItemJson(item) {
|
||||
append(JSON.parse(item))
|
||||
}
|
||||
}
|
||||
|
||||
StatusScrollView { // wrapped in a ScrollView on purpose; to simulate SettingsContentBase.qml
|
||||
SplitView.fillWidth: true
|
||||
SplitView.preferredHeight: 500
|
||||
|
@ -67,6 +103,7 @@ SplitView {
|
|||
id: showcasePanel
|
||||
width: 500
|
||||
baseModel: accountsModel
|
||||
showcaseModel: inShowcaseAccountsModel
|
||||
currentWallet: root.currentWallet
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ SplitView {
|
|||
|
||||
ListModel {
|
||||
id: assetsModel
|
||||
|
||||
readonly property var data: [
|
||||
{
|
||||
name: "Decentraland",
|
||||
|
@ -84,6 +85,41 @@ SplitView {
|
|||
Component.onCompleted: append(data)
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: inShowcaseAssetsModel
|
||||
|
||||
signal baseModelFilterConditionsMayHaveChanged()
|
||||
|
||||
function setVisibilityByIndex(index, visibility) {
|
||||
if (visibility === Constants.ShowcaseVisibility.NoOne) {
|
||||
remove(index)
|
||||
} else {
|
||||
get(index).showcaseVisibility = visibility
|
||||
}
|
||||
}
|
||||
|
||||
function setVisibility(symbol, visibility) {
|
||||
for (let i = 0; i < count; ++i) {
|
||||
if (get(i).symbol === symbol) {
|
||||
setVisibilityByIndex(i, visibility)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hasItemInShowcase(symbol) {
|
||||
for (let i = 0; i < count; ++i) {
|
||||
if (get(i).symbol === symbol) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function upsertItemJson(item) {
|
||||
append(JSON.parse(item))
|
||||
}
|
||||
}
|
||||
|
||||
StatusScrollView { // wrapped in a ScrollView on purpose; to simulate SettingsContentBase.qml
|
||||
SplitView.fillWidth: true
|
||||
SplitView.preferredHeight: 500
|
||||
|
@ -91,6 +127,7 @@ SplitView {
|
|||
id: showcasePanel
|
||||
width: 500
|
||||
baseModel: assetsModel
|
||||
showcaseModel: inShowcaseAssetsModel
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ SplitView {
|
|||
|
||||
ListModel {
|
||||
id: collectiblesModel
|
||||
|
||||
readonly property var data: [
|
||||
{
|
||||
uid: "123",
|
||||
|
@ -82,6 +83,41 @@ SplitView {
|
|||
Component.onCompleted: append(data)
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: inShowcaseCollectiblesModel
|
||||
|
||||
signal baseModelFilterConditionsMayHaveChanged()
|
||||
|
||||
function setVisibilityByIndex(index, visibility) {
|
||||
if (visibility === Constants.ShowcaseVisibility.NoOne) {
|
||||
remove(index)
|
||||
} else {
|
||||
get(index).showcaseVisibility = visibility
|
||||
}
|
||||
}
|
||||
|
||||
function setVisibility(uid, visibility) {
|
||||
for (let i = 0; i < count; ++i) {
|
||||
if (get(i).uid === uid) {
|
||||
setVisibilityByIndex(i, visibility)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hasItemInShowcase(uid) {
|
||||
for (let i = 0; i < count; ++i) {
|
||||
if (get(i).uid === uid) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function upsertItemJson(item) {
|
||||
append(JSON.parse(item))
|
||||
}
|
||||
}
|
||||
|
||||
StatusScrollView { // wrapped in a ScrollView on purpose; to simulate SettingsContentBase.qml
|
||||
SplitView.fillWidth: true
|
||||
SplitView.preferredHeight: 500
|
||||
|
@ -89,6 +125,7 @@ SplitView {
|
|||
id: showcasePanel
|
||||
width: 500
|
||||
baseModel: collectiblesModel
|
||||
showcaseModel: inShowcaseCollectiblesModel
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ SplitView {
|
|||
|
||||
ListModel {
|
||||
id: communitiesModel
|
||||
|
||||
Component.onCompleted:
|
||||
append([{
|
||||
id: "0x0001",
|
||||
|
@ -77,6 +78,41 @@ SplitView {
|
|||
])
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: inShowcaseCommunitiesModel
|
||||
|
||||
signal baseModelFilterConditionsMayHaveChanged()
|
||||
|
||||
function setVisibilityByIndex(index, visibility) {
|
||||
if (visibility === Constants.ShowcaseVisibility.NoOne) {
|
||||
remove(index)
|
||||
} else {
|
||||
get(index).showcaseVisibility = visibility
|
||||
}
|
||||
}
|
||||
|
||||
function setVisibility(id, visibility) {
|
||||
for (let i = 0; i < count; ++i) {
|
||||
if (get(i).id === id) {
|
||||
setVisibilityByIndex(i, visibility)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hasItemInShowcase(id) {
|
||||
for (let i = 0; i < count; ++i) {
|
||||
if (get(i).id === id) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function upsertItemJson(item) {
|
||||
append(JSON.parse(item))
|
||||
}
|
||||
}
|
||||
|
||||
StatusScrollView { // wrapped in a ScrollView on purpose; to simulate SettingsContentBase.qml
|
||||
SplitView.fillWidth: true
|
||||
SplitView.preferredHeight: 500
|
||||
|
@ -84,6 +120,7 @@ SplitView {
|
|||
id: showcasePanel
|
||||
width: 500
|
||||
baseModel: communitiesModel
|
||||
showcaseModel: inShowcaseCommunitiesModel
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue