2023-11-22 19:58:02 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
2024-06-14 18:20:07 +00:00
|
|
|
import QtQuick.Layouts 1.15
|
2023-11-22 19:58:02 +00:00
|
|
|
|
|
|
|
import shared.views 1.0
|
2024-06-14 18:20:07 +00:00
|
|
|
import utils 1.0
|
2023-11-22 19:58:02 +00:00
|
|
|
|
|
|
|
import Storybook 1.0
|
2023-11-28 19:16:18 +00:00
|
|
|
|
2024-09-11 12:00:25 +00:00
|
|
|
import AppLayouts.Wallet.controls 1.0
|
2024-11-22 15:57:21 +00:00
|
|
|
import AppLayouts.Wallet.panels 1.0
|
2024-10-03 08:08:51 +00:00
|
|
|
|
|
|
|
import Qt.labs.settings 1.1
|
2024-05-22 08:13:39 +00:00
|
|
|
|
2024-11-22 15:57:21 +00:00
|
|
|
import StatusQ.Popups.Dialog 0.1
|
|
|
|
|
2023-11-22 19:58:02 +00:00
|
|
|
SplitView {
|
|
|
|
id: root
|
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
ListModel {
|
|
|
|
id: assetsModel
|
2023-11-22 19:58:02 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
function format(amount, symbol) {
|
|
|
|
return `${amount.toLocaleString(Qt.locale())} ${symbol}`
|
|
|
|
}
|
2023-11-22 19:58:02 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
Component.onCompleted: {
|
|
|
|
const data = [
|
|
|
|
{
|
|
|
|
key: "key_ETH",
|
|
|
|
symbol: "ETH",
|
|
|
|
name: "Ether",
|
|
|
|
icon: Constants.tokenIcon("ETH", false),
|
|
|
|
balance: 10.0,
|
|
|
|
balanceText: format(10.0, "ETH"),
|
|
|
|
error: "",
|
|
|
|
|
|
|
|
marketDetailsAvailable: true,
|
|
|
|
marketDetailsLoading: true,
|
|
|
|
marketPrice: 0,
|
|
|
|
marketChangePct24hour: 0,
|
|
|
|
|
|
|
|
communityId: "",
|
|
|
|
communityName: "",
|
|
|
|
communityIcon: Qt.resolvedUrl(""),
|
|
|
|
|
|
|
|
position: 2,
|
|
|
|
canBeHidden: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "key_SNT",
|
|
|
|
symbol: "SNT",
|
|
|
|
name: "Status",
|
|
|
|
icon: Constants.tokenIcon("SNT", false),
|
|
|
|
balance: 20023.0,
|
|
|
|
balanceText: format(20023.0, "SNT"),
|
|
|
|
error: "",
|
|
|
|
|
|
|
|
marketDetailsAvailable: true,
|
|
|
|
marketDetailsLoading: false,
|
|
|
|
marketPrice: 50.23,
|
|
|
|
marketChangePct24hour: 12,
|
|
|
|
|
|
|
|
communityId: "",
|
|
|
|
communityName: "",
|
|
|
|
communityIcon: Qt.resolvedUrl(""),
|
|
|
|
|
|
|
|
position: 1,
|
|
|
|
canBeHidden: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "key_MCT",
|
|
|
|
symbol: "MCT",
|
|
|
|
name: "My custom token",
|
|
|
|
icon: Constants.tokenIcon("ZRX", false),
|
|
|
|
balance: 102.4,
|
|
|
|
balanceText: format(102.4, "MCT"),
|
|
|
|
error: "",
|
|
|
|
|
|
|
|
marketDetailsAvailable: false,
|
|
|
|
marketDetailsLoading: false,
|
|
|
|
marketPrice: 0,
|
|
|
|
marketChangePct24hour: 0,
|
|
|
|
|
|
|
|
communityId: "34",
|
|
|
|
communityName: "Crypto Kitties",
|
|
|
|
communityIcon: Constants.tokenIcon("DAI", false),
|
|
|
|
|
|
|
|
position: 4,
|
|
|
|
canBeHidden: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "key_DAI",
|
|
|
|
symbol: "DAI",
|
|
|
|
name: "Dai",
|
|
|
|
icon: Constants.tokenIcon("DAI", false),
|
|
|
|
balance: 123.24,
|
|
|
|
balanceText: format(123.24, "DAI"),
|
|
|
|
error: "",
|
|
|
|
|
|
|
|
marketDetailsAvailable: true,
|
|
|
|
marketDetailsLoading: false,
|
|
|
|
marketPrice: 23.23,
|
|
|
|
marketChangePct24hour: 2.3,
|
|
|
|
|
|
|
|
communityId: "",
|
|
|
|
communityName: "",
|
|
|
|
communityIcon: Qt.resolvedUrl(""),
|
|
|
|
|
|
|
|
position: 3,
|
|
|
|
canBeHidden: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "key_USDT",
|
|
|
|
symbol: "USDT",
|
|
|
|
name: "USDT",
|
|
|
|
icon: Constants.tokenIcon("USDT", false),
|
|
|
|
balance: 15.24,
|
|
|
|
balanceText: format(15.24, "USDT"),
|
|
|
|
error: "",
|
|
|
|
|
|
|
|
marketDetailsAvailable: true,
|
|
|
|
marketDetailsLoading: false,
|
|
|
|
marketPrice: 0.99,
|
|
|
|
marketChangePct24hour: 0,
|
|
|
|
|
|
|
|
communityId: "",
|
|
|
|
communityName: "",
|
|
|
|
communityIcon: Qt.resolvedUrl(""),
|
|
|
|
|
|
|
|
position: 5,
|
|
|
|
canBeHidden: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "key_TBT",
|
|
|
|
symbol: "TBT",
|
|
|
|
name: "The best token",
|
|
|
|
icon: Constants.tokenIcon("UNI", false),
|
|
|
|
balance: 102,
|
|
|
|
balanceText: format(102, "TBT"),
|
|
|
|
error: "Pocket Network (POKT) & Infura are currently both "
|
|
|
|
+ "unavailable for %1. %1 balances are as of %2."
|
|
|
|
.arg("TBT").arg("10/06/2024"),
|
|
|
|
|
|
|
|
marketDetailsAvailable: false,
|
|
|
|
marketDetailsLoading: false,
|
|
|
|
marketPrice: 0,
|
|
|
|
marketChangePct24hour: 0,
|
|
|
|
|
|
|
|
communityId: "3423",
|
|
|
|
communityName: "Best tokens",
|
|
|
|
communityIcon: Constants.tokenIcon("UNI", false),
|
|
|
|
|
|
|
|
position: 6,
|
|
|
|
canBeHidden: true
|
|
|
|
}
|
|
|
|
]
|
2023-11-24 12:16:13 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
append(data)
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
2024-06-14 18:20:07 +00:00
|
|
|
}
|
2023-11-24 12:16:13 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
SplitView {
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
SplitView.fillHeight: true
|
2023-11-24 12:16:13 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
orientation: Qt.Vertical
|
2023-11-24 12:16:13 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
Pane {
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
SplitView.fillHeight: true
|
2023-11-24 12:16:13 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
AssetsView {
|
2024-09-11 12:00:25 +00:00
|
|
|
id: assetView
|
2024-06-14 18:20:07 +00:00
|
|
|
anchors.fill: parent
|
2023-11-22 19:58:02 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
loading: loadingCheckBox.checked
|
|
|
|
sorterVisible: sorterVisibleCheckBox.checked
|
|
|
|
customOrderAvailable: customOrderAvailableCheckBox.checked
|
2023-11-22 19:58:02 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
sendEnabled: sendEnabledCheckBox.checked
|
|
|
|
swapEnabled: swapEnabledCheckBox.checked
|
|
|
|
swapVisible: swapVisibleCheckBox.checked
|
2024-08-02 09:24:40 +00:00
|
|
|
communitySwapVisible: communitySwapVisibleCheckBox.checked
|
2023-11-22 19:58:02 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
balanceError: balanceErrorCheckBox.checked
|
|
|
|
? "Balance error!" : ""
|
2024-03-01 02:04:36 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
marketDataError: marketDataErrorCheckBox.checked
|
|
|
|
? "Market data error!" : ""
|
|
|
|
|
|
|
|
model: assetsModel
|
|
|
|
|
|
|
|
onSendRequested: logs.logEvent(`send requested: ${key}`)
|
|
|
|
onReceiveRequested: logs.logEvent(`receive requested: ${key}`)
|
|
|
|
onSwapRequested: logs.logEvent(`swap requested: ${key}`)
|
|
|
|
onAssetClicked: logs.logEvent(`asset clicked: ${key}`)
|
|
|
|
|
|
|
|
onHideRequested: logs.logEvent(`hide requested: ${key}`)
|
2024-07-26 14:47:18 +00:00
|
|
|
onHideCommunityAssetsRequested: logs.logEvent(`hide community assets requested: ${communityKey}`)
|
2024-06-14 18:20:07 +00:00
|
|
|
onManageTokensRequested: logs.logEvent(`manage tokens requested`)
|
2024-11-22 15:57:21 +00:00
|
|
|
|
|
|
|
bannerComponent: buyReceiveBannerComponent
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: buyReceiveBannerComponent
|
|
|
|
BuyReceiveBanner {
|
|
|
|
id: banner
|
|
|
|
topPadding: anyVisibleItems ? 8 : 0
|
|
|
|
bottomPadding: anyVisibleItems ? 20 : 0
|
|
|
|
|
|
|
|
onCloseBuy: buyEnabled = false
|
|
|
|
onCloseReceive: receiveEnabled = false
|
|
|
|
}
|
|
|
|
}
|
2024-04-09 20:26:15 +00:00
|
|
|
}
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
2023-11-22 19:58:02 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
Logs {
|
|
|
|
id: logs
|
|
|
|
}
|
|
|
|
|
|
|
|
LogsView {
|
|
|
|
clip: true
|
|
|
|
|
|
|
|
SplitView.preferredHeight: 150
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
|
|
|
|
logText: logs.logText
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Pane {
|
2024-06-14 18:20:07 +00:00
|
|
|
SplitView.preferredWidth: 300
|
2023-12-06 10:54:36 +00:00
|
|
|
|
|
|
|
ColumnLayout {
|
2024-06-14 18:20:07 +00:00
|
|
|
CheckBox {
|
|
|
|
id: loadingCheckBox
|
2023-11-24 12:16:13 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
text: "loading"
|
2023-12-06 10:54:36 +00:00
|
|
|
}
|
2024-06-14 18:20:07 +00:00
|
|
|
CheckBox {
|
|
|
|
id: sorterVisibleCheckBox
|
2023-11-24 12:16:13 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
text: "sorter visible"
|
2024-11-22 15:57:21 +00:00
|
|
|
checked: false
|
2024-06-14 18:20:07 +00:00
|
|
|
}
|
2023-11-24 12:16:13 +00:00
|
|
|
CheckBox {
|
2024-06-14 18:20:07 +00:00
|
|
|
id: customOrderAvailableCheckBox
|
|
|
|
|
|
|
|
text: "custom order available"
|
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
id: sendEnabledCheckBox
|
|
|
|
|
|
|
|
text: "send enabled"
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
2024-06-14 18:20:07 +00:00
|
|
|
CheckBox {
|
|
|
|
id: swapEnabledCheckBox
|
2023-11-24 12:16:13 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
text: "swap enabled"
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
2024-06-14 18:20:07 +00:00
|
|
|
CheckBox {
|
|
|
|
id: swapVisibleCheckBox
|
2023-11-24 12:16:13 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
text: "swap visible"
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
2024-08-02 09:24:40 +00:00
|
|
|
CheckBox {
|
|
|
|
id: communitySwapVisibleCheckBox
|
|
|
|
|
|
|
|
text: "community swap visible"
|
|
|
|
}
|
2024-06-14 18:20:07 +00:00
|
|
|
CheckBox {
|
|
|
|
id: balanceErrorCheckBox
|
2024-03-19 23:34:25 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
text: "balance error"
|
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
id: marketDataErrorCheckBox
|
|
|
|
|
|
|
|
text: "market data error"
|
2024-03-19 23:34:25 +00:00
|
|
|
}
|
2024-09-11 12:00:25 +00:00
|
|
|
ColumnLayout {
|
|
|
|
spacing: 5
|
|
|
|
Button {
|
|
|
|
text: "Sort desc"
|
|
|
|
onClicked: assetView.setSortOrder(Qt.DescendingOrder)
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
text: "Sort asc"
|
|
|
|
onClicked: assetView.setSortOrder(Qt.AscendingOrder)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ColumnLayout {
|
|
|
|
spacing: 10
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Label {
|
|
|
|
text: "Sort by:"
|
|
|
|
}
|
|
|
|
|
|
|
|
ComboBox {
|
|
|
|
id: sortValueComboBox
|
|
|
|
Layout.fillWidth: true
|
|
|
|
textRole: "text"
|
|
|
|
valueRole: "value"
|
|
|
|
displayText: currentText || ""
|
|
|
|
currentIndex: 4
|
|
|
|
model: [
|
|
|
|
{ value: SortOrderComboBox.TokenOrderCurrencyBalance, text: "TokenOrderCurrencyBalance" },
|
|
|
|
{ value: SortOrderComboBox.TokenOrderBalance, text: "TokenOrderBalance" },
|
|
|
|
{ value: SortOrderComboBox.TokenOrderCurrencyPrice, text: "TokenOrderCurrencyPrice" },
|
|
|
|
{ value: SortOrderComboBox.TokenOrder1DChange, text: "TokenOrder1DChange" },
|
|
|
|
{ value: SortOrderComboBox.TokenOrderAlpha, text: "TokenOrderAlpha" },
|
|
|
|
{ value: SortOrderComboBox.TokenOrderCustom, text: "TokenOrderCustom" }
|
|
|
|
]
|
|
|
|
|
|
|
|
onCurrentValueChanged: assetView.sortByValue(currentValue)
|
|
|
|
}
|
|
|
|
}
|
2023-12-06 10:54:36 +00:00
|
|
|
}
|
2023-11-22 19:58:02 +00:00
|
|
|
}
|
2024-06-14 18:20:07 +00:00
|
|
|
|
|
|
|
Settings {
|
|
|
|
property alias loading: loadingCheckBox.checked
|
|
|
|
property alias filterVisible: sorterVisibleCheckBox.checked
|
|
|
|
property alias customOrderAvailable: customOrderAvailableCheckBox.checked
|
|
|
|
property alias sendEnabled: sendEnabledCheckBox.checked
|
|
|
|
property alias swapEnabled: swapEnabledCheckBox.checked
|
|
|
|
property alias swapVisible: swapVisibleCheckBox.checked
|
|
|
|
property alias balanceError: balanceErrorCheckBox.checked
|
|
|
|
property alias marketDataError: marketDataErrorCheckBox.checked
|
|
|
|
}
|
2023-11-22 19:58:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// category: Views
|