Storybook pages - multiple fixes regarding stores
This commit is contained in:
parent
5e11027d3a
commit
fe249225a2
|
@ -4,13 +4,13 @@ import QtQuick.Controls 2.14
|
||||||
import SortFilterProxyModel 0.2
|
import SortFilterProxyModel 0.2
|
||||||
|
|
||||||
import AppLayouts.Profile.views.wallet 1.0
|
import AppLayouts.Profile.views.wallet 1.0
|
||||||
|
import AppLayouts.Profile.stores 1.0 as ProfileStores
|
||||||
|
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
import Storybook 1.0
|
import Storybook 1.0
|
||||||
|
|
||||||
import Models 1.0
|
import Models 1.0
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
|
@ -48,7 +48,7 @@ SplitView {
|
||||||
property bool accountBalanceNotAvailable: false
|
property bool accountBalanceNotAvailable: false
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property QtObject walletStore: QtObject {
|
readonly property ProfileStores.WalletStore walletStore: ProfileStores.WalletStore {
|
||||||
property var networks: SortFilterProxyModel {
|
property var networks: SortFilterProxyModel {
|
||||||
sourceModel: NetworksModel.flatNetworks
|
sourceModel: NetworksModel.flatNetworks
|
||||||
filters: ValueFilter { roleName: "isTest"; value: areTestNetworksEnabledCheckbox.checked }
|
filters: ValueFilter { roleName: "isTest"; value: areTestNetworksEnabledCheckbox.checked }
|
||||||
|
|
|
@ -9,6 +9,8 @@ import StatusQ.Core.Theme 0.1
|
||||||
import mainui.activitycenter.views 1.0
|
import mainui.activitycenter.views 1.0
|
||||||
import mainui.activitycenter.stores 1.0
|
import mainui.activitycenter.stores 1.0
|
||||||
|
|
||||||
|
import AppLayouts.Chat.stores 1.0 as ChatStores
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
import Storybook 1.0
|
import Storybook 1.0
|
||||||
|
@ -110,10 +112,6 @@ SplitView {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCompressedPk(publicKey) {
|
|
||||||
return "0x00000"
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
Utils.mainModuleInst = this
|
Utils.mainModuleInst = this
|
||||||
Utils.globalUtilsInst = this
|
Utils.globalUtilsInst = this
|
||||||
|
@ -126,7 +124,7 @@ SplitView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
ChatStores.RootStore {
|
||||||
id: storeMock
|
id: storeMock
|
||||||
|
|
||||||
function getCommunityDetailsAsJson(community) {
|
function getCommunityDetailsAsJson(community) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ SplitView {
|
||||||
sharedRootStore: SharedStores.RootStore {}
|
sharedRootStore: SharedStores.RootStore {}
|
||||||
rootStore: AppLayoutStores.RootStore {}
|
rootStore: AppLayoutStores.RootStore {}
|
||||||
communityTokensStore: SharedStores.CommunityTokensStore {}
|
communityTokensStore: SharedStores.CommunityTokensStore {}
|
||||||
|
utilsStore: SharedStores.UtilsStore {}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
|
|
@ -43,7 +43,6 @@ SplitView {
|
||||||
|
|
||||||
type: ActivityNotificationNewDevice.InstallationType.Received
|
type: ActivityNotificationNewDevice.InstallationType.Received
|
||||||
accountName: "bob.eth"
|
accountName: "bob.eth"
|
||||||
store: undefined
|
|
||||||
notification: notificationMock
|
notification: notificationMock
|
||||||
|
|
||||||
onMoreDetailsClicked: logs.logEvent("ActivityNotificationNewDevice::onMoreDetailsClicked")
|
onMoreDetailsClicked: logs.logEvent("ActivityNotificationNewDevice::onMoreDetailsClicked")
|
||||||
|
|
|
@ -42,7 +42,6 @@ SplitView {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
|
|
||||||
type: ActivityNotificationTransferOwnership.OwnershipState.Pending
|
type: ActivityNotificationTransferOwnership.OwnershipState.Pending
|
||||||
store: undefined
|
|
||||||
notification: notificationMock
|
notification: notificationMock
|
||||||
communityName: communityNameText.text
|
communityName: communityNameText.text
|
||||||
communityColor: colorSwitch.checked ? "green" : "orange"
|
communityColor: colorSwitch.checked ? "green" : "orange"
|
||||||
|
|
|
@ -9,9 +9,11 @@ import Models 1.0
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
|
|
||||||
import AppLayouts.Communities.popups 1.0
|
import AppLayouts.Communities.popups 1.0
|
||||||
|
import AppLayouts.Communities.stores 1.0 as CommunitiesStores
|
||||||
|
|
||||||
import utils 1.0
|
|
||||||
import shared.popups 1.0
|
import shared.popups 1.0
|
||||||
|
import shared.stores 1.0 as SharedStores
|
||||||
|
import utils 1.0
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
id: root
|
id: root
|
||||||
|
@ -99,7 +101,7 @@ SplitView {
|
||||||
property string currentKey: ""
|
property string currentKey: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
CommunitiesStores.CommunitiesStore {
|
||||||
id: communityStoreMock
|
id: communityStoreMock
|
||||||
|
|
||||||
property bool newCommunityFetched: false
|
property bool newCommunityFetched: false
|
||||||
|
@ -159,23 +161,6 @@ SplitView {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function isCompressedPubKey(key) {
|
|
||||||
return d.dialog.text === d.knownCommunityCompressedPublicKey ||
|
|
||||||
d.dialog.text === d.newCommunityCompressedPublicKey
|
|
||||||
}
|
|
||||||
|
|
||||||
function changeCommunityKeyCompression(key) {
|
|
||||||
if (key === d.knownCommunityCompressedPublicKey)
|
|
||||||
return d.knownCommunityPublicKey
|
|
||||||
if (key === d.newCommunityCompressedPublicKey)
|
|
||||||
return d.newCommunityPublicKey
|
|
||||||
if (key === d.knownCommunityPublicKey)
|
|
||||||
return d.knownCommunityCompressedPublicKey
|
|
||||||
if (key === d.newCommunityPublicKey)
|
|
||||||
return d.newCommunityCompressedPublicKey
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCommunityDataFromSharedLink(link) {
|
function getCommunityDataFromSharedLink(link) {
|
||||||
return d.knownCommunityDetails
|
return d.knownCommunityDetails
|
||||||
}
|
}
|
||||||
|
@ -235,6 +220,29 @@ SplitView {
|
||||||
destroyOnClose: false
|
destroyOnClose: false
|
||||||
|
|
||||||
store: communityStoreMock
|
store: communityStoreMock
|
||||||
|
utilsStore: SharedStores.UtilsStore {
|
||||||
|
function isCompressedPubKey(key) {
|
||||||
|
return d.dialog.text === d.knownCommunityCompressedPublicKey ||
|
||||||
|
d.dialog.text === d.newCommunityCompressedPublicKey
|
||||||
|
}
|
||||||
|
|
||||||
|
function isCommunityPublicKey() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeCommunityKeyCompression(key) {
|
||||||
|
if (key === d.knownCommunityCompressedPublicKey)
|
||||||
|
return d.knownCommunityPublicKey
|
||||||
|
if (key === d.newCommunityCompressedPublicKey)
|
||||||
|
return d.newCommunityPublicKey
|
||||||
|
if (key === d.knownCommunityPublicKey)
|
||||||
|
return d.knownCommunityCompressedPublicKey
|
||||||
|
if (key === d.newCommunityPublicKey)
|
||||||
|
return d.newCommunityCompressedPublicKey
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: open()
|
Component.onCompleted: open()
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import StatusQ.Core.Theme 0.1
|
||||||
|
|
||||||
import shared.controls.chat 1.0
|
import shared.controls.chat 1.0
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
import shared.stores 1.0
|
||||||
|
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
|
@ -20,9 +21,6 @@ SplitView {
|
||||||
|
|
||||||
// globalUtilsInst mock
|
// globalUtilsInst mock
|
||||||
QtObject {
|
QtObject {
|
||||||
function getEmojiHashAsJson(publicKey) {
|
|
||||||
return JSON.stringify(["👨🏻🍼", "🏃🏿♂️", "🌇", "🤶🏿", "🏮","🤷🏻♂️", "🤦🏻", "📣", "🤎", "👷🏽", "😺", "🥞", "🔃", "🧝🏽♂️"])
|
|
||||||
}
|
|
||||||
function getColorId(publicKey) { return 4 }
|
function getColorId(publicKey) { return 4 }
|
||||||
|
|
||||||
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
|
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
|
||||||
|
@ -51,6 +49,13 @@ SplitView {
|
||||||
|
|
||||||
LinkPreviewCard {
|
LinkPreviewCard {
|
||||||
id: previewCard
|
id: previewCard
|
||||||
|
|
||||||
|
utilsStore: UtilsStore {
|
||||||
|
function getEmojiHash(publicKey) {
|
||||||
|
return JSON.stringify(["👨🏻🍼", "🏃🏿♂️", "🌇", "🤶🏿", "🏮","🤷🏻♂️", "🤦🏻", "📣", "🤎", "👷🏽", "😺", "🥞", "🔃", "🧝🏽♂️"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type: 1
|
type: 1
|
||||||
linkData {
|
linkData {
|
||||||
title: titleInput.text
|
title: titleInput.text
|
||||||
|
|
|
@ -7,6 +7,7 @@ import AppLayouts.Chat.stores 1.0 as ChatStores
|
||||||
|
|
||||||
import Storybook 1.0
|
import Storybook 1.0
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
import shared.stores 1.0 as SharedStores
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
id: root
|
id: root
|
||||||
|
@ -86,7 +87,7 @@ SplitView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
ChatStores.UsersStore {
|
||||||
id: usersStoreMock
|
id: usersStoreMock
|
||||||
|
|
||||||
readonly property var usersModel: ListModel {
|
readonly property var usersModel: ListModel {
|
||||||
|
@ -188,6 +189,11 @@ SplitView {
|
||||||
|
|
||||||
sourceComponent: MembersSelectorView {
|
sourceComponent: MembersSelectorView {
|
||||||
rootStore: rootStoreMock
|
rootStore: rootStoreMock
|
||||||
|
utilsStore: SharedStores.UtilsStore {
|
||||||
|
function isChatKey() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,8 @@ Item {
|
||||||
const pubKey = "0x%1".arg(seed)
|
const pubKey = "0x%1".arg(seed)
|
||||||
return {
|
return {
|
||||||
pubKey: pubKey,
|
pubKey: pubKey,
|
||||||
displayName: seed%8 ? "user%1".arg(seed) : "",
|
displayName: seed%8 ? "_user%1".arg(seed) : "",
|
||||||
|
preferredDisplayName: "user%1".arg(seed),
|
||||||
localNickname: seed%3 ? "" : "nickname%1".arg(seed),
|
localNickname: seed%3 ? "" : "nickname%1".arg(seed),
|
||||||
alias: "three word name(%1)".arg(pubKey),
|
alias: "three word name(%1)".arg(pubKey),
|
||||||
isVerified: seed%3 ? false : true,
|
isVerified: seed%3 ? false : true,
|
||||||
|
|
|
@ -6,14 +6,15 @@ import SortFilterProxyModel 0.2
|
||||||
import AppLayouts.Wallet.panels 1.0
|
import AppLayouts.Wallet.panels 1.0
|
||||||
import AppLayouts.Wallet.controls 1.0
|
import AppLayouts.Wallet.controls 1.0
|
||||||
import AppLayouts.Chat.panels 1.0
|
import AppLayouts.Chat.panels 1.0
|
||||||
|
import AppLayouts.Wallet.stores 1.0 as WalletStores
|
||||||
|
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
|
|
||||||
|
import shared.stores 1.0 as SharedStores
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
import Storybook 1.0
|
import Storybook 1.0
|
||||||
|
|
||||||
import Models 1.0
|
import Models 1.0
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
|
@ -26,6 +27,32 @@ SplitView {
|
||||||
property bool globalUtilsReady: false
|
property bool globalUtilsReady: false
|
||||||
property bool mainModuleReady: false
|
property bool mainModuleReady: false
|
||||||
|
|
||||||
|
SharedStores.NetworkConnectionStore {
|
||||||
|
id: connectionStore
|
||||||
|
|
||||||
|
property bool accountBalanceNotAvailable: false
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: WalletStores.RootStore is singleton and therefore it's not mockable
|
||||||
|
// Once store is converted to regular, non-singleton store it can be mocked as follows
|
||||||
|
// WalletStores.RootStore {
|
||||||
|
// id: walletStore
|
||||||
|
|
||||||
|
// property var filteredFlatModel: SortFilterProxyModel {
|
||||||
|
// sourceModel: NetworksModel.flatNetworks
|
||||||
|
// filters: ValueFilter { roleName: "isTest"; value: false }
|
||||||
|
// }
|
||||||
|
// function toggleNetwork(chainId) {
|
||||||
|
// print ("toggleNetwork called with chainId: " + chainId)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// function getAllNetworksSupportedString(hovered) {
|
||||||
|
// return hovered ? "<font color=\"" + "#627EEA" + "\">" + "eth:" + "</font>" +
|
||||||
|
// "<font color=\"" + "#E90101" + "\">" + "oeth:" + "</font>" +
|
||||||
|
// "<font color=\"" + "#27A0EF" + "\">" + "arb1:" + "</font>" : "eth:oeth:arb1:"
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// globalUtilsInst mock
|
// globalUtilsInst mock
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
@ -74,26 +101,6 @@ SplitView {
|
||||||
isAllAccounts: true,
|
isAllAccounts: true,
|
||||||
colorIds: "purple;pink;magenta"
|
colorIds: "purple;pink;magenta"
|
||||||
})
|
})
|
||||||
|
|
||||||
readonly property QtObject connectionStore: QtObject {
|
|
||||||
property bool accountBalanceNotAvailable: false
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property QtObject walletStore: QtObject {
|
|
||||||
property var filteredFlatModel: SortFilterProxyModel {
|
|
||||||
sourceModel: NetworksModel.flatNetworks
|
|
||||||
filters: ValueFilter { roleName: "isTest"; value: false }
|
|
||||||
}
|
|
||||||
function toggleNetwork(chainId) {
|
|
||||||
print ("toggleNetwork called with chainId: " + chainId)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getAllNetworksSupportedString(hovered) {
|
|
||||||
return hovered ? "<font color=\"" + "#627EEA" + "\">" + "eth:" + "</font>" +
|
|
||||||
"<font color=\"" + "#E90101" + "\">" + "oeth:" + "</font>" +
|
|
||||||
"<font color=\"" + "#27A0EF" + "\">" + "arb1:" + "</font>" : "eth:oeth:arb1:"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// mainModuleInst mock
|
// mainModuleInst mock
|
||||||
|
@ -133,9 +140,9 @@ SplitView {
|
||||||
active: globalUtilsReady && mainModuleReady
|
active: globalUtilsReady && mainModuleReady
|
||||||
|
|
||||||
sourceComponent: WalletHeader {
|
sourceComponent: WalletHeader {
|
||||||
networkConnectionStore: d.connectionStore
|
networkConnectionStore: connectionStore
|
||||||
overview: allAccountsCheckbox.checked ? d.dummyAllAccountsOverview : d.dummyOverview
|
overview: allAccountsCheckbox.checked ? d.dummyAllAccountsOverview : d.dummyOverview
|
||||||
walletStore: d.walletStore
|
walletStore: walletStore
|
||||||
width: parent.width
|
width: parent.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
import QtQuick 2.15
|
||||||
|
|
||||||
|
QtObject {}
|
|
@ -7,3 +7,4 @@ NetworkConnectionStore 1.0 NetworkConnectionStore.qml
|
||||||
PermissionsStore 1.0 PermissionsStore.qml
|
PermissionsStore 1.0 PermissionsStore.qml
|
||||||
ProfileStore 1.0 ProfileStore.qml
|
ProfileStore 1.0 ProfileStore.qml
|
||||||
RootStore 1.0 RootStore.qml
|
RootStore 1.0 RootStore.qml
|
||||||
|
UtilsStore 1.0 UtilsStore.qml
|
||||||
|
|
|
@ -13,7 +13,7 @@ import StatusQ.Popups 0.1
|
||||||
|
|
||||||
import SortFilterProxyModel 0.2
|
import SortFilterProxyModel 0.2
|
||||||
|
|
||||||
import shared.stores 1.0
|
import shared.stores 1.0 as SharedStores
|
||||||
|
|
||||||
import AppLayouts.Wallet.stores 1.0 as WalletStores
|
import AppLayouts.Wallet.stores 1.0 as WalletStores
|
||||||
import AppLayouts.Wallet.services.dapps 1.0
|
import AppLayouts.Wallet.services.dapps 1.0
|
||||||
|
@ -21,15 +21,15 @@ import AppLayouts.Wallet.services.dapps 1.0
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
import "../controls"
|
import "../controls"
|
||||||
import "../stores"
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property NetworkConnectionStore networkConnectionStore
|
property SharedStores.NetworkConnectionStore networkConnectionStore
|
||||||
property var overview
|
|
||||||
property WalletStores.RootStore walletStore
|
property WalletStores.RootStore walletStore
|
||||||
|
|
||||||
|
property var overview
|
||||||
|
|
||||||
property bool dappsEnabled
|
property bool dappsEnabled
|
||||||
property int loginType // RootStore.loginType -> Constants.LoginType enum
|
property int loginType // RootStore.loginType -> Constants.LoginType enum
|
||||||
|
|
||||||
|
@ -112,14 +112,14 @@ Item {
|
||||||
}
|
}
|
||||||
asset.mirror: true
|
asset.mirror: true
|
||||||
|
|
||||||
loading: RootStore.isAccountTokensReloading
|
loading: root.walletStore.isAccountTokensReloading
|
||||||
interactive: !loading && !throttleTimer.running
|
interactive: !loading && !throttleTimer.running
|
||||||
readonly property string lastReloadTimeFormated: !!RootStore.lastReloadTimestamp ?
|
readonly property string lastReloadTimeFormated: !!root.walletStore.lastReloadTimestamp ?
|
||||||
LocaleUtils.formatRelativeTimestamp(
|
LocaleUtils.formatRelativeTimestamp(
|
||||||
RootStore.lastReloadTimestamp * 1000) : ""
|
root.walletStore.lastReloadTimestamp * 1000) : ""
|
||||||
tooltip.text: qsTr("Last refreshed %1").arg(lastReloadTimeFormated)
|
tooltip.text: qsTr("Last refreshed %1").arg(lastReloadTimeFormated)
|
||||||
|
|
||||||
onClicked: RootStore.reloadAccountTokens()
|
onClicked: root.walletStore.reloadAccountTokens()
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: throttleTimer
|
id: throttleTimer
|
||||||
|
|
Loading…
Reference in New Issue