mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-19 18:18:38 +00:00
feat(Profile): Fix storybook models according backend limitations
This commit is contained in:
parent
4a4f1b8bf9
commit
532066d3a4
@ -30,6 +30,7 @@ SplitView {
|
|||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
id: accountsModel
|
id: accountsModel
|
||||||
|
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "My Status Account"
|
name: "My Status Account"
|
||||||
address: "0xcdc2ea3b6ba8fed3a3402f8db8b2fab53e7b7420"
|
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
|
StatusScrollView { // wrapped in a ScrollView on purpose; to simulate SettingsContentBase.qml
|
||||||
SplitView.fillWidth: true
|
SplitView.fillWidth: true
|
||||||
SplitView.preferredHeight: 500
|
SplitView.preferredHeight: 500
|
||||||
@ -67,6 +103,7 @@ SplitView {
|
|||||||
id: showcasePanel
|
id: showcasePanel
|
||||||
width: 500
|
width: 500
|
||||||
baseModel: accountsModel
|
baseModel: accountsModel
|
||||||
|
showcaseModel: inShowcaseAccountsModel
|
||||||
currentWallet: root.currentWallet
|
currentWallet: root.currentWallet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ SplitView {
|
|||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
id: assetsModel
|
id: assetsModel
|
||||||
|
|
||||||
readonly property var data: [
|
readonly property var data: [
|
||||||
{
|
{
|
||||||
name: "Decentraland",
|
name: "Decentraland",
|
||||||
@ -84,6 +85,41 @@ SplitView {
|
|||||||
Component.onCompleted: append(data)
|
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
|
StatusScrollView { // wrapped in a ScrollView on purpose; to simulate SettingsContentBase.qml
|
||||||
SplitView.fillWidth: true
|
SplitView.fillWidth: true
|
||||||
SplitView.preferredHeight: 500
|
SplitView.preferredHeight: 500
|
||||||
@ -91,6 +127,7 @@ SplitView {
|
|||||||
id: showcasePanel
|
id: showcasePanel
|
||||||
width: 500
|
width: 500
|
||||||
baseModel: assetsModel
|
baseModel: assetsModel
|
||||||
|
showcaseModel: inShowcaseAssetsModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ SplitView {
|
|||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
id: collectiblesModel
|
id: collectiblesModel
|
||||||
|
|
||||||
readonly property var data: [
|
readonly property var data: [
|
||||||
{
|
{
|
||||||
uid: "123",
|
uid: "123",
|
||||||
@ -82,6 +83,41 @@ SplitView {
|
|||||||
Component.onCompleted: append(data)
|
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
|
StatusScrollView { // wrapped in a ScrollView on purpose; to simulate SettingsContentBase.qml
|
||||||
SplitView.fillWidth: true
|
SplitView.fillWidth: true
|
||||||
SplitView.preferredHeight: 500
|
SplitView.preferredHeight: 500
|
||||||
@ -89,6 +125,7 @@ SplitView {
|
|||||||
id: showcasePanel
|
id: showcasePanel
|
||||||
width: 500
|
width: 500
|
||||||
baseModel: collectiblesModel
|
baseModel: collectiblesModel
|
||||||
|
showcaseModel: inShowcaseCollectiblesModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ SplitView {
|
|||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
id: communitiesModel
|
id: communitiesModel
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
append([{
|
append([{
|
||||||
id: "0x0001",
|
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
|
StatusScrollView { // wrapped in a ScrollView on purpose; to simulate SettingsContentBase.qml
|
||||||
SplitView.fillWidth: true
|
SplitView.fillWidth: true
|
||||||
SplitView.preferredHeight: 500
|
SplitView.preferredHeight: 500
|
||||||
@ -84,6 +120,7 @@ SplitView {
|
|||||||
id: showcasePanel
|
id: showcasePanel
|
||||||
width: 500
|
width: 500
|
||||||
baseModel: communitiesModel
|
baseModel: communitiesModel
|
||||||
|
showcaseModel: inShowcaseCommunitiesModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user