feat(@desktop/wallet): Added missing filter types (#12109)

This commit is contained in:
Cuteivist 2023-09-11 13:43:21 +02:00 committed by GitHub
parent 50ffbb9dce
commit 3548cee149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 16 deletions

View File

@ -40,6 +40,9 @@ QtObject:
proc delete*(self: ActivityEntry) =
self.QObject.delete
proc isInTransactionType(self: ActivityEntry): bool =
return self.metadata.activityType == backend.ActivityType.Receive or self.metadata.activityType == backend.ActivityType.Mint
proc newMultiTransactionActivityEntry*(metadata: backend.ActivityEntry, extradata: ExtraData, valueConvertor: AmountToCurrencyConvertor): ActivityEntry =
new(result, delete)
result.valueConvertor = valueConvertor
@ -47,8 +50,8 @@ QtObject:
result.extradata = extradata
result.noAmount = newCurrencyAmount()
result.amountCurrency = valueConvertor(
if metadata.activityType == backend.ActivityType.Receive: metadata.amountIn else: metadata.amountOut,
if metadata.activityType == backend.ActivityType.Receive: metadata.symbolIn.get("") else: metadata.symbolOut.get(""),
if result.isInTransactionType(): metadata.amountIn else: metadata.amountOut,
if result.isInTransactionType(): metadata.symbolIn.get("") else: metadata.symbolOut.get(""),
)
result.setup()
@ -59,8 +62,8 @@ QtObject:
result.extradata = extradata
result.amountCurrency = valueConvertor(
if metadata.activityType == backend.ActivityType.Receive: metadata.amountIn else: metadata.amountOut,
if metadata.activityType == backend.ActivityType.Receive: metadata.symbolIn.get("") else: metadata.symbolOut.get(""),
if result.isInTransactionType(): metadata.amountIn else: metadata.amountOut,
if result.isInTransactionType(): metadata.symbolIn.get("") else: metadata.symbolOut.get(""),
)
result.noAmount = newCurrencyAmount()
@ -83,9 +86,6 @@ QtObject:
metadata:{$self.metadata},
)"""
proc isInTransactionType(self: ActivityEntry): bool =
return self.metadata.activityType == backend.ActivityType.Receive or self.metadata.activityType == backend.ActivityType.Mint
# TODO: is this the right way to pass transaction identity? Why not use the instance?
proc getId*(self: ActivityEntry): string {.slot.} =
if self.isMultiTransaction():

View File

@ -76,12 +76,14 @@ Column {
return qsTr("Send")
case Constants.TransactionType.Receive:
return qsTr("Receive")
case Constants.TransactionType.Buy:
return qsTr("Buy")
case Constants.TransactionType.Swap:
return qsTr("Swap")
case Constants.TransactionType.Bridge:
return qsTr("Bridge")
case Constants.TransactionType.ContractDeployment:
return qsTr("Contract Deployment")
case Constants.TransactionType.Mint:
return qsTr("Mint")
default:
console.warn("Unhandled type :: ",activityFilterStore.typeFilters[index])
return ""
@ -91,12 +93,14 @@ Column {
return "send"
case Constants.TransactionType.Receive:
return "receive"
case Constants.TransactionType.Buy:
return "token"
case Constants.TransactionType.Swap:
return "swap"
case Constants.TransactionType.Bridge:
return "bridge"
case Constants.TransactionType.ContractDeployment:
return "contract_deploy"
case Constants.TransactionType.Mint:
return "token"
default:
console.warn("Unhandled type :: ",activityFilterStore.typeFilters[index])
return ""
@ -128,7 +132,7 @@ Column {
case Constants.TransactionStatus.Pending:
return Style.svg("transaction/pending")
case Constants.TransactionStatus.Complete:
return Style.svg("transaction/verified")
return Style.svg("transaction/confirmed")
case Constants.TransactionStatus.Finished:
return Style.svg("transaction/finished")
default:

View File

@ -70,6 +70,7 @@ StatusMenu {
}
ActivityTypeFilterSubMenu {
id: typeMenu
implicitWidth: 230
onBack: root.open()
typeFilters: root.typeFilters
onActionTriggered: updateTypeFilter(type, allFiltersCount)

View File

@ -57,7 +57,7 @@ StatusMenu {
ActivityTypeCheckBox {
id: buyCheckbox
title: qsTr("Complete")
assetSettings.name: Style.svg("transaction/verified")
assetSettings.name: Style.svg("transaction/confirmed")
assetSettings.color: "transparent"
buttonGroup: typeButtonGroup
allChecked: root.allChecked

View File

@ -53,12 +53,23 @@ StatusMenu {
}
ActivityTypeCheckBox {
id: buyCheckbox
title: qsTr("Buy")
id: contractDeploymentCheckbox
title: qsTr("Contract Deployment")
assetSettings.name: "contract_deploy"
buttonGroup: typeButtonGroup
allChecked: root.allChecked
type: Constants.TransactionType.ContractDeployment
checked: root.allChecked || typeFilters.includes(type)
onActionTriggered: root.actionTriggered(type)
}
ActivityTypeCheckBox {
id: mintCheckbox
title: qsTr("Mint")
assetSettings.name: "token"
buttonGroup: typeButtonGroup
allChecked: root.allChecked
type: Constants.TransactionType.Buy
type: Constants.TransactionType.Mint
checked: root.allChecked || typeFilters.includes(type)
onActionTriggered: root.actionTriggered(type)
}