From e459d4dbd4486740e7bdb57f7b6584618c898cb8 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 13 Jan 2021 14:15:52 -0500 Subject: [PATCH] fix: fix PopupModal to not show a footer at all if there is no children --- ui/app/AppLayouts/Browser/AddFavoriteModal.qml | 2 +- ui/app/AppLayouts/Browser/JSDialogWindow.qml | 6 ++---- ui/app/AppLayouts/Browser/SignMessageModal.qml | 5 ++--- .../ChatComponents/ChatCommandModal.qml | 6 +++--- .../ChatComponents/SignTransactionModal.qml | 6 +++--- .../CommunityComponents/CommunitiesPopup.qml | 4 +++- .../CommunityDetailPopup.qml | 3 ++- .../InviteFriendsToCommunityPopup.qml | 3 ++- .../Chat/components/GroupChatPopup.qml | 6 ++---- .../Profile/Sections/ChangeProfilePicModal.qml | 3 ++- .../Profile/Sections/Ens/ENSPopup.qml | 6 ++---- .../Profile/Sections/Ens/RegisterENSModal.qml | 5 ++--- .../Profile/Sections/Ens/SetPubKeyModal.qml | 5 ++--- .../AppLayouts/Wallet/AccountSettingsModal.qml | 4 +++- .../AppLayouts/Wallet/AddCustomTokenModal.qml | 4 +++- ui/app/AppLayouts/Wallet/SendModal.qml | 6 +++--- ui/app/AppLayouts/Wallet/SignPhraseModal.qml | 5 ++--- ui/onboarding/CreatePasswordModal.qml | 6 ++---- ui/onboarding/MnemonicRecoverySuccessModal.qml | 7 +++---- ui/shared/ModalPopup.qml | 18 ++++++++---------- .../status/StatusStickerPackPurchaseModal.qml | 6 +++--- 21 files changed, 55 insertions(+), 61 deletions(-) diff --git a/ui/app/AppLayouts/Browser/AddFavoriteModal.qml b/ui/app/AppLayouts/Browser/AddFavoriteModal.qml index 9360d005c8..15b1bf12ca 100644 --- a/ui/app/AppLayouts/Browser/AddFavoriteModal.qml +++ b/ui/app/AppLayouts/Browser/AddFavoriteModal.qml @@ -102,7 +102,7 @@ ModalPopup { footer: Item { width: parent.width - height: parent.height + height: removeBtn.height StatusButton { id: removeBtn diff --git a/ui/app/AppLayouts/Browser/JSDialogWindow.qml b/ui/app/AppLayouts/Browser/JSDialogWindow.qml index 8cffc5342d..041105d8a3 100644 --- a/ui/app/AppLayouts/Browser/JSDialogWindow.qml +++ b/ui/app/AppLayouts/Browser/JSDialogWindow.qml @@ -51,10 +51,8 @@ ModalPopup { } footer: Item { - anchors.top: parent.bottom - anchors.right: parent.right - anchors.bottom: root.bottom - anchors.left: parent.left + width: parent.width + height: okButton.height StyledButton { id: okButton diff --git a/ui/app/AppLayouts/Browser/SignMessageModal.qml b/ui/app/AppLayouts/Browser/SignMessageModal.qml index 3e0a942ce7..0ceca1692f 100644 --- a/ui/app/AppLayouts/Browser/SignMessageModal.qml +++ b/ui/app/AppLayouts/Browser/SignMessageModal.qml @@ -192,9 +192,8 @@ ModalPopup { footer: Item { - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right + width: parent.width + height: btnReject.height StatusButton { id: btnReject diff --git a/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/ChatCommandModal.qml b/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/ChatCommandModal.qml index b934d82b18..3dd1d15500 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/ChatCommandModal.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/ChatCommandModal.qml @@ -122,9 +122,9 @@ ModalPopup { } footer: Item { - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right + width: parent.width + height: btnNext.height + StatusRoundButton { id: btnBack anchors.left: parent.left diff --git a/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/SignTransactionModal.qml b/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/SignTransactionModal.qml index 34241d91d4..eb5d1e2a10 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/SignTransactionModal.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/SignTransactionModal.qml @@ -227,9 +227,9 @@ ModalPopup { } footer: Item { - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right + width: parent.width + height: btnNext.height + StatusRoundButton { id: btnBack anchors.left: parent.left diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunitiesPopup.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunitiesPopup.qml index 1e5a7391b6..fb4337586d 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunitiesPopup.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunitiesPopup.qml @@ -127,9 +127,11 @@ ModalPopup { } footer: Item { - anchors.fill: parent + width: parent.width + height: importBtn.height StatusButton { + id: importBtn text: qsTr("Import a community") anchors.right: createBtn.left anchors.rightMargin: Style.current.smallPadding diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityDetailPopup.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityDetailPopup.qml index 0d7ed6daa3..e2f0318bd2 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityDetailPopup.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityDetailPopup.qml @@ -140,7 +140,8 @@ ModalPopup { } footer: Item { - anchors.fill: parent + width: parent.width + height: backButton.height StatusIconButton { id: backButton diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/InviteFriendsToCommunityPopup.qml b/ui/app/AppLayouts/Chat/CommunityComponents/InviteFriendsToCommunityPopup.qml index fe521d73ea..b0763a32ae 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/InviteFriendsToCommunityPopup.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/InviteFriendsToCommunityPopup.qml @@ -86,7 +86,8 @@ ModalPopup { } footer: Item { - anchors.fill: parent + width: parent.width + height: inviteBtn.height StatusRoundButton { id: btnBack diff --git a/ui/app/AppLayouts/Chat/components/GroupChatPopup.qml b/ui/app/AppLayouts/Chat/components/GroupChatPopup.qml index 7739cc694b..e84ce58dc0 100644 --- a/ui/app/AppLayouts/Chat/components/GroupChatPopup.qml +++ b/ui/app/AppLayouts/Chat/components/GroupChatPopup.qml @@ -136,10 +136,8 @@ ModalPopup { } footer: Item { - anchors.top: parent.bottom - anchors.right: parent.right - anchors.bottom: popup.bottom - anchors.left: parent.left + width: parent.width + height: btnSelectMembers.height Button { id: btnSelectMembers diff --git a/ui/app/AppLayouts/Profile/Sections/ChangeProfilePicModal.qml b/ui/app/AppLayouts/Profile/Sections/ChangeProfilePicModal.qml index 05852dfff3..ff8afae9cf 100644 --- a/ui/app/AppLayouts/Profile/Sections/ChangeProfilePicModal.qml +++ b/ui/app/AppLayouts/Profile/Sections/ChangeProfilePicModal.qml @@ -101,7 +101,8 @@ ModalPopup { } footer: Item { - anchors.fill:parent + width: parent.width + height: uploadBtn.height StatusButton { visible: profileModel.profile.hasIdentityImage diff --git a/ui/app/AppLayouts/Profile/Sections/Ens/ENSPopup.qml b/ui/app/AppLayouts/Profile/Sections/Ens/ENSPopup.qml index 6a4d26376f..1779374d0d 100644 --- a/ui/app/AppLayouts/Profile/Sections/Ens/ENSPopup.qml +++ b/ui/app/AppLayouts/Profile/Sections/Ens/ENSPopup.qml @@ -85,10 +85,8 @@ ModalPopup { } footer: Item { - anchors.top: parent.bottom - anchors.right: parent.right - anchors.bottom: popup.bottom - anchors.left: parent.left + width: parent.width + height: btnSelectPreferred.height Button { id: btnSelectPreferred diff --git a/ui/app/AppLayouts/Profile/Sections/Ens/RegisterENSModal.qml b/ui/app/AppLayouts/Profile/Sections/Ens/RegisterENSModal.qml index 906da786e0..5c68a9ef60 100644 --- a/ui/app/AppLayouts/Profile/Sections/Ens/RegisterENSModal.qml +++ b/ui/app/AppLayouts/Profile/Sections/Ens/RegisterENSModal.qml @@ -149,9 +149,8 @@ ModalPopup { } footer: Item { - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right + width: parent.width + height: btnNext.height StatusButton { id: btnNext diff --git a/ui/app/AppLayouts/Profile/Sections/Ens/SetPubKeyModal.qml b/ui/app/AppLayouts/Profile/Sections/Ens/SetPubKeyModal.qml index e8c15e46ec..bc454345fd 100644 --- a/ui/app/AppLayouts/Profile/Sections/Ens/SetPubKeyModal.qml +++ b/ui/app/AppLayouts/Profile/Sections/Ens/SetPubKeyModal.qml @@ -153,9 +153,8 @@ ModalPopup { } footer: Item { - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right + width: parent.width + height: btnNext.height StyledButton { id: btnNext diff --git a/ui/app/AppLayouts/Wallet/AccountSettingsModal.qml b/ui/app/AppLayouts/Wallet/AccountSettingsModal.qml index ce04023a9f..4eb6d90d9e 100644 --- a/ui/app/AppLayouts/Wallet/AccountSettingsModal.qml +++ b/ui/app/AppLayouts/Wallet/AccountSettingsModal.qml @@ -105,7 +105,9 @@ ModalPopup { } footer: Item { - anchors.fill: parent + width: parent.width + height: saveBtn.height + StyledButton { visible: currentAccount.walletType === Constants.watchWalletType anchors.top: parent.top diff --git a/ui/app/AppLayouts/Wallet/AddCustomTokenModal.qml b/ui/app/AppLayouts/Wallet/AddCustomTokenModal.qml index 8123ef1954..dde40e0f0f 100644 --- a/ui/app/AppLayouts/Wallet/AddCustomTokenModal.qml +++ b/ui/app/AppLayouts/Wallet/AddCustomTokenModal.qml @@ -131,8 +131,10 @@ ModalPopup { } footer: Item { + width: parent.width + height: addBtn.height visible: editable - anchors.fill: parent + StyledButton { id: addBtn anchors.top: parent.top diff --git a/ui/app/AppLayouts/Wallet/SendModal.qml b/ui/app/AppLayouts/Wallet/SendModal.qml index 41680ef351..21a399d2da 100644 --- a/ui/app/AppLayouts/Wallet/SendModal.qml +++ b/ui/app/AppLayouts/Wallet/SendModal.qml @@ -181,9 +181,9 @@ ModalPopup { } footer: Item { - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right + width: parent.width + height: btnNext.height + StatusRoundButton { id: btnBack anchors.left: parent.left diff --git a/ui/app/AppLayouts/Wallet/SignPhraseModal.qml b/ui/app/AppLayouts/Wallet/SignPhraseModal.qml index 8be324992d..d705ba04aa 100644 --- a/ui/app/AppLayouts/Wallet/SignPhraseModal.qml +++ b/ui/app/AppLayouts/Wallet/SignPhraseModal.qml @@ -75,9 +75,8 @@ ModalPopup { } footer: Item { - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right + width: parent.width + height: btnRemindLater.height StatusButton { anchors.right: btnRemindLater.left diff --git a/ui/onboarding/CreatePasswordModal.qml b/ui/onboarding/CreatePasswordModal.qml index 5f2b1f2636..66872b9f6a 100644 --- a/ui/onboarding/CreatePasswordModal.qml +++ b/ui/onboarding/CreatePasswordModal.qml @@ -92,10 +92,8 @@ ModalPopup { } footer: Item { - anchors.top: parent.bottom - anchors.right: parent.right - anchors.bottom: popup.bottom - anchors.left: parent.left + width: parent.width + height: submitBtn.height StatusButton { id: submitBtn diff --git a/ui/onboarding/MnemonicRecoverySuccessModal.qml b/ui/onboarding/MnemonicRecoverySuccessModal.qml index 1bbfcc8dcb..2040cb4176 100644 --- a/ui/onboarding/MnemonicRecoverySuccessModal.qml +++ b/ui/onboarding/MnemonicRecoverySuccessModal.qml @@ -56,12 +56,11 @@ ModalPopup { } footer: Item { - anchors.top: parent.bottom - anchors.right: parent.right - anchors.bottom: popup.bottom - anchors.left: parent.left + width: parent.width + height: reencryptBtn.height StatusButton { + id: reencryptBtn anchors.bottom: parent.bottom anchors.topMargin: Style.current.padding anchors.right: parent.right diff --git a/ui/shared/ModalPopup.qml b/ui/shared/ModalPopup.qml index e3250f8f4e..e883dc8a83 100644 --- a/ui/shared/ModalPopup.qml +++ b/ui/shared/ModalPopup.qml @@ -126,24 +126,22 @@ Popup { Separator { id: separator2 - visible: !!footerContent.children[0] - anchors.bottom: parent.bottom - anchors.bottomMargin: 75 + visible: footerContent.visible + anchors.bottom: footerContent.top + anchors.bottomMargin: visible ? Style.current.padding : 0 } Item { id: footerContent - visible: !!children[0] - height: children[0] && children[0].height + visible: children.length > 0 + height: visible ? children[0] && children[0].height : 0 width: parent.width - anchors.top: separator2.bottom anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom - anchors.topMargin: Style.current.padding - anchors.bottomMargin: Style.current.padding - anchors.rightMargin: Style.current.padding - anchors.leftMargin: Style.current.padding + anchors.bottomMargin: visible ? Style.current.padding : 0 + anchors.rightMargin: visible ? Style.current.padding : 0 + anchors.leftMargin: visible ? Style.current.padding : 0 } } } diff --git a/ui/shared/status/StatusStickerPackPurchaseModal.qml b/ui/shared/status/StatusStickerPackPurchaseModal.qml index e878a80a0d..77f08fe4c7 100644 --- a/ui/shared/status/StatusStickerPackPurchaseModal.qml +++ b/ui/shared/status/StatusStickerPackPurchaseModal.qml @@ -165,9 +165,9 @@ ModalPopup { } footer: Item { - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right + width: parent.width + height: btnNext.height + StatusRoundButton { id: btnBack anchors.left: parent.left