fix: Removed duplicated text in Token Popup by reusing existing supportedTokenSources mapping (#15587)
fixes #14366
This commit is contained in:
parent
4b30b12fee
commit
ecec94b1ff
|
@ -73,7 +73,7 @@ SplitView {
|
|||
modal: false
|
||||
closePolicy: Popup.NoAutoClose
|
||||
|
||||
sourceName: delegate.name
|
||||
title: qsTr("%1 Token List").arg(delegate.name)
|
||||
sourceImage: delegate.image
|
||||
sourceUrl: delegate.source
|
||||
sourceVersion: delegate.version
|
||||
|
|
|
@ -89,12 +89,20 @@ StatusListView {
|
|||
readonly property TokenListPopup popup: TokenListPopup {
|
||||
parent: root
|
||||
|
||||
sourceName: delegate.name
|
||||
sourceImage: delegate.image
|
||||
sourceUrl: delegate.source
|
||||
sourceVersion: delegate.version
|
||||
tokensCount: delegate.tokensCount
|
||||
|
||||
title: {
|
||||
// Similar to Constants.getSupportedTokenSourceImage
|
||||
if (delegate.name === Constants.supportedTokenSources.uniswap ||
|
||||
delegate.name === Constants.supportedTokenSources.status)
|
||||
return delegate.name;
|
||||
|
||||
return qsTr("%1 Token List").arg(delegate.name)
|
||||
}
|
||||
|
||||
tokensListModel: SortFilterProxyModel {
|
||||
sourceModel: root.tokensListModel
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import shared.panels 1.0
|
|||
StatusDialog {
|
||||
id: root
|
||||
|
||||
required property string sourceName
|
||||
required property string sourceImage
|
||||
required property string sourceUrl
|
||||
required property string sourceVersion
|
||||
|
@ -65,7 +64,7 @@ StatusDialog {
|
|||
}
|
||||
|
||||
header: StatusDialogHeader {
|
||||
headline.title: qsTr("%1 Token List").arg(root.sourceName)
|
||||
headline.title: root.title
|
||||
headline.subtitle: qsTr("%n token(s)", "", root.tokensCount)
|
||||
actions.closeButton.onClicked: root.close()
|
||||
leftComponent: StatusSmartIdenticon {
|
||||
|
|
|
@ -19,20 +19,20 @@ QtObject {
|
|||
readonly property var sourcesOfTokensModel: SortFilterProxyModel {
|
||||
sourceModel: !!root._allTokensModule ? root._allTokensModule.sourcesOfTokensModel : null
|
||||
proxyRoles: FastExpressionRole {
|
||||
function sourceImage(sourceKey) {
|
||||
return Constants.getSupportedTokenSourceImage(sourceKey)
|
||||
function sourceImage(name) {
|
||||
return Constants.getSupportedTokenSourceImage(name)
|
||||
}
|
||||
name: "image"
|
||||
expression: sourceImage(model.key)
|
||||
expectedRoles: ["key"]
|
||||
expression: sourceImage(model.name)
|
||||
expectedRoles: ["name"]
|
||||
}
|
||||
filters: AnyOf {
|
||||
ValueFilter {
|
||||
roleName: "key"
|
||||
roleName: "name"
|
||||
value: Constants.supportedTokenSources.uniswap
|
||||
}
|
||||
ValueFilter {
|
||||
roleName: "key"
|
||||
roleName: "name"
|
||||
value: Constants.supportedTokenSources.status
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1194,11 +1194,11 @@ QtObject {
|
|||
return url.indexOf("DEFAULT-TOKEN") !== -1
|
||||
}
|
||||
|
||||
function getSupportedTokenSourceImage(key, useDefault=true) {
|
||||
if (key === supportedTokenSources.uniswap)
|
||||
function getSupportedTokenSourceImage(name, useDefault=true) {
|
||||
if (name === supportedTokenSources.uniswap)
|
||||
return Style.png("tokens/UNI")
|
||||
|
||||
if (key === supportedTokenSources.status)
|
||||
if (name === supportedTokenSources.status)
|
||||
return Style.png("tokens/SNT")
|
||||
|
||||
if (useDefault)
|
||||
|
|
Loading…
Reference in New Issue