feat(@desktop/wallet): adapt receive modal design

closes  #5039
This commit is contained in:
Khushboo Mehta 2022-03-15 20:34:28 +01:00 committed by Iuri Matias
parent d4c4fe1f41
commit f5e67fc658
9 changed files with 160 additions and 112 deletions

View File

@ -146,7 +146,9 @@ Popup {
anchors.rightMargin: Style.current.padding anchors.rightMargin: Style.current.padding
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: Style.current.padding anchors.topMargin: Style.current.padding
color: Style.current.transparent
textToCopy: accountSelector.selectedAccount.address textToCopy: accountSelector.selectedAccount.address
store: RootStore
} }
StatusFlatRoundButton { StatusFlatRoundButton {

View File

@ -78,4 +78,8 @@ QtObject {
} }
return tempUrl return tempUrl
} }
function copyToClipboard(text) {
globalUtils.copyToClipboard(text)
}
} }

View File

@ -95,6 +95,7 @@ Item {
destroy(); destroy();
} }
selectedAccount: walletHeader.walletStore.currentAccount selectedAccount: walletHeader.walletStore.currentAccount
anchors.centerIn: parent
} }
} }

View File

@ -1,58 +1,104 @@
import QtQuick 2.13 import QtQuick 2.13
import QtQuick.Controls 2.13 import QtQuick.Controls 2.13
import QtGraphicalEffects 1.13
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1 import StatusQ.Controls 0.1
import StatusQ.Popups 0.1
import StatusQ.Components 0.1
import utils 1.0 import utils 1.0
import shared.popups 1.0
import shared.controls 1.0 import shared.controls 1.0
import "../stores" import "../stores"
// TODO: replace with StatusModal StatusModal {
ModalPopup {
property alias selectedAccount: accountSelector.selectedAccount
id: popup id: popup
//% "Receive" property alias selectedAccount: accountSelector.selectedAccount
title: qsTrId("receive")
height: 500
width: 500
//% "Receive"
header.title: qsTrId("receive")
contentHeight: layout.implicitHeight
width: 556
contentItem: Column {
id: layout
width: popup.width
topPadding: Style.current.smallPadding
spacing: Style.current.bigPadding
Rectangle { Rectangle {
id: qrCodeBox id: qrCodeBox
height: 240
width: 240
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
radius: Style.current.radius height: 339
width: 339
layer.enabled: true
layer.effect: OpacityMask {
maskSource: Item {
width: qrCodeBox.width
height: qrCodeBox.height
Rectangle {
anchors.top: parent.top
anchors.left: parent.left
width: qrCodeBox.width
height: qrCodeBox.height
radius: Style.current.bigPadding
border.width: 1 border.width: 1
border.color: Style.current.border border.color: Style.current.border
}
Rectangle {
anchors.top: parent.top
anchors.right: parent.right
width: Style.current.bigPadding
height: Style.current.bigPadding
}
Rectangle {
anchors.bottom: parent.bottom
anchors.left: parent.left
width: Style.current.bigPadding
height: Style.current.bigPadding
}
}
}
Image { Image {
id: qrCodeImage id: qrCodeImage
anchors.centerIn: parent
height: parent.height
width: parent.width
asynchronous: true asynchronous: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
height: parent.height - Style.current.padding
width: parent.width - Style.current.padding
mipmap: true mipmap: true
smooth: false smooth: false
} }
Rectangle {
anchors.centerIn: qrCodeImage
width: 78
height: 78
color: "white"
StatusIcon {
anchors.centerIn: parent
anchors.margins: 2
width: 78
height: 78
source: Style.svg("status-logo-icon")
}
}
} }
StatusAccountSelector { StatusAccountSelector {
id: accountSelector id: accountSelector
anchors.horizontalCenter: parent.horizontalCenter
width: 240
label: "" label: ""
showAccountDetails: false showAccountDetails: false
accounts: RootStore.accounts accounts: RootStore.accounts
currency: RootStore.currentCurrency currency: RootStore.currentCurrency
anchors.top: qrCodeBox.bottom
anchors.topMargin: Style.current.padding
anchors.horizontalCenter: parent.horizontalCenter
width: 240
dropdownWidth: parent.width - (Style.current.padding * 2) dropdownWidth: parent.width - (Style.current.padding * 2)
dropdownAlignment: StatusSelect.MenuAlignment.Center dropdownAlignment: StatusSelect.MenuAlignment.Center
onSelectedAccountChanged: { onSelectedAccountChanged: {
@ -63,20 +109,45 @@ ModalPopup {
} }
} }
Input { Item {
id: txtWalletAddress anchors.horizontalCenter: parent.horizontalCenter
//% "Wallet address" width: parent.width
label: qsTrId("wallet-address") height: addressLabel.height + copyButton.height
anchors.top: accountSelector.bottom Column {
anchors.topMargin: Style.current.padding id: addressLabel
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.current.padding anchors.leftMargin: Style.current.bigPadding
anchors.right: parent.right StatusBaseText {
anchors.rightMargin: Style.current.padding id: contactsLabel
copyToClipboard: true font.pixelSize: 15
textField.readOnly: true color: Theme.palette.baseColor1
customHeight: 56 text: qsTr("Your Address")
}
StatusAddress {
id: txtWalletAddress
color: Theme.palette.directColor1
font.pixelSize: 15
}
}
Column {
id: copyButton
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: Style.current.bigPadding
spacing: 5
CopyToClipBoardButton {
store: RootStore
textToCopy: txtWalletAddress.text
}
StatusBaseText {
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: 13
color: Theme.palette.primaryColor1
text: qsTr("Copy")
}
}
}
} }
} }

View File

@ -187,4 +187,8 @@ QtObject {
function toggleNetwork(chainId) { function toggleNetwork(chainId) {
networksModule.toggleNetwork(chainId) networksModule.toggleNetwork(chainId)
} }
function copyToClipboard(text) {
globalUtils.copyToClipboard(text)
}
} }

View File

@ -1,79 +1,42 @@
import QtQuick 2.13 import QtQuick 2.13
import QtQuick.Controls 2.13
import QtGraphicalEffects 1.13
import StatusQ.Controls 0.1 as StatusQ import StatusQ.Controls 0.1
import utils 1.0
import shared.stores 1.0 import shared.stores 1.0
import "./" import utils 1.0
import "../"
// TODO: Replace with StatusQ components StatusRoundButton {
Rectangle {
id: copyToClipboardButton id: copyToClipboardButton
height: 32
width: 32
radius: 8
color: Style.current.transparent
property var onClick: function() {} property var onClick: function() {}
property string textToCopy: "" property string textToCopy: ""
property bool tooltipUnder: false property bool tooltipUnder: false
property var store property var store
Image { icon.name: "copy"
width: 20
height: 20
sourceSize.width: width
sourceSize.height: height
source: Style.svg("copy-to-clipboard-icon")
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
ColorOverlay {
anchors.fill: parent
antialiasing: true
source: parent
color: Style.current.primary
}
}
MouseArea {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
hoverEnabled: true
onExited: {
parent.color = Style.current.transparent
}
onEntered:{
parent.color = Style.current.backgroundHover
}
onPressed: { onPressed: {
parent.color = Style.current.backgroundHover
if (!toolTip.visible) { if (!toolTip.visible) {
toolTip.visible = true toolTip.visible = true
} }
} }
onReleased: {
parent.color = Style.current.backgroundHover
}
onClicked: { onClicked: {
if (textToCopy) { if (textToCopy) {
copyToClipboardButton.store.copyToClipboard(textToCopy) store.copyToClipboard(textToCopy)
} }
onClick() onClick()
} }
}
StatusQ.StatusToolTip { StatusToolTip {
id: toolTip id: toolTip
//% "Copied!" //% "Copied!"
text: qsTrId("copied-") text: qsTrId("copied-")
orientation: tooltipUnder ? StatusQ.StatusToolTip.Orientation.Bottom: StatusQ.StatusToolTip.Orientation.Top orientation: tooltipUnder ? StatusToolTip.Orientation.Bottom: StatusToolTip.Orientation.Top
} }
Timer { Timer {
id:hideTimer id: hideTimer
interval: 2000 interval: 2000
running: toolTip.visible running: toolTip.visible
onTriggered: { onTriggered: {

View File

@ -53,6 +53,7 @@ Item {
Component { Component {
id: copyComponent id: copyComponent
CopyToClipBoardButton { CopyToClipBoardButton {
color: Style.current.transparent
textToCopy: infoText.textToCopy textToCopy: infoText.textToCopy
} }
} }

View File

@ -81,6 +81,7 @@ Item {
anchors.left: control.right anchors.left: control.right
anchors.leftMargin: Style.current.smallPadding anchors.leftMargin: Style.current.smallPadding
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: Style.current.transparent
textToCopy: root.address textToCopy: root.address
store: root.store store: root.store
MouseArea { MouseArea {

View File

@ -43,6 +43,7 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.right anchors.left: parent.right
anchors.leftMargin: Style.current.smallPadding anchors.leftMargin: Style.current.smallPadding
color: Style.current.transparent
store: root.store store: root.store
} }
} }