chore(@desktop/community): refactor TransferOwnershipPopup

This commit is contained in:
Patryk Osmaczko 2022-06-29 18:56:55 +02:00 committed by osmaczko
parent 1b49fd4c35
commit ff747c2a5f
1 changed files with 46 additions and 59 deletions

View File

@ -1,88 +1,75 @@
import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Popups 0.1
import utils 1.0
import shared.controls 1.0
import shared 1.0
StatusModal {
id: popup
id: root
property string privateKey
property var store
//% "Transfer ownership"
header.title: qsTrId("transfer-ownership")
header.title: qsTr("Transfer ownership")
padding: 16
onClosed: {
popup.destroy();
}
ColumnLayout {
anchors.fill: parent
contentItem: Item {
width: popup.width
implicitHeight: Math.max(300, content.height + 32)
Column {
id: content
anchors.top: parent.top
anchors.topMargin: 16
anchors.horizontalCenter: parent.horizontalCenter
spacing: 16
width: popup.width - 32
spacing: 16
StatusInput {
id: pKeyInput
StatusInput {
property string elidedPkey: popup.privateKey.substring(0, 15) + "..." + popup.privateKey.substring(popup.privateKey.length - 16)
Layout.fillWidth: true
id: pKeyInput
anchors.left: parent.left
anchors.right: parent.right
leftPadding: 0
rightPadding: 0
label: qsTr("Community private key")
input.text: elidedPkey
input.edit.readOnly: true
input.edit.onActiveFocusChanged: {
pKeyInput.input.text = pKeyInput.input.edit.focus ? popup.privateKey : elidedPkey
}
input.rightComponent: StatusButton {
anchors.verticalCenter: parent.verticalCenter
border.width: 1
border.color: Theme.palette.primaryColor1
size: StatusBaseButton.Size.Tiny
text: qsTr("Copy")
onClicked: {
text = qsTr("Copied")
popup.store.copyToClipboard(popup.privateKey)
}
readonly property string elidedPkey: root.privateKey.substring(0, 15) + "..." + root.privateKey.substring(root.privateKey.length - 16)
leftPadding: 0
rightPadding: 0
label: qsTr("Community private key")
input.text: elidedPkey
input.edit.readOnly: true
input.edit.onActiveFocusChanged: {
pKeyInput.input.text = pKeyInput.input.edit.focus ? root.privateKey : elidedPkey
}
input.rightComponent: StatusButton {
anchors.verticalCenter: parent.verticalCenter
border.width: 1
border.color: Theme.palette.primaryColor1
size: StatusBaseButton.Size.Tiny
text: qsTr("Copy")
onClicked: {
text = qsTr("Copied")
root.store.copyToClipboard(root.privateKey)
}
}
}
StatusBaseText {
Layout.fillWidth: true
StatusBaseText {
id: infoText1
//% "You should keep it safe and only share it with people you trust to take ownership of your community"
text: qsTrId("you-should-keep-it-safe-and-only-share-it-with-people-you-trust-to-take-ownership-of-your-community")
wrapMode: Text.WordWrap
width: parent.width
font.pixelSize: 13
color: Theme.palette.baseColor1
}
text: qsTr("You should keep it safe and only share it with people you trust to take ownership of your community")
wrapMode: Text.WordWrap
font.pixelSize: 13
color: Theme.palette.baseColor1
}
StatusBaseText {
id: infoText2
//% "You can also use this key to import your community on another device"
text: qsTrId("you-can-also-use-this-key-to-import-your-community-on-another-device")
wrapMode: Text.WordWrap
width: parent.width
font.pixelSize: 13
color: Theme.palette.baseColor1
}
StatusBaseText {
Layout.fillWidth: true
text: qsTr("You can also use this key to import your community on another device")
wrapMode: Text.WordWrap
font.pixelSize: 13
color: Theme.palette.baseColor1
}
}
@ -93,7 +80,7 @@ StatusModal {
icon.width: 20
rotation: 180
onClicked: {
popup.close()
root.close()
}
}
]