parent
3bd6fe0fdf
commit
ddb9caf4d7
|
@ -60,6 +60,7 @@ proc setAssets(self: Module, tokens: seq[WalletTokenDto]) =
|
|||
t.changePctHour,
|
||||
t.changePctDay,
|
||||
t.changePct24hour,
|
||||
t.change24hour,
|
||||
)
|
||||
items.add(item)
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ method refreshWalletAccounts*(self: Module) =
|
|||
t.changePctHour,
|
||||
t.changePctDay,
|
||||
t.changePct24hour,
|
||||
t.change24hour,
|
||||
))
|
||||
)
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ proc setAssetsAndBalance(self: Module, tokens: seq[WalletTokenDto]) =
|
|||
t.changePctHour,
|
||||
t.changePctDay,
|
||||
t.changePct24hour,
|
||||
t.change24hour,
|
||||
)
|
||||
items.add(item)
|
||||
totalCurrencyBalanceForAllAssets += t.enabledNetworkBalance.currencybalance
|
||||
|
|
|
@ -23,6 +23,7 @@ type
|
|||
changePctHour: string
|
||||
changePctDay: string
|
||||
changePct24hour: string
|
||||
change24hour: string
|
||||
|
||||
proc initItem*(
|
||||
name, symbol: string,
|
||||
|
@ -42,6 +43,7 @@ proc initItem*(
|
|||
changePctHour: string,
|
||||
changePctDay: string,
|
||||
changePct24hour: string,
|
||||
change24hour: string,
|
||||
): Item =
|
||||
result.name = name
|
||||
result.symbol = symbol
|
||||
|
@ -62,6 +64,7 @@ proc initItem*(
|
|||
result.changePctHour = changePctHour
|
||||
result.changePctDay = changePctDay
|
||||
result.changePct24hour = changePct24hour
|
||||
result.change24hour = change24hour
|
||||
|
||||
proc `$`*(self: Item): string =
|
||||
result = fmt"""AllTokensItem(
|
||||
|
@ -82,6 +85,7 @@ proc `$`*(self: Item): string =
|
|||
changePctHour: {self.changePctHour},
|
||||
changePctDay: {self.changePctDay},
|
||||
changePct24hour: {self.changePct24hour},
|
||||
change24hour: {self.change24hour},
|
||||
]"""
|
||||
|
||||
proc getName*(self: Item): string =
|
||||
|
@ -137,3 +141,6 @@ proc getChangePctDay*(self: Item): string =
|
|||
|
||||
proc getChangePct24hour*(self: Item): string =
|
||||
return self.changePct24hour
|
||||
|
||||
proc getChange24hour*(self: Item): string =
|
||||
return self.change24hour
|
||||
|
|
|
@ -22,6 +22,7 @@ type
|
|||
ChangePctHour
|
||||
ChangePctDay
|
||||
ChangePct24hour
|
||||
Change24hour
|
||||
|
||||
QtObject:
|
||||
type
|
||||
|
@ -75,6 +76,7 @@ QtObject:
|
|||
ModelRole.ChangePctHour.int:"changePctHour",
|
||||
ModelRole.ChangePctDay.int:"changePctDay",
|
||||
ModelRole.ChangePct24hour.int:"changePct24hour",
|
||||
ModelRole.Change24hour.int:"change24hour",
|
||||
}.toTable
|
||||
|
||||
method data(self: Model, index: QModelIndex, role: int): QVariant =
|
||||
|
@ -124,7 +126,8 @@ QtObject:
|
|||
result = newQVariant(item.getChangePctDay())
|
||||
of ModelRole.ChangePct24hour:
|
||||
result = newQVariant(item.getChangePct24hour())
|
||||
|
||||
of ModelRole.Change24hour:
|
||||
result = newQVariant(item.getChange24hour())
|
||||
|
||||
proc rowData(self: Model, index: int, column: string): string {.slot.} =
|
||||
if (index >= self.items.len):
|
||||
|
@ -148,7 +151,7 @@ QtObject:
|
|||
of "changePctHour": result = $item.getChangePctHour()
|
||||
of "changePctDay": result = $item.getChangePctDay()
|
||||
of "changePct24hour": result = $item.getChangePct24hour()
|
||||
|
||||
of "change24hour": result = $item.getChange24hour()
|
||||
|
||||
proc setItems*(self: Model, items: seq[Item]) =
|
||||
self.beginResetModel()
|
||||
|
|
|
@ -27,6 +27,7 @@ type
|
|||
changePctHour*: string
|
||||
changePctDay*: string
|
||||
changePct24hour*: string
|
||||
change24hour*: string
|
||||
|
||||
proc newTokenDto*(
|
||||
name: string,
|
||||
|
@ -46,6 +47,7 @@ proc newTokenDto*(
|
|||
changePctHour: string = "",
|
||||
changePctDay: string = "",
|
||||
changePct24hour: string = "",
|
||||
change24hour: string = "",
|
||||
): TokenDto =
|
||||
return TokenDto(
|
||||
name: name,
|
||||
|
@ -65,6 +67,7 @@ proc newTokenDto*(
|
|||
changePctHour: changePctHour,
|
||||
changePctDay: changePctDay,
|
||||
changePct24hour: changePct24hour,
|
||||
change24hour: change24hour,
|
||||
)
|
||||
|
||||
proc toTokenDto*(jsonObj: JsonNode, isVisible: bool, hasIcon: bool = false, isCustom: bool = true): TokenDto =
|
||||
|
@ -88,6 +91,7 @@ proc toTokenDto*(jsonObj: JsonNode, isVisible: bool, hasIcon: bool = false, isCu
|
|||
discard jsonObj.getProp("changePctHour", result.changePctHour)
|
||||
discard jsonObj.getProp("changePctDay", result.changePctDay)
|
||||
discard jsonObj.getProp("changePct24hour", result.changePct24hour)
|
||||
discard jsonObj.getProp("change24hour", result.change24hour)
|
||||
|
||||
result.isVisible = isVisible
|
||||
|
||||
|
|
|
@ -292,6 +292,7 @@ const prepareTokensTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
|||
var changePctHour: string = ""
|
||||
var changePctDay: string = ""
|
||||
var changePct24hour: string = ""
|
||||
var change24hour: string = ""
|
||||
|
||||
if(marketValues.hasKey(networkDto.nativeCurrencySymbol)):
|
||||
marketCap = marketValues[networkDto.nativeCurrencySymbol]["MKTCAP"]
|
||||
|
@ -300,6 +301,7 @@ const prepareTokensTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
|||
changePctHour = marketValues[networkDto.nativeCurrencySymbol]["CHANGEPCTHOUR"]
|
||||
changePctDay = marketValues[networkDto.nativeCurrencySymbol]["CHANGEPCTDAY"]
|
||||
changePct24hour = marketValues[networkDto.nativeCurrencySymbol]["CHANGEPCT24HOUR"]
|
||||
change24hour = marketValues[networkDto.nativeCurrencySymbol]["CHANGE24HOUR"]
|
||||
|
||||
builtTokens.add(WalletTokenDto(
|
||||
name: networkDto.nativeCurrencyName,
|
||||
|
@ -322,6 +324,7 @@ const prepareTokensTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
|||
changePctHour: changePctHour,
|
||||
changePctDay: changePctDay,
|
||||
changePct24hour: changePct24hour,
|
||||
change24hour: change24hour,
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -359,6 +362,7 @@ const prepareTokensTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
|||
var changePctHour: string = ""
|
||||
var changePctDay: string = ""
|
||||
var changePct24hour: string = ""
|
||||
var change24hour: string = ""
|
||||
var description: string = ""
|
||||
var assetWebsiteUrl: string = ""
|
||||
var builtOn: string = ""
|
||||
|
@ -377,6 +381,7 @@ const prepareTokensTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
|||
changePctHour = marketValues[tokenDto.symbol]["CHANGEPCTHOUR"]
|
||||
changePctDay = marketValues[tokenDto.symbol]["CHANGEPCTDAY"]
|
||||
changePct24hour = marketValues[tokenDto.symbol]["CHANGEPCT24HOUR"]
|
||||
change24hour = marketValues[tokenDto.symbol]["CHANGE24HOUR"]
|
||||
|
||||
let tokenDescription = description.multiReplace([("|", ""),("Facebook",""),("Telegram",""),("Discord",""),("Youtube",""),("YouTube",""),("Instagram",""),("Reddit",""),("Github",""),("GitHub",""),("Whitepaper",""),("Medium",""),("Weibo",""),("LinkedIn",""),("Litepaper",""),("KakaoTalk",""),("BitcoinTalk",""),("Slack",""),("Docs",""),("Kakao",""),("Gitter","")])
|
||||
builtTokens.add(WalletTokenDto(
|
||||
|
@ -399,7 +404,8 @@ const prepareTokensTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
|||
lowDay: lowDay,
|
||||
changePctHour: changePctHour,
|
||||
changePctDay: changePctDay,
|
||||
changePct24hour: changePct24hour
|
||||
changePct24hour: changePct24hour,
|
||||
change24hour: change24hour,
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ type
|
|||
changePctHour*: string
|
||||
changePctDay*: string
|
||||
changePct24hour*: string
|
||||
change24hour*: string
|
||||
|
||||
type
|
||||
WalletAccountDto* = ref object of RootObj
|
||||
|
@ -117,6 +118,7 @@ proc toWalletTokenDto*(jsonObj: JsonNode): WalletTokenDto =
|
|||
discard jsonObj.getProp("changePctHour", result.changePctHour)
|
||||
discard jsonObj.getProp("changePctDay", result.changePctDay)
|
||||
discard jsonObj.getProp("changePct24hour", result.changePct24hour)
|
||||
discard jsonObj.getProp("change24hour", result.change24hour)
|
||||
|
||||
var totalBalanceObj: JsonNode
|
||||
if(jsonObj.getProp("totalBalance", totalBalanceObj)):
|
||||
|
@ -156,5 +158,6 @@ proc walletTokenDtoToJson*(dto: WalletTokenDto): JsonNode =
|
|||
"lowDay": dto.lowDay,
|
||||
"changePctHour": dto.changePctHour,
|
||||
"changePctDay": dto.changePctDay,
|
||||
"changePct24hour": dto.changePct24hour
|
||||
"changePct24hour": dto.changePct24hour,
|
||||
"change24hour": dto.change24hour
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import QtQuick 2.13
|
|||
import QtQuick.Controls 2.14
|
||||
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
import StatusQ.Controls 0.1
|
||||
import StatusQ.Components 0.1
|
||||
|
||||
|
@ -39,6 +40,7 @@ Item {
|
|||
}
|
||||
]
|
||||
}
|
||||
|
||||
delegate: StatusListItem {
|
||||
readonly property int balance: enabledNetworkBalance // Needed for the tests
|
||||
objectName: "AssetView_TokenListItem_" + symbol
|
||||
|
@ -47,10 +49,39 @@ Item {
|
|||
subTitle: qsTr("%1 %2").arg(Utils.toLocaleString(enabledNetworkBalance, RootStore.locale, {"currency": true})).arg(symbol)
|
||||
image.source: symbol ? Style.png("tokens/" + symbol) : ""
|
||||
components: [
|
||||
StatusBaseText {
|
||||
font.pixelSize: 15
|
||||
font.strikeout: false
|
||||
text: enabledNetworkCurrencyBalance.toLocaleCurrencyString(Qt.locale(), RootStore.currencyStore.currentCurrencySymbol)
|
||||
Column {
|
||||
id: valueColumn
|
||||
property string textColor: Math.sign(Number(changePct24hour)) === 0 ? Theme.palette.baseColor1 :
|
||||
Math.sign(Number(changePct24hour)) === -1 ? Theme.palette.dangerColor1 :
|
||||
Theme.palette.successColor1
|
||||
StatusBaseText {
|
||||
anchors.right: parent.right
|
||||
font.pixelSize: 15
|
||||
font.strikeout: false
|
||||
text: enabledNetworkCurrencyBalance.toLocaleCurrencyString(Qt.locale(), RootStore.currencyStore.currentCurrencySymbol)
|
||||
}
|
||||
Row {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: 8
|
||||
StatusBaseText {
|
||||
id: change24HourText
|
||||
font.pixelSize: 15
|
||||
font.strikeout: false
|
||||
color: valueColumn.textColor
|
||||
text: change24hour !== "" ? change24hour : "---"
|
||||
}
|
||||
Rectangle {
|
||||
width: 1
|
||||
height: change24HourText.implicitHeight
|
||||
color: Theme.palette.directColor9
|
||||
}
|
||||
StatusBaseText {
|
||||
font.pixelSize: 15
|
||||
font.strikeout: false
|
||||
color: valueColumn.textColor
|
||||
text: changePct24hour !== "" ? "%1%".arg(changePct24hour) : "---"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
onClicked: {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 655a406b0c8827a81d4a355bf29c397f731037e8
|
||||
Subproject commit 6376ad6e2df3186883756d6258bed344035fb856
|
Loading…
Reference in New Issue