fix: animation for updating fees added to send and swap modal

Closes #16624
This commit is contained in:
Sale Djenic 2024-10-28 12:23:46 +01:00 committed by saledjenic
parent f6055946d4
commit f2883fdcee
4 changed files with 80 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import StatusQ.Popups.Dialog 0.1
import shared.popups.send.controls 1.0 import shared.popups.send.controls 1.0
import shared.controls 1.0 import shared.controls 1.0
import shared.panels 1.0
import AppLayouts.Wallet.controls 1.0 import AppLayouts.Wallet.controls 1.0
import AppLayouts.Wallet.panels 1.0 import AppLayouts.Wallet.panels 1.0
@ -370,6 +371,7 @@ StatusDialog {
font.weight: Font.Medium font.weight: Font.Medium
} }
StatusTextWithLoadingState { StatusTextWithLoadingState {
id: fees
objectName: "maxFeesValue" objectName: "maxFeesValue"
text: { text: {
if(root.swapAdaptor.swapProposalLoading) { if(root.swapAdaptor.swapProposalLoading) {
@ -384,9 +386,22 @@ StatusDialog {
return "--" return "--"
} }
onTextChanged: {
if (text === "" || text === "--" || text === Constants.dummyText) {
return
}
animation.restart()
}
customColor: Theme.palette.directColor4 customColor: Theme.palette.directColor4
font.weight: Font.Medium font.weight: Font.Medium
loading: root.swapAdaptor.swapProposalLoading loading: root.swapAdaptor.swapProposalLoading
AnimatedText {
id: animation
target: fees
}
} }
} }
StatusButton { StatusButton {

View File

@ -0,0 +1,30 @@
import QtQuick 2.15
import StatusQ.Core.Theme 0.1
SequentialAnimation {
id: root
property var target: null
property color fromColor: Theme.palette.directColor1
property color toColor: Theme.palette.baseColor5
property int duration: 500 // in milliseconds
loops: 3
ColorAnimation {
target: root.target
property: "color"
from: root.fromColor
to: root.toColor
duration: root.duration
}
ColorAnimation {
target: root.target
property: "color"
from: root.toColor
to: root.fromColor
duration: root.duration
}
}

View File

@ -18,3 +18,4 @@ Separator 1.0 Separator.qml
SequenceColumnLayout 1.0 SequenceColumnLayout.qml SequenceColumnLayout 1.0 SequenceColumnLayout.qml
StatusAssetSelector 1.0 StatusAssetSelector.qml StatusAssetSelector 1.0 StatusAssetSelector.qml
StyledText 1.0 StyledText.qml StyledText 1.0 StyledText.qml
AnimatedText 1.0 AnimatedText.qml

View File

@ -9,11 +9,12 @@ import StatusQ.Core.Theme 0.1
import StatusQ.Popups.Dialog 0.1 import StatusQ.Popups.Dialog 0.1
import utils 1.0 import utils 1.0
import shared.panels 1.0
StatusDialogFooter { StatusDialogFooter {
id: root id: root
property string maxFiatFees: "..." property string maxFiatFees: d.emptyValue
property string totalTimeEstimate property string totalTimeEstimate
property bool pending: true property bool pending: true
property string nextButtonText: qsTr("Next") property string nextButtonText: qsTr("Next")
@ -26,6 +27,12 @@ StatusDialogFooter {
color: Theme.palette.baseColor3 color: Theme.palette.baseColor3
dropShadowEnabled: true dropShadowEnabled: true
QtObject {
id: d
readonly property string emptyValue: "..."
}
leftButtons: ObjectModel { leftButtons: ObjectModel {
ColumnLayout { ColumnLayout {
Layout.leftMargin: Theme.padding Layout.leftMargin: Theme.padding
@ -34,8 +41,21 @@ StatusDialogFooter {
text: qsTr("Estimated time:") text: qsTr("Estimated time:")
} }
StatusBaseText { StatusBaseText {
id: estimatedTime
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: root.totalTimeEstimate text: root.totalTimeEstimate
onTextChanged: {
if (text === "" || text === d.emptyValue) {
return
}
estimatedTimeAnimation.restart()
}
AnimatedText {
id: estimatedTimeAnimation
target: estimatedTime
}
} }
} }
} }
@ -49,8 +69,21 @@ StatusDialogFooter {
text: qsTr("Max fees:") text: qsTr("Max fees:")
} }
StatusBaseText { StatusBaseText {
id: fees
text: maxFiatFees text: maxFiatFees
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
onTextChanged: {
if (text === "" || text === d.emptyValue) {
return
}
feesAnimation.restart()
}
AnimatedText {
id: feesAnimation
target: fees
}
} }
} }
StatusButton { StatusButton {