2022-08-08 21:12:12 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Window 2.12
|
|
|
|
|
2023-11-24 12:16:13 +00:00
|
|
|
import StatusQ 0.1
|
2022-08-08 21:12:12 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-11-24 12:16:13 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
2022-08-08 21:12:12 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
2022-09-05 14:50:20 +00:00
|
|
|
import shared.views 1.0
|
2022-08-08 21:12:12 +00:00
|
|
|
import shared.controls 1.0
|
2023-01-19 21:14:23 +00:00
|
|
|
import shared.stores 1.0
|
2022-08-08 21:12:12 +00:00
|
|
|
|
2023-11-24 12:16:13 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
2022-08-08 21:12:12 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
import "../controls"
|
|
|
|
|
2022-10-28 17:17:16 +00:00
|
|
|
/// \beware: heavy shortcuts here, refactor to match the requirements when touching this again
|
|
|
|
/// \todo split into token history and balance views; they have different requirements that introduce unnecessary complexity
|
|
|
|
/// \todo take a declarative approach, move logic into the typed backend and remove multiple source of truth (e.g. time ranges)
|
2022-08-08 21:12:12 +00:00
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
2023-02-17 16:51:34 +00:00
|
|
|
property var token: ({})
|
2023-11-24 12:16:13 +00:00
|
|
|
property var currencyStore
|
2023-03-15 09:17:25 +00:00
|
|
|
property var networkConnectionStore
|
2023-11-24 12:16:13 +00:00
|
|
|
property var allNetworksModel
|
|
|
|
property var networkFilters
|
2022-10-28 17:17:16 +00:00
|
|
|
/*required*/ property string address: ""
|
2023-11-24 12:16:13 +00:00
|
|
|
property TokenBalanceHistoryStore balanceStore: TokenBalanceHistoryStore {}
|
2022-10-28 17:17:16 +00:00
|
|
|
|
2022-09-05 14:50:20 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
2022-09-27 08:30:18 +00:00
|
|
|
property var marketValueStore : RootStore.marketValueStore
|
2023-12-26 10:19:41 +00:00
|
|
|
readonly property string symbol: !!root.token? root.token.symbol?? "" : ""
|
|
|
|
property bool marketDetailsLoading: !!root.token? root.token.marketDetailsLoading?? false : false
|
|
|
|
property bool tokenDetailsLoading: !!root.token? root.token.detailsLoading?? false: false
|
2024-06-14 17:50:52 +00:00
|
|
|
property bool isCommunityAsset: !!root.token && !!token.communityId
|
2023-11-24 12:16:13 +00:00
|
|
|
|
|
|
|
readonly property LeftJoinModel addressPerChainModel: LeftJoinModel {
|
|
|
|
leftModel: token && token.addressPerChain ? token.addressPerChain: null
|
|
|
|
rightModel: root.allNetworksModel
|
|
|
|
joinRole: "chainId"
|
|
|
|
}
|
2022-09-27 08:30:18 +00:00
|
|
|
}
|
2022-09-05 14:50:20 +00:00
|
|
|
|
2022-09-27 08:30:18 +00:00
|
|
|
Connections {
|
|
|
|
target: walletSectionAllTokens
|
2023-01-18 09:25:36 +00:00
|
|
|
function onTokenHistoricalDataReady(tokenDetails: string) {
|
2022-09-27 08:30:18 +00:00
|
|
|
let response = JSON.parse(tokenDetails)
|
|
|
|
if (response === null) {
|
2022-10-28 17:17:16 +00:00
|
|
|
console.debug("error parsing json message for tokenHistoricalDataReady")
|
2022-09-27 08:30:18 +00:00
|
|
|
return
|
2022-09-05 14:50:20 +00:00
|
|
|
}
|
2022-09-27 08:30:18 +00:00
|
|
|
if(response.historicalData === null || response.historicalData <= 0)
|
|
|
|
return
|
2022-09-05 14:50:20 +00:00
|
|
|
|
2022-09-27 08:30:18 +00:00
|
|
|
d.marketValueStore.setTimeAndValueData(response.historicalData, response.range)
|
2022-09-05 14:50:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-08 21:12:12 +00:00
|
|
|
AssetsDetailsHeader {
|
|
|
|
id: tokenDetailsHeader
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2024-02-20 09:04:39 +00:00
|
|
|
asset.name: {
|
|
|
|
if (!token)
|
|
|
|
return ""
|
|
|
|
if (token.image)
|
|
|
|
return token.image
|
|
|
|
if (token.symbol)
|
|
|
|
return Style.png("tokens/%1".arg(token.symbol))
|
|
|
|
return ""
|
|
|
|
}
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.isImage: true
|
2023-12-08 14:11:12 +00:00
|
|
|
primaryText: token && token.name ? token.name : Constants.dummyText
|
2024-06-14 17:50:52 +00:00
|
|
|
secondaryText: token ? token.balanceText : Constants.dummyText
|
2023-11-24 12:16:13 +00:00
|
|
|
tertiaryText: {
|
2024-02-20 09:04:39 +00:00
|
|
|
if (!d.isCommunityAsset) {
|
2024-06-14 17:50:52 +00:00
|
|
|
let totalCurrencyBalance = token ? token.balance * token.marketPrice : 0
|
2024-02-20 09:04:39 +00:00
|
|
|
return currencyStore.formatCurrencyAmount(totalCurrencyBalance, currencyStore.currentCurrency)
|
|
|
|
}
|
|
|
|
return ""
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
|
|
|
decimals: token && token.decimals ? token.decimals : 4
|
|
|
|
balances: token && token.balances ? token.balances: null
|
|
|
|
allNetworksModel: root.allNetworksModel
|
|
|
|
isLoading: d.marketDetailsLoading
|
2024-02-20 09:04:39 +00:00
|
|
|
address: root.address
|
2023-03-22 22:08:36 +00:00
|
|
|
errorTooltipText: token && token.balances ? networkConnectionStore.getBlockchainNetworkDownTextForToken(token.balances): ""
|
2022-12-29 16:44:51 +00:00
|
|
|
formatBalance: function(balance){
|
2023-11-24 12:16:13 +00:00
|
|
|
return LocaleUtils.currencyAmountToLocaleString(currencyStore.getCurrencyAmount(balance, token.symbol))
|
2022-12-29 16:44:51 +00:00
|
|
|
}
|
2024-02-20 09:04:39 +00:00
|
|
|
communityTag.visible: d.isCommunityAsset
|
|
|
|
communityTag.tagPrimaryLabel.text: d.isCommunityAsset ? token.communityName: ""
|
|
|
|
communityTag.asset.name: d.isCommunityAsset ? token && !!token.communityImage ? token.communityImage : "" : ""
|
|
|
|
communityTag.asset.isImage: true
|
2022-08-08 21:12:12 +00:00
|
|
|
}
|
|
|
|
|
2022-10-28 17:17:16 +00:00
|
|
|
enum GraphType {
|
|
|
|
Price = 0,
|
|
|
|
Balance
|
|
|
|
}
|
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
StatusScrollView {
|
|
|
|
id: scrollView
|
2022-08-08 21:12:12 +00:00
|
|
|
anchors.top: tokenDetailsHeader.bottom
|
2024-02-20 09:04:39 +00:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.topMargin: 47
|
2022-10-28 17:17:16 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
width: parent.width
|
|
|
|
contentWidth: availableWidth
|
|
|
|
padding: 0
|
2022-10-28 17:17:16 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
ColumnLayout {
|
|
|
|
width: scrollView.availableWidth
|
|
|
|
spacing: 40
|
2022-10-28 17:17:16 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
Loader {
|
|
|
|
id: graphDetailLoader
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 290
|
|
|
|
active: root.visible
|
|
|
|
sourceComponent: StatusChartPanel {
|
|
|
|
id: graphDetail
|
2022-10-28 17:17:16 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
property int selectedGraphType: AssetsDetailView.GraphType.Price
|
|
|
|
property var selectedStore: d.marketValueStore
|
2022-10-28 17:17:16 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
function dataReady() {
|
|
|
|
return typeof selectedStore != "undefined"
|
|
|
|
}
|
|
|
|
function timeRangeSelected() {
|
|
|
|
return dataReady() && graphDetail.timeRangeTabBarIndex >= 0 && graphDetail.selectedTimeRange.length > 0
|
|
|
|
}
|
2023-10-06 11:00:35 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
readonly property var labelsData: {
|
|
|
|
return timeRangeSelected()
|
|
|
|
? selectedStore.timeRange[graphDetail.timeRangeTabBarIndex][graphDetail.selectedTimeRange]
|
|
|
|
: []
|
|
|
|
}
|
|
|
|
readonly property var dataRange: {
|
|
|
|
return timeRangeSelected()
|
|
|
|
? selectedStore.dataRange[graphDetail.timeRangeTabBarIndex][graphDetail.selectedTimeRange]
|
|
|
|
: []
|
|
|
|
}
|
|
|
|
readonly property var maxTicksLimit: {
|
|
|
|
return timeRangeSelected() && typeof selectedStore.maxTicks != "undefined"
|
|
|
|
? selectedStore.maxTicks[graphDetail.timeRangeTabBarIndex][graphDetail.selectedTimeRange]
|
|
|
|
: 0
|
|
|
|
}
|
2022-09-05 14:50:20 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
graphsModel: [
|
|
|
|
{text: qsTr("Price"), enabled: true, id: AssetsDetailView.GraphType.Price, visible: !d.isCommunityAsset},
|
|
|
|
{text: qsTr("Balance"), enabled: true, id: AssetsDetailView.GraphType.Balance, visible: true},
|
|
|
|
]
|
|
|
|
defaultTimeRangeIndexShown: ChartStoreBase.TimeRange.All
|
|
|
|
timeRangeModel: dataReady() && selectedStore.timeRangeTabsModel
|
|
|
|
onHeaderTabClicked: (privateIdentifier, isTimeRange) => {
|
|
|
|
if(!isTimeRange && graphDetail.selectedGraphType !== privateIdentifier) {
|
|
|
|
graphDetail.selectedGraphType = privateIdentifier
|
|
|
|
}
|
|
|
|
|
|
|
|
if(graphDetail.selectedGraphType === AssetsDetailView.GraphType.Balance) {
|
|
|
|
graphDetail.updateBalanceStore()
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isTimeRange) {
|
|
|
|
graphDetail.selectedStore = graphDetail.selectedGraphType === AssetsDetailView.GraphType.Price ? d.marketValueStore : balanceStore
|
|
|
|
}
|
|
|
|
|
|
|
|
chart.animateToNewData()
|
|
|
|
}
|
|
|
|
|
|
|
|
readonly property var dateToShortLabel: function (value) {
|
|
|
|
const range = balanceStore.timeRangeStrToEnum(graphDetail.selectedTimeRange)
|
|
|
|
return range === ChartStoreBase.TimeRange.Weekly || range === ChartStoreBase.TimeRange.Monthly ?
|
|
|
|
LocaleUtils.getDayMonth(value) :
|
|
|
|
LocaleUtils.getMonthYear(value)
|
|
|
|
}
|
2024-06-04 10:08:16 +00:00
|
|
|
chart.type: 'line'
|
|
|
|
chart.labels: RootStore.marketHistoryIsLoading ? [] : graphDetail.labelsData
|
|
|
|
chart.datasets: {
|
|
|
|
return [{
|
|
|
|
xAxisId: 'x-axis-1',
|
|
|
|
yAxisId: 'y-axis-1',
|
|
|
|
backgroundColor: (Theme.palette.name === "dark") ? 'rgba(136, 176, 255, 0.2)' : 'rgba(67, 96, 223, 0.2)',
|
|
|
|
borderColor: (Theme.palette.name === "dark") ? 'rgba(136, 176, 255, 1)' : 'rgba(67, 96, 223, 1)',
|
|
|
|
borderWidth: graphDetail.selectedGraphType === AssetsDetailView.GraphType.Price ? 3 : 2,
|
|
|
|
pointRadius: 0,
|
|
|
|
data: RootStore.marketHistoryIsLoading ? [] : graphDetail.dataRange,
|
|
|
|
parsing: false,
|
|
|
|
}]
|
2024-02-20 09:04:39 +00:00
|
|
|
}
|
|
|
|
|
2024-06-04 10:08:16 +00:00
|
|
|
chart.options: {
|
2024-02-20 09:04:39 +00:00
|
|
|
return {
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
responsive: true,
|
|
|
|
legend: {
|
|
|
|
display: false
|
2023-10-06 11:00:35 +00:00
|
|
|
},
|
2024-02-20 09:04:39 +00:00
|
|
|
elements: {
|
|
|
|
line: {
|
|
|
|
cubicInterpolationMode: 'monotone' // without it interpolation makes the line too curvy that can extend horizontally farther then data points
|
2022-09-05 14:50:20 +00:00
|
|
|
}
|
2023-10-06 11:00:35 +00:00
|
|
|
},
|
2024-02-20 09:04:39 +00:00
|
|
|
//TODO enable zoom
|
|
|
|
//zoom: {
|
|
|
|
// enabled: true,
|
|
|
|
// drag: true,
|
|
|
|
// speed: 0.1,
|
|
|
|
// threshold: 2
|
|
|
|
//},
|
|
|
|
//pan:{enabled:true,mode:'x'},
|
|
|
|
tooltips: {
|
|
|
|
format: {
|
|
|
|
enabled: graphDetail.selectedGraphType === AssetsDetailView.GraphType.Balance,
|
|
|
|
callback: function (value) {
|
|
|
|
return graphDetail.dateToShortLabel(value)
|
|
|
|
},
|
|
|
|
valueCallback: function(value) {
|
|
|
|
return LocaleUtils.currencyAmountToLocaleString({ amount: value, symbol: RootStore.currencyStore.currentCurrencySymbol, displayDecimals: 2 })
|
|
|
|
}
|
2022-09-27 08:30:18 +00:00
|
|
|
},
|
2024-02-20 09:04:39 +00:00
|
|
|
intersect: false,
|
|
|
|
displayColors: false,
|
|
|
|
callbacks: {
|
|
|
|
label: function(tooltipItem, data) {
|
|
|
|
let label = data.datasets[tooltipItem.datasetIndex].label || '';
|
|
|
|
if (label) {
|
|
|
|
label += ': ';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (graphDetail.selectedGraphType === AssetsDetailView.GraphType.Balance)
|
|
|
|
return label + tooltipItem.yLabel // already formatted in tooltips.value.callback
|
|
|
|
|
|
|
|
const value = LocaleUtils.currencyAmountToLocaleString({ amount: tooltipItem.yLabel, symbol: RootStore.currencyStore.currentCurrencySymbol, displayDecimals: 2 })
|
|
|
|
return label + value
|
|
|
|
}
|
2023-09-15 17:27:00 +00:00
|
|
|
}
|
2024-02-20 09:04:39 +00:00
|
|
|
},
|
|
|
|
scales: {
|
|
|
|
labelFormat: {
|
|
|
|
callback: function (value) {
|
|
|
|
return graphDetail.dateToShortLabel(value)
|
2022-09-05 14:50:20 +00:00
|
|
|
},
|
2024-02-20 09:04:39 +00:00
|
|
|
enabled: graphDetail.selectedGraphType === AssetsDetailView.GraphType.Balance,
|
|
|
|
},
|
|
|
|
xAxes: [{
|
|
|
|
id: 'x-axis-1',
|
|
|
|
position: 'bottom',
|
|
|
|
type: graphDetail.selectedGraphType === AssetsDetailView.GraphType.Price ? 'category' : 'time',
|
|
|
|
gridLines: {
|
|
|
|
drawOnChartArea: false,
|
|
|
|
drawBorder: false,
|
|
|
|
drawTicks: false,
|
|
|
|
},
|
|
|
|
ticks: {
|
|
|
|
fontSize: 10,
|
|
|
|
fontColor: (Theme.palette.name === "dark") ? '#909090' : '#939BA1',
|
|
|
|
padding: 16,
|
|
|
|
maxRotation: 0,
|
|
|
|
minRotation: 0,
|
|
|
|
maxTicksLimit: graphDetail.maxTicksLimit,
|
|
|
|
},
|
|
|
|
time: {
|
|
|
|
minUnit: 'day' // for '7days' timeframe, otherwise labels are '10PM', '10AM', '10PM', etc
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
position: 'left',
|
|
|
|
id: 'y-axis-1',
|
|
|
|
gridLines: {
|
|
|
|
borderDash: [8, 4],
|
|
|
|
drawBorder: false,
|
|
|
|
drawTicks: false,
|
|
|
|
color: (Theme.palette.name === "dark") ? '#909090' : '#939BA1'
|
|
|
|
},
|
|
|
|
beforeDataLimits: (axis) => {
|
|
|
|
axis.paddingTop = 25;
|
|
|
|
axis.paddingBottom = 0;
|
|
|
|
},
|
|
|
|
afterDataLimits: (axis) => {
|
|
|
|
if(axis.min < 0)
|
|
|
|
axis.min = 0;
|
|
|
|
},
|
|
|
|
ticks: {
|
|
|
|
fontSize: 10,
|
|
|
|
fontColor: (Theme.palette.name === "dark") ? '#909090' : '#939BA1',
|
|
|
|
padding: 8,
|
|
|
|
callback: function(value, index, ticks) {
|
|
|
|
return LocaleUtils.numberToLocaleString(value)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2022-09-05 14:50:20 +00:00
|
|
|
}
|
2022-10-28 17:17:16 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
LoadingGraphView {
|
|
|
|
anchors.fill: chart
|
|
|
|
active: RootStore.marketHistoryIsLoading
|
|
|
|
}
|
2023-01-10 13:04:23 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
function updateBalanceStore() {
|
|
|
|
let selectedTimeRangeEnum = balanceStore.timeRangeStrToEnum(graphDetail.selectedTimeRange)
|
2022-11-15 21:48:59 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
let currencySymbol = RootStore.currencyStore.currentCurrency
|
2024-03-28 11:54:39 +00:00
|
|
|
if(!balanceStore.hasData(root.address, token.symbol, currencySymbol, selectedTimeRangeEnum)) {
|
|
|
|
RootStore.fetchHistoricalBalanceForTokenAsJson(root.address, token.symbol, currencySymbol, selectedTimeRangeEnum)
|
2024-02-20 09:04:39 +00:00
|
|
|
}
|
|
|
|
}
|
2022-11-15 21:48:59 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
Connections {
|
|
|
|
target: balanceStore
|
|
|
|
function onNewDataReady(address, tokenSymbol, currencySymbol, timeRange) {
|
|
|
|
if (timeRange === balanceStore.timeRangeStrToEnum(graphDetail.selectedTimeRange)) {
|
|
|
|
chart.updateToNewData()
|
|
|
|
}
|
|
|
|
}
|
2022-10-28 17:17:16 +00:00
|
|
|
}
|
2022-11-15 21:48:59 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
Connections {
|
|
|
|
target: root
|
|
|
|
function onAddressChanged() { graphDetail.updateBalanceStore() }
|
|
|
|
}
|
2022-11-15 21:48:59 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
Connections {
|
|
|
|
target: d
|
|
|
|
function onSymbolChanged() { if (d.symbol) graphDetail.updateBalanceStore() }
|
|
|
|
}
|
|
|
|
}
|
2022-10-28 17:17:16 +00:00
|
|
|
}
|
2022-08-08 21:12:12 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
RowLayout {
|
2022-08-08 21:12:12 +00:00
|
|
|
Layout.fillWidth: true
|
2024-02-20 09:04:39 +00:00
|
|
|
visible: !d.isCommunityAsset
|
|
|
|
InformationTile {
|
|
|
|
maxWidth: parent.width
|
2024-05-27 06:55:25 +00:00
|
|
|
objectName: "marketCapInformationTile"
|
2024-02-20 09:04:39 +00:00
|
|
|
primaryText: qsTr("Market Cap")
|
|
|
|
secondaryText: token && token.marketDetails && token.marketDetails.marketCap ? LocaleUtils.currencyAmountToLocaleString(token.marketDetails.marketCap) : Constants.dummyText
|
|
|
|
isLoading: d.marketDetailsLoading
|
|
|
|
}
|
|
|
|
InformationTile {
|
|
|
|
maxWidth: parent.width
|
2024-05-27 06:55:25 +00:00
|
|
|
objectName: "dayLowInformationTile"
|
2024-02-20 09:04:39 +00:00
|
|
|
primaryText: qsTr("Day Low")
|
|
|
|
secondaryText: token && token.marketDetails && token.marketDetails.lowDay ? LocaleUtils.currencyAmountToLocaleString(token.marketDetails.lowDay) : Constants.dummyText
|
|
|
|
isLoading: d.marketDetailsLoading
|
|
|
|
}
|
|
|
|
InformationTile {
|
|
|
|
maxWidth: parent.width
|
2024-05-27 06:55:25 +00:00
|
|
|
objectName: "dayHighInformationTile"
|
2024-02-20 09:04:39 +00:00
|
|
|
primaryText: qsTr("Day High")
|
|
|
|
secondaryText: token && token.marketDetails && token.marketDetails.highDay ? LocaleUtils.currencyAmountToLocaleString(token.marketDetails.highDay) : Constants.dummyText
|
|
|
|
isLoading: d.marketDetailsLoading
|
|
|
|
}
|
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
InformationTile {
|
|
|
|
readonly property double changePctHour: token && token.marketDetails ? token.marketDetails.changePctHour : 0
|
|
|
|
maxWidth: parent.width
|
2024-05-27 06:55:25 +00:00
|
|
|
objectName: "hourInformationTile"
|
2024-02-20 09:04:39 +00:00
|
|
|
primaryText: qsTr("Hour")
|
|
|
|
secondaryText: "%1%".arg(LocaleUtils.numberToLocaleString(changePctHour, 2))
|
|
|
|
secondaryLabel.customColor: changePctHour === 0 ? Theme.palette.directColor1 :
|
|
|
|
changePctHour < 0 ? Theme.palette.dangerColor1 :
|
2023-03-15 09:17:25 +00:00
|
|
|
Theme.palette.successColor1
|
2024-02-20 09:04:39 +00:00
|
|
|
isLoading: d.marketDetailsLoading
|
|
|
|
}
|
|
|
|
InformationTile {
|
|
|
|
readonly property double changePctDay: token && token.marketDetails ? token.marketDetails.changePctDay : 0
|
|
|
|
maxWidth: parent.width
|
|
|
|
primaryText: qsTr("Day")
|
2024-05-27 06:55:25 +00:00
|
|
|
objectName: "dayInformationTile"
|
2024-02-20 09:04:39 +00:00
|
|
|
secondaryText: "%1%".arg(LocaleUtils.numberToLocaleString(changePctDay, 2))
|
|
|
|
secondaryLabel.customColor: changePctDay === 0 ? Theme.palette.directColor1 :
|
|
|
|
changePctDay < 0 ? Theme.palette.dangerColor1 :
|
|
|
|
Theme.palette.successColor1
|
|
|
|
isLoading: d.marketDetailsLoading
|
|
|
|
}
|
|
|
|
InformationTile {
|
|
|
|
readonly property double changePct24hour: token && token.marketDetails ? token.marketDetails.changePct24hour : 0
|
|
|
|
maxWidth: parent.width
|
|
|
|
primaryText: qsTr("24 Hours")
|
2024-05-27 06:55:25 +00:00
|
|
|
objectName: "24HoursInformationTile"
|
2024-02-20 09:04:39 +00:00
|
|
|
secondaryText: "%1%".arg(LocaleUtils.numberToLocaleString(changePct24hour, 2))
|
|
|
|
secondaryLabel.customColor: changePct24hour === 0 ? Theme.palette.directColor1 :
|
|
|
|
changePct24hour < 0 ? Theme.palette.dangerColor1 :
|
|
|
|
Theme.palette.successColor1
|
|
|
|
isLoading: d.marketDetailsLoading
|
|
|
|
}
|
2022-08-08 21:12:12 +00:00
|
|
|
}
|
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
Flow {
|
|
|
|
id: detailsFlow
|
2022-08-08 21:12:12 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
readonly property bool isOverflowing: detailsFlow.width - websiteBlock.width - tokenDescriptionText.width < 24
|
2022-08-08 21:12:12 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
spacing: 24
|
|
|
|
|
|
|
|
StatusTabBar {
|
|
|
|
width: parent.width
|
|
|
|
StatusTabButton {
|
|
|
|
leftPadding: 0
|
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("Overview")
|
2022-08-08 21:12:12 +00:00
|
|
|
}
|
2024-02-20 09:04:39 +00:00
|
|
|
visible: tokenDescriptionText.visible
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusTextWithLoadingState {
|
|
|
|
id: tokenDescriptionText
|
|
|
|
width: Math.max(536 , scrollView.availableWidth - websiteBlock.width - 24)
|
|
|
|
|
|
|
|
font.pixelSize: 15
|
|
|
|
lineHeight: 22
|
|
|
|
lineHeightMode: Text.FixedHeight
|
|
|
|
text: token && token.description ? token.description : d.tokenDetailsLoading ? Constants.dummyText: ""
|
|
|
|
customColor: Theme.palette.directColor1
|
|
|
|
elide: Text.ElideRight
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
textFormat: Qt.RichText
|
|
|
|
loading: d.tokenDetailsLoading
|
|
|
|
visible: !!text
|
|
|
|
}
|
|
|
|
|
|
|
|
GridLayout{
|
|
|
|
columnSpacing: 10
|
|
|
|
rowSpacing: 10
|
|
|
|
flow: detailsFlow.isOverflowing ? GridLayout.LeftToRight: GridLayout.TopToBottom
|
|
|
|
InformationTileAssetDetails {
|
|
|
|
id: websiteBlock
|
|
|
|
Layout.preferredWidth: 272
|
|
|
|
visible: !d.isCommunityAsset
|
|
|
|
primaryText: qsTr("Website")
|
|
|
|
content: InformationTag {
|
|
|
|
asset.name : "browser"
|
|
|
|
tagPrimaryLabel.text: SQUtils.Utils.stripHttpsAndwwwFromUrl(token.websiteUrl)
|
2023-11-24 12:16:13 +00:00
|
|
|
visible: typeof token != "undefined" && token && token.websiteUrl !== ""
|
2023-01-12 23:26:48 +00:00
|
|
|
customBackground: Component {
|
|
|
|
Rectangle {
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
border.width: 1
|
|
|
|
border.color: "transparent"
|
|
|
|
radius: 36
|
|
|
|
}
|
|
|
|
}
|
2022-08-08 21:12:12 +00:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
2023-11-24 12:16:13 +00:00
|
|
|
onClicked: Global.openLink(token.websiteUrl)
|
2022-08-08 21:12:12 +00:00
|
|
|
}
|
|
|
|
}
|
2024-02-20 09:04:39 +00:00
|
|
|
}
|
2022-08-08 21:12:12 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
InformationTileAssetDetails {
|
|
|
|
Layout.preferredWidth: 272
|
|
|
|
visible: d.isCommunityAsset
|
|
|
|
primaryText: qsTr("Minted by")
|
|
|
|
content: InformationTag {
|
|
|
|
tagPrimaryLabel.text: token && token.communityName ? token.communityName : ""
|
|
|
|
asset.name: token && token.communityImage ? token.communityImage : ""
|
|
|
|
asset.isImage: true
|
|
|
|
customBackground: Component {
|
|
|
|
Rectangle {
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
border.width: 1
|
|
|
|
border.color: "transparent"
|
|
|
|
radius: 36
|
2023-04-04 12:09:36 +00:00
|
|
|
}
|
|
|
|
}
|
2024-02-20 09:04:39 +00:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: Global.switchToCommunity(token.communityId)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
InformationTileAssetDetails {
|
|
|
|
Layout.minimumWidth: 272
|
|
|
|
Layout.preferredWidth: implicitWidth
|
|
|
|
primaryText: qsTr("Contract")
|
|
|
|
content: GridLayout {
|
|
|
|
columnSpacing: 10
|
|
|
|
rowSpacing: 10
|
|
|
|
flow: detailsFlow.isOverflowing ? GridLayout.LeftToRight : GridLayout.TopToBottom
|
|
|
|
Repeater {
|
|
|
|
model: SortFilterProxyModel {
|
|
|
|
sourceModel: d.addressPerChainModel
|
|
|
|
filters: ExpressionFilter {
|
|
|
|
expression: root.networkFilters.split(":").includes(model.chainId+"")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delegate: InformationTag {
|
|
|
|
asset.name: Style.svg("tiny/" + model.iconUrl)
|
|
|
|
asset.isImage: true
|
|
|
|
tagPrimaryLabel.text: model.chainName
|
|
|
|
tagSecondaryLabel.text: SQUtils.Utils.elideText(model.address, 2,4)
|
|
|
|
customBackground: Component {
|
|
|
|
Rectangle {
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
border.width: 1
|
|
|
|
border.color: "transparent"
|
|
|
|
radius: 36
|
|
|
|
}
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
2023-01-12 23:26:48 +00:00
|
|
|
}
|
|
|
|
}
|
2022-08-08 21:12:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|