fix(@desktop/wallet): Fixing bugs found during demo

This commit is contained in:
Khushboo Mehta 2023-09-18 11:45:37 +02:00 committed by Khushboo-dev-cpp
parent 7e5ed80847
commit 1f85ec1bd6
6 changed files with 43 additions and 32 deletions

View File

@ -148,7 +148,13 @@ QtObject:
self.items[i].amountOut = ""
self.items[i].resetToNetworks()
self.items[i].hasGas = true
self.dataChanged(index, index, @[ModelRole.AmountIn.int, ModelRole.ToNetworks.int, ModelRole.HasGas.int, ModelRole.AmountOut.int])
self.items[i].isEnabled = true
self.items[i].isPreferred = true
self.items[i].locked = false
self.items[i].lockedAmount = ""
self.dataChanged(index, index, @[ModelRole.AmountIn.int, ModelRole.ToNetworks.int, ModelRole.HasGas.int,
ModelRole.AmountOut.int, ModelRole.IsEnabled.int, ModelRole.IsPreferred.int, ModelRole.Locked.int,
ModelRole.LockedAmount.int])
proc updateTokenBalanceForSymbol*(self: NetworkModel, chainId: int, tokenBalance: CurrencyAmount) =
for i in 0 ..< self.items.len:

View File

@ -181,8 +181,6 @@ QtObject:
self.transactionRoutes = routes
self.suggestedRoutesReady(newQVariant(self.transactionRoutes))
proc suggestedRoutes*(self: View, amount: string, sendType: int): string {.slot.} =
self.fromNetworksModel.reset()
self.toNetworksModel.reset()
var parsedAmount = stint.u256("0")
try:
parsedAmount = fromHex(Stuint[256], amount)

View File

@ -153,12 +153,14 @@ Item {
root.sendModalPopup.sendType = Constants.SendType.Transfer
root.sendModalPopup.preSelectedHoldingID = walletStore.currentViewedHoldingID
root.sendModalPopup.preSelectedHoldingType = walletStore.currentViewedHoldingType
root.sendModalPopup.onlyAssets = false
root.sendModalPopup.open()
}
onLaunchBridgeModal: {
root.sendModalPopup.sendType = Constants.SendType.Bridge
root.sendModalPopup.preSelectedHoldingID = walletStore.currentViewedHoldingID
root.sendModalPopup.preSelectedHoldingType = walletStore.currentViewedHoldingType
root.sendModalPopup.onlyAssets = true
root.sendModalPopup.open()
}
}

View File

@ -1340,8 +1340,9 @@ Item {
property string preSelectedHoldingID
property int preSelectedHoldingType
property int sendType: -1
property bool onlyAssets: false
sourceComponent: SendModal {
onlyAssets: false
onlyAssets: sendModal.onlyAssets
onClosed: {
sendModal.closed()
sendModal.sendType = -1

View File

@ -283,32 +283,6 @@ StatusDialog {
}
}
}
TokenListView {
id: tokenListRect
Layout.fillWidth: true
visible: !d.selectedHolding
assets: popup.selectedAccount && popup.selectedAccount.assets ? popup.selectedAccount.assets : null
collectibles: popup.selectedAccount ? popup.nestedCollectiblesModel : null
onlyAssets: holdingSelector.onlyAssets
searchTokenSymbolByAddressFn: function (address) {
return store.findTokenSymbolByAddress(address)
}
getNetworkIcon: function(chainId){
return RootStore.getNetworkIcon(chainId)
}
onTokenSelected: {
d.setSelectedHoldingId(symbol, holdingType)
}
onTokenHovered: {
if(hovered) {
d.setHoveredHoldingId(symbol, holdingType)
} else {
d.setHoveredHoldingId("", Constants.HoldingType.Unknown)
}
}
}
RowLayout {
visible: d.isSelectedHoldingValidAsset && !d.isERC721Transfer
AmountToSend {
@ -382,6 +356,36 @@ StatusDialog {
spacing: Style.current.bigPadding
anchors.left: parent.left
TokenListView {
id: tokenListRect
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: Style.current.bigPadding
anchors.rightMargin: Style.current.bigPadding
visible: !d.selectedHolding
assets: popup.selectedAccount && popup.selectedAccount.assets ? popup.selectedAccount.assets : null
collectibles: popup.selectedAccount ? popup.nestedCollectiblesModel : null
onlyAssets: holdingSelector.onlyAssets
searchTokenSymbolByAddressFn: function (address) {
return store.findTokenSymbolByAddress(address)
}
getNetworkIcon: function(chainId){
return RootStore.getNetworkIcon(chainId)
}
onTokenSelected: {
d.setSelectedHoldingId(symbol, holdingType)
}
onTokenHovered: {
if(hovered) {
d.setHoveredHoldingId(symbol, holdingType)
} else {
d.setHoveredHoldingId("", Constants.HoldingType.Unknown)
}
}
}
ColumnLayout {
spacing: 8
width: parent.width

View File

@ -82,7 +82,7 @@ Item {
Column {
id: column
width: parent.width
topPadding: 20
topPadding: root.onlyAssets ? 0 : 20
StatusTabBar {
visible: !root.onlyAssets
@ -162,7 +162,7 @@ Item {
Component {
id: tokenHeader
SearchBoxWithRightIcon {
showTopBorder: true
showTopBorder: !root.onlyAssets
width: parent.width
placeholderText: qsTr("Search for token or enter token address")
onTextChanged: Qt.callLater(d.updateAssetSearchText, text)