status-desktop/ui/app/AppLayouts/Browser/BrowserWalletMenu.qml

212 lines
6.4 KiB
QML
Raw Normal View History

2020-10-15 17:05:34 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
2020-10-15 17:05:34 +00:00
import QtGraphicalEffects 1.13
import "../../../shared"
import "../../../shared/status"
import "../../../imports"
import "../Wallet"
2020-10-15 17:05:34 +00:00
Popup {
id: popup
modal: false
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
parent: Overlay.overlay
width: 360
height: 480
background: Rectangle {
id: bgPopup
color: Style.current.background
radius: Style.current.radius
layer.enabled: true
layer.effect: DropShadow{
width: bgPopup.width
height: bgPopup.height
x: bgPopup.x
y: bgPopup.y + 10
visible: bgPopup.visible
source: bgPopup
horizontalOffset: 0
verticalOffset: 5
radius: 10
samples: 15
color: Style.current.dropShadow
2020-10-15 17:05:34 +00:00
}
}
padding: Style.current.padding
Item {
id: walletHeader
width: parent.width
height: networkText.height
Rectangle {
id: networkColorCircle
width: 8
height: 8
radius: width / 2
color: {
2020-12-06 22:15:51 +00:00
switch (profileModel.network.current) {
case Constants.networkMainnet: return Style.current.green;
case Constants.networkRopsten: return Style.current.turquoise;
default: return Style.current.red
}
}
2020-10-15 17:05:34 +00:00
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
id: networkText
text: {
2020-12-06 22:15:51 +00:00
switch (profileModel.network.current) {
2021-02-18 16:36:05 +00:00
//% "Mainnet"
case Constants.networkMainnet: return qsTrId("mainnet");
//% "Ropsten"
case Constants.networkRopsten: return qsTrId("ropsten");
//% "Unknown"
default: return qsTrId("active-unknown")
}
}
2020-10-15 17:05:34 +00:00
font.pixelSize: 15
anchors.verticalCenter: parent.verticalCenter
anchors.left: networkColorCircle.right
anchors.leftMargin: Style.current.halfPadding
}
StyledText {
id: disconectBtn
2021-02-18 16:36:05 +00:00
//% "Disconnect"
text: qsTrId("disconnect")
2020-10-15 17:05:34 +00:00
font.pixelSize: 15
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
color: Style.current.danger
MouseArea {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
2020-12-14 20:43:46 +00:00
onClicked: {
_web3Provider.disconnect();
provider.postMessage(`{"type":"web3-disconnect-account"}`);
popup.close();
}
2020-10-15 17:05:34 +00:00
}
}
}
2020-10-15 18:12:35 +00:00
Item {
property string currentAddress: ""
id: accountSelectorRow
width: parent.width
height: accountSelector.height
2020-10-15 18:12:35 +00:00
anchors.top: walletHeader.bottom
anchors.topMargin: Style.current.bigPadding
AccountSelector {
id: accountSelector
2020-10-15 18:12:35 +00:00
label: ""
anchors.left: parent.left
anchors.right: copyBtn.left
anchors.rightMargin: Style.current.padding
refactor wallet views add getSettings methods to src/status fix issue with calling getSettings; document issue remove most direct references to libstatus; document some common issues remove most references to libstatus wallet add mailserver layer to status lib; remove references to libstatus mailservers remove libstatus accounts references move types out of libstatus; remove libstatus types references remove libstatus browser references refactor libstatus utils references remove more references to libstatus stickers remove references to libstatus constants from src/app remove more libstatus references from src/app refactor token_list usage of libstatus refactor stickers usage of libstatus refactor chat usage of libstatus remove libstatus references from the wallet view remove logic from ens manager view fix issue with import & namespace conflict remove unnecessary imports refactor provider view to not depend on libstatus refactor provider view refactor: move accounts specific code to its own section fix account selection move collectibles to their own module update references to wallet transactions refactor: move gas methods to their own file refactor: extract tokens into their own file refactor: extract ens to its own file refactor: extract dappbrowser code to its own file refactor: extract history related code to its own file refactor: extract balance to its own file refactor: extract utils to its own file clean up wallet imports fix: identicon for transaction commands Fixes #2533
2021-06-08 12:48:31 +00:00
accounts: walletModel.accountsView.accounts
selectedAccount: walletModel.dappBrowserView.dappBrowserAccount
refactor wallet views add getSettings methods to src/status fix issue with calling getSettings; document issue remove most direct references to libstatus; document some common issues remove most references to libstatus wallet add mailserver layer to status lib; remove references to libstatus mailservers remove libstatus accounts references move types out of libstatus; remove libstatus types references remove libstatus browser references refactor libstatus utils references remove more references to libstatus stickers remove references to libstatus constants from src/app remove more libstatus references from src/app refactor token_list usage of libstatus refactor stickers usage of libstatus refactor chat usage of libstatus remove libstatus references from the wallet view remove logic from ens manager view fix issue with import & namespace conflict remove unnecessary imports refactor provider view to not depend on libstatus refactor provider view refactor: move accounts specific code to its own section fix account selection move collectibles to their own module update references to wallet transactions refactor: move gas methods to their own file refactor: extract tokens into their own file refactor: extract ens to its own file refactor: extract dappbrowser code to its own file refactor: extract history related code to its own file refactor: extract balance to its own file refactor: extract utils to its own file clean up wallet imports fix: identicon for transaction commands Fixes #2533
2021-06-08 12:48:31 +00:00
currency: walletModel.balanceView.defaultCurrency
2020-10-15 18:12:35 +00:00
onSelectedAccountChanged: {
if (!accountSelectorRow.currentAddress) {
// We just set the account for the first time. Nothing to do here
accountSelectorRow.currentAddress = selectedAccount.address
return
}
if (accountSelectorRow.currentAddress === selectedAccount.address) {
return
}
accountSelectorRow.currentAddress = selectedAccount.address
web3Provider.dappsAddress = selectedAccount.address;
2020-12-08 20:17:08 +00:00
walletModel.setDappBrowserAddress()
2020-10-15 18:12:35 +00:00
web3Provider.clearPermissions();
for (let i = 0; i < tabs.count; ++i){
tabs.getTab(i).item.reload();
}
}
}
CopyToClipBoardButton {
id: copyBtn
width: 20
height: 20
anchors.right: sendBtn.left
anchors.rightMargin: Style.current.padding
anchors.top: parent.top
anchors.topMargin: Style.current.padding
textToCopy: accountSelector.selectedAccount.address
2020-10-15 18:12:35 +00:00
}
StatusIconButton {
id: sendBtn
icon.name: "send"
width: 20
height: 20
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: Style.current.padding
2020-10-15 18:12:35 +00:00
iconColor: Style.current.primary
onClicked: {
sendModal.selectFromAccount.selectedAccount = accountSelector.selectedAccount
sendModal.open()
}
2020-10-15 18:12:35 +00:00
}
}
Item {
id: walletInfoContent
width: parent.width
anchors.top: accountSelectorRow.bottom
anchors.topMargin: Style.current.bigPadding
anchors.bottom: parent.bottom
TabBar {
id: walletTabBar
width: parent.width
anchors.top: parent.top
height: assetBtn.height
background: Rectangle {
color: Style.current.transparent
border.width: 0
}
StatusTabButton {
id: assetBtn
//% "Assets"
btnText: qsTrId("wallet-assets")
anchors.top: parent.top
}
StatusTabButton {
id: historyBtn
anchors.top: parent.top
anchors.left: assetBtn.right
anchors.leftMargin: 32
//% "History"
btnText: qsTrId("history")
}
}
StackLayout {
id: stackLayout
width: parent.width
anchors.top: walletTabBar.bottom
anchors.topMargin: Style.current.bigPadding
anchors.bottom: parent.bottom
currentIndex: walletTabBar.currentIndex
AssetsTab {
id: assetsTab
}
HistoryTab {
id: historyTab
}
}
}
2020-10-15 17:05:34 +00:00
}