@@ -7,48 +7,205 @@ import Models 1.0
7
7
import SortFilterProxyModel 0.2
8
8
9
9
import shared.controls 1.0
10
+ import shared.stores 1.0
10
11
11
- Item {
12
+ import AppLayouts.Wallet.stores 1.0
13
+ import AppLayouts.Wallet.adaptors 1.0
14
+
15
+ import utils 1.0
16
+
17
+ SplitView {
12
18
id: root
13
19
14
- ColumnLayout {
15
- spacing: 16
16
- anchors .centerIn : parent
17
- implicitWidth: 150
20
+ orientation: Qt .Vertical
18
21
22
+ QtObject {
23
+ id: d
19
24
20
- WalletAccountsModel {
21
- id: accountsModel
25
+ readonly property var flatNetworks: NetworksModel .flatNetworks
26
+ readonly property var assetsStore: WalletAssetsStore {
27
+ id: thisWalletAssetStore
28
+ walletTokensStore: TokensStore {
29
+ plainTokensBySymbolModel: TokensBySymbolModel {}
30
+ }
31
+ readonly property var baseGroupedAccountAssetModel: GroupedAccountsAssetsModel {}
32
+ assetsWithFilteredBalances: thisWalletAssetStore .groupedAccountsAssetsModel
22
33
}
23
34
24
- Label {
25
- text : " Default style "
26
- font . bold : true
27
- Layout . fillWidth : true
35
+ readonly property var currencyStore : CurrenciesStore{}
36
+ readonly property var nonWatchWalletAcounts : SortFilterProxyModel {
37
+ sourceModel : walletAccountsModel
38
+ filters : ValueFilter { roleName : " canSend " ; value : true }
28
39
}
29
- AccountSelector {
30
- id: accountSelector
31
- Layout .fillWidth : true
32
- model: WalletAccountsModel {}
33
- onCurrentAccountAddressChanged: {
34
- accountSelector2 .selectedAddress = currentAccountAddress
40
+
41
+ readonly property var filteredFlatNetworksModel: SortFilterProxyModel {
42
+ sourceModel: d .flatNetworks
43
+ filters: ValueFilter { roleName: " isTest" ; value: true }
44
+ }
45
+ }
46
+
47
+ ListModel {
48
+ id: walletAccountsModel
49
+ readonly property var data: [
50
+ {
51
+ name: " helloworld" ,
52
+ address: " 0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240" ,
53
+ emoji: " 😋" ,
54
+ colorId: Constants .walletAccountColors .primary ,
55
+ walletType: " " ,
56
+ canSend: true ,
57
+ position: 0 ,
58
+ currencyBalance: ({amount: 1.25 ,
59
+ symbol: " USD" ,
60
+ displayDecimals: 2 ,
61
+ stripTrailingZeroes: false }),
62
+ migratedToKeycard: true
63
+ },
64
+ {
65
+ name: " Hot wallet (generated)" ,
66
+ emoji: " 🚗" ,
67
+ colorId: Constants .walletAccountColors .army ,
68
+ address: " 0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881" ,
69
+ walletType: Constants .generatedWalletType ,
70
+ canSend: true ,
71
+ position: 3 ,
72
+ currencyBalance: ({amount: 10 ,
73
+ symbol: " USD" ,
74
+ displayDecimals: 2 ,
75
+ stripTrailingZeroes: false }),
76
+ migratedToKeycard: false
77
+ },
78
+ {
79
+ name: " Family (seed)" ,
80
+ emoji: " 🎨" ,
81
+ colorId: Constants .walletAccountColors .magenta ,
82
+ address: " 0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882" ,
83
+ walletType: Constants .seedWalletType ,
84
+ canSend: true ,
85
+ position: 1 ,
86
+ currencyBalance: ({amount: 110.05 ,
87
+ symbol: " USD" ,
88
+ displayDecimals: 2 ,
89
+ stripTrailingZeroes: false }),
90
+ migratedToKeycard: false
91
+ },
92
+ {
93
+ name: " Tag Heuer (watch)" ,
94
+ emoji: " ⌚" ,
95
+ colorId: Constants .walletAccountColors .copper ,
96
+ color: " #CB6256" ,
97
+ address: " 0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8883" ,
98
+ walletType: Constants .watchWalletType ,
99
+ canSend: false ,
100
+ position: 2 ,
101
+ currencyBalance: ({amount: 3 ,
102
+ symbol: " USD" ,
103
+ displayDecimals: 2 ,
104
+ stripTrailingZeroes: false }),
105
+ migratedToKeycard: false
106
+ },
107
+ {
108
+ name: " Fab (key)" ,
109
+ emoji: " 🔑" ,
110
+ colorId: Constants .walletAccountColors .camel ,
111
+ color: " #C78F67" ,
112
+ address: " 0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884" ,
113
+ walletType: Constants .keyWalletType ,
114
+ canSend: true ,
115
+ position: 4 ,
116
+ currencyBalance: ({amount: 999 ,
117
+ symbol: " USD" ,
118
+ displayDecimals: 2 ,
119
+ stripTrailingZeroes: false }),
120
+ migratedToKeycard: false
35
121
}
122
+ ]
123
+
124
+ Component .onCompleted : append (data)
125
+ }
126
+
127
+ WalletAccountsSelectorAdaptor {
128
+ id: walletAccountsSelectorAdaptor
129
+
130
+ accounts: walletAccountsModel
131
+ assetsModel: d .assetsStore .groupedAccountAssetsModel
132
+ tokensBySymbolModel: d .assetsStore .walletTokensStore .plainTokensBySymbolModel
133
+ filteredFlatNetworksModel: d .filteredFlatNetworksModel
134
+
135
+ selectedTokenKey: selectedTokenComboBox .currentValue
136
+ selectedNetworkChainId: networksComboBox .currentValue
137
+
138
+ fnFormatCurrencyAmountFromBigInt : function (balance , symbol , decimals , options = null ) {
139
+ return d .currencyStore .formatCurrencyAmountFromBigInt (balance, symbol, decimals, options)
36
140
}
141
+ }
142
+
143
+ Item {
144
+ SplitView .preferredWidth : 150
145
+ SplitView .fillHeight : true
146
+ ColumnLayout {
147
+ spacing: 16
148
+ width: 150
37
149
38
- Label {
39
- text: " Header style"
40
- font .bold : true
41
- Layout .fillWidth : true
150
+ WalletAccountsModel {
151
+ id: accountsModel
152
+ }
153
+
154
+ Label {
155
+ text: " Default style"
156
+ font .bold : true
157
+ Layout .fillWidth : true
158
+ }
159
+ AccountSelector {
160
+ id: accountSelector
161
+ Layout .fillWidth : true
162
+ model: WalletAccountsModel {}
163
+ onCurrentAccountAddressChanged: {
164
+ accountSelector2 .selectedAddress = currentAccountAddress
165
+ }
166
+ }
167
+
168
+ Label {
169
+ text: " Header style"
170
+ font .bold : true
171
+ Layout .fillWidth : true
172
+ }
173
+ AccountSelectorHeader {
174
+ id: accountSelector2
175
+ model: walletAccountsSelectorAdaptor .processedWalletAccounts
176
+ onCurrentAccountAddressChanged: {
177
+ accountSelector .selectedAddress = currentAccountAddress
178
+ }
179
+ }
42
180
}
43
- AccountSelectorHeader {
44
- id: accountSelector2
45
- model: accountSelector .model
46
- onCurrentAccountAddressChanged: {
47
- accountSelector .selectedAddress = currentAccountAddress
181
+
182
+ }
183
+
184
+ Item {
185
+ SplitView .preferredWidth : 300
186
+ SplitView .preferredHeight : childrenRect .height
187
+
188
+ ColumnLayout {
189
+
190
+ Label { text: " Selected Token" }
191
+ ComboBox {
192
+ id: selectedTokenComboBox
193
+ textRole: " name"
194
+ valueRole: " key"
195
+ model: d .assetsStore .walletTokensStore .plainTokensBySymbolModel
196
+ currentIndex: - 1
197
+ }
198
+
199
+ Label { text: " Selected Network" }
200
+ ComboBox {
201
+ id: networksComboBox
202
+ textRole: " chainName"
203
+ valueRole: " chainId"
204
+ model: d .filteredFlatNetworksModel
205
+ currentIndex: - 1
48
206
}
49
207
}
50
-
51
- }
208
+ }
52
209
}
53
210
54
211
// category: Components
0 commit comments