fix(WarningBanners): updated show/hide as per design

Closes #10607
This commit is contained in:
Alexandra Betouni 2023-11-02 16:50:58 +02:00
parent a3ef9d6a27
commit 7d9414ef93
2 changed files with 27 additions and 13 deletions

View File

@ -739,7 +739,7 @@ Item {
type: ModuleWarning.Warning
iconName: "warning"
active: appMain.rootStore.profileSectionStore.walletStore.areTestNetworksEnabled
delay: false
onClicked: Global.openTestnetPopup()
onCloseClicked: hide()
}
@ -753,7 +753,7 @@ Item {
type: ModuleWarning.Danger
text: qsTr("Secure your seed phrase")
buttonText: qsTr("Back up now")
delay: false
onClicked: popups.openBackUpSeedPopup()
onCloseClicked: {
@ -776,7 +776,7 @@ Item {
readonly property string channelId: appMain.communitiesStore.discordImportChannelId
readonly property string channelName: appMain.communitiesStore.discordImportChannelName
readonly property string channelOrCommunityName: channelName || communityName
delay: false
active: !cancelled && (inProgress || finished || stopped)
type: errors ? ModuleWarning.Type.Danger : ModuleWarning.Type.Success
text: {
@ -824,6 +824,7 @@ Item {
type: ModuleWarning.Danger
text: qsTr("Downloading message history archives, DO NOT CLOSE THE APP until this banner disappears.")
closeBtnVisible: false
delay: false
}
ModuleWarning {
@ -879,6 +880,7 @@ Item {
objectName: "appVersionUpdateBanner"
Layout.fillWidth: true
type: ModuleWarning.Success
delay: false
text: updateAvailable ? qsTr("A new version of Status (%1) is available").arg(version)
: qsTr("Your version is up to date")

View File

@ -18,13 +18,14 @@ Item {
Success
}
property bool active
property bool active: false
property int type: ModuleWarning.Danger
property int progressValue: -1 // 0..100, -1 not visible
property string text: ""
property alias buttonText: button.text
property alias closeBtnVisible: closeImg.visible
property string iconName
property bool delay: true
signal clicked()
signal closeClicked()
@ -54,22 +55,23 @@ Item {
signal linkActivated(string link)
implicitHeight: active ? content.implicitHeight : 0
visible: implicitHeight > 0
onActiveChanged: {
active ? showAnimation.start() : hideAnimation.start()
if (root.active && root.delay) {
showTimer.start();
}
}
NumberAnimation {
id: showAnimation
target: root
running: (root.active && !root.delay)
property: "implicitHeight"
from: 0
to: content.implicitHeight
to: 32
duration: 500
easing.type: Easing.OutCubic
onStarted: {
root.visible = true;
root.showStarted()
}
onFinished: {
@ -79,20 +81,32 @@ Item {
NumberAnimation {
id: hideAnimation
running: !root.active
target: root
property: "implicitHeight"
from: 32
to: 0
from: content.implicitHeight
duration: 500
easing.type: Easing.OutCubic
onStarted: {
root.hideStarted()
root.visible = false;
}
onFinished: {
root.hideFinished()
}
}
Timer {
id: showTimer
interval: 3000
onTriggered: {
if (root.active) {
showAnimation.start();
}
}
}
Timer {
id: hideTimer
repeat: false
@ -104,9 +118,7 @@ Item {
Rectangle {
id: content
anchors.bottom: parent.bottom
width: parent.width
implicitHeight: 32
anchors.fill: parent
readonly property color baseColor: {
switch (root.type) {