chore(Storybook): Basic pages for SendModal and TokenListView added

This commit is contained in:
Michał Cieślak 2023-05-10 13:05:45 +02:00 committed by Michał
parent 2b1c9ff15e
commit 2821efe73b
10 changed files with 250 additions and 7 deletions

View File

@ -57,6 +57,10 @@ ListModel {
title: "AmountToSendView"
section: "Views"
}
ListElement {
title: "TokenListView"
section: "Views"
}
ListElement {
title: "StatusCommunityCard"
section: "Panels"
@ -185,6 +189,10 @@ ListModel {
title: "NetworkSelectPopup"
section: "Popups"
}
ListElement {
title: "SendModal"
section: "Popups"
}
ListElement {
title: "MembersSelector"
section: "Components"

View File

@ -0,0 +1,128 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import Models 1.0
import Storybook 1.0
import utils 1.0
import shared.popups 1.0
import shared.stores 1.0
SplitView {
id: root
orientation: Qt.Vertical
Item {
SplitView.fillWidth: true
SplitView.fillHeight: true
Rectangle {
anchors.fill: parent
color: "lightgray"
}
Loader {
id: loader
active: false
sourceComponent: SendModal {
visible: true
modal: false
closePolicy: Popup.NoAutoClose
store: TransactionStore {
readonly property QtObject selectedSenderAccount: QtObject {
readonly property var assets: WalletAssetsModel {}
}
readonly property QtObject walletSectionSendInst: QtObject {}
readonly property QtObject mainModuleInst: QtObject {}
readonly property var savedAddressesModel: ListModel {
Component.onCompleted: {
for (let i = 0; i < 10; i++)
append({
name: "some saved addr name " + i,
ens: []
})
}
}
readonly property string currentCurrency: "USD"
readonly property QtObject currencyStore: QtObject {
readonly property string currentCurrency: "USD"
function formatCurrencyAmount() {
return "42"
}
function getFiatValue() {
return "42.42"
}
}
function getAllNetworksSupportedString() {
return "OPT"
}
function plainText(text) {
return text
}
function setDefaultPreferredDisabledChains() {}
function prepareTransactionsForAddress(address) {
console.log("prepareTransactionsForAddress:", address)
}
function getTransactions() {
return transactions
}
readonly property var transactions_: ListModel {
id: transactions
Component.onCompleted: {
for (let i = 0; i < 10; i++)
append({
to: "to",
loadingTransaction: false,
value: {
displayDecimals: true,
stripTrailingZeroes: true,
amount: 3.234
},
timestamp: new Date()
})
}
}
function findTokenSymbolByAddress() {
return "ETH"
}
}
}
Component.onCompleted: {
RootStore.currencyStore = {
currentCurrencySymbol: "USD"
}
RootStore.getNetworkIcon = () => "network/Network=Optimism"
loader.active = true
}
}
}
LogsAndControlsPanel {
SplitView.minimumHeight: 100
SplitView.preferredHeight: 100
SplitView.fillWidth: true
}
}

View File

@ -0,0 +1,40 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import Models 1.0
import Storybook 1.0
import shared.views 1.0
SplitView {
orientation: Qt.Vertical
Item {
SplitView.fillWidth: true
SplitView.fillHeight: true
Rectangle {
anchors.fill: parent
color: "lightgray"
}
TokenListView {
anchors.centerIn: parent
width: 400
getNetworkIcon: function(chainId) {
return "network/Network=Optimism"
}
assets: WalletAssetsModel {}
}
}
LogsAndControlsPanel {
SplitView.minimumHeight: 100
SplitView.preferredHeight: 100
SplitView.fillWidth: true
}
}

View File

@ -0,0 +1,52 @@
import QtQuick 2.15
ListModel {
readonly property var data: [
{
totalBalance: 323.3,
decimals: 2,
totalCurrencyBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 3.234
}),
visibleForNetwork: true,
symbol: "ETH",
name: "Ethereum",
balances: [
{
chainId: "chain_1_id",
balance: {
displayDecimals: true,
stripTrailingZeroes: true,
amount: 3.234
}
}
]
},
{
totalBalance: 324343.3,
decimals: 2,
totalCurrencyBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 23333213.234
}),
visibleForNetwork: true,
symbol: "SNT",
name: "Status",
balances: [
{
chainId: "chain_1_id",
balance: {
displayDecimals: true,
stripTrailingZeroes: true,
amount: 324343.3
}
}
]
},
]
Component.onCompleted: append(data)
}

View File

@ -8,6 +8,7 @@ IconModel 1.0 IconModel.qml
TokenHoldersModel 1.0 TokenHoldersModel.qml
UsersModel 1.0 UsersModel.qml
WalletAccountsModel 1.0 WalletAccountsModel.qml
WalletAssetsModel 1.0 WalletAssetsModel.qml
singleton MintedCollectiblesModel 1.0 MintedCollectiblesModel.qml
singleton ModelsData 1.0 ModelsData.qml
singleton NetworksModel 1.0 NetworksModel.qml

View File

@ -0,0 +1,5 @@
import QtQuick 2.15
QtObject {
property var blockchainNetworksDown: []
}

View File

@ -9,4 +9,7 @@ QtObject {
property bool isWalletEnabled
property var getSelectedTextWithFormationChars
property var gifColumnA
property var currencyStore
property var getNetworkIcon
}

View File

@ -0,0 +1,3 @@
import QtQuick 2.15
QtObject {}

View File

@ -1 +1,3 @@
NetworkConnectionStore 1.0 NetworkConnectionStore.qml
TransactionStore 1.0 TransactionStore.qml
singleton RootStore 1.0 RootStore.qml

View File

@ -1,14 +1,15 @@
AmountToSend 1.0 AmountToSend.qml
AssetsView 1.0 AssetsView.qml
DeviceSyncingView 1.0 DeviceSyncingView.qml
EnsResolver 1.0 EnsResolver.qml
ExistingContacts 1.0 ExistingContacts.qml
PickedContacts 1.0 PickedContacts.qml
HistoryView 1.0 HistoryView.qml
NoFriendsRectangle 1.0 NoFriendsRectangle.qml
PasswordView 1.0 PasswordView.qml
PickedContacts 1.0 PickedContacts.qml
ProfileDialogView 1.0 ProfileDialogView.qml
SearchResults 1.0 SearchResults.qml
TokenListView 1.0 TokenListView.qml
TransactionPreview 1.0 TransactionPreview.qml
TransactionSigner 1.0 TransactionSigner.qml
TransactionStackView 1.0 TransactionStackView.qml
PasswordView 1.0 PasswordView.qml
ProfileDialogView 1.0 ProfileDialogView.qml
AssetsView 1.0 AssetsView.qml
HistoryView 1.0 HistoryView.qml
DeviceSyncingView 1.0 DeviceSyncingView.qml
AmountToSend 1.0 AmountToSend.qml