-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(MintToken): Created remote self destruct popup
Created remote self destruct popup. Part of #10051
- Loading branch information
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
ui/app/AppLayouts/Chat/popups/community/RemoteSelfDestructPopup.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import QtQuick 2.14 | ||
import QtQuick.Controls 2.14 | ||
import QtQuick.Layouts 1.14 | ||
import QtQml.Models 2.14 | ||
|
||
import StatusQ.Core 0.1 | ||
import StatusQ.Controls 0.1 | ||
import StatusQ.Popups.Dialog 0.1 | ||
import StatusQ.Core.Theme 0.1 | ||
|
||
import AppLayouts.Chat.panels.communities 1.0 | ||
|
||
import utils 1.0 | ||
|
||
StatusDialog { | ||
id: root | ||
|
||
property alias model: tokenHoldersPanel.model | ||
|
||
property string collectibleName | ||
|
||
signal selfDestructClicked() | ||
|
||
QtObject { | ||
id: d | ||
|
||
readonly property int maxHeight: 560 // by design | ||
property int tokensNumber: 0 | ||
|
||
function getVerticalPadding() { | ||
return root.topPadding + root.bottomPadding | ||
} | ||
|
||
function getHorizontalPadding() { | ||
return root.leftPadding + root.rightPadding | ||
} | ||
|
||
function calculateTotalTokensToDestruct() { | ||
tokensNumber = 0 | ||
for(var i = 0; i < tokenHoldersPanel.model.count; i ++) { | ||
var item = tokenHoldersPanel.model.get(i) | ||
if(item.selfDestruct) { | ||
tokensNumber += item.selfDestructAmount | ||
} | ||
} | ||
} | ||
} | ||
|
||
title: qsTr("Remotely self-destruct %1 token").arg(root.collectibleName) | ||
implicitWidth: 600 // by design | ||
topPadding: Style.current.padding | ||
bottomPadding: topPadding | ||
implicitHeight: Math.min(tokenHoldersPanel.implicitHeight + d.getVerticalPadding() + root.header.height + root.footer.height, d.maxHeight) | ||
contentItem: StatusScrollView { | ||
id: scrollview | ||
|
||
ScrollBar.vertical.policy: ScrollBar.AsNeeded | ||
ScrollBar.horizontal.policy: ScrollBar.AsNeeded | ||
contentHeight: tokenHoldersPanel.implicitHeight | ||
contentWidth: tokenHoldersPanel.implicitWidth | ||
rightPadding: 20 | ||
|
||
TokenHoldersPanel { | ||
id: tokenHoldersPanel | ||
|
||
width: root.width - d.getHorizontalPadding() - scrollview.rightPadding | ||
tokenName: root.collectibleName | ||
isSelectorMode: true | ||
|
||
onSelfDestructChanged: d.calculateTotalTokensToDestruct() | ||
} | ||
} | ||
|
||
footer: StatusDialogFooter { | ||
spacing: Style.current.padding | ||
rightButtons: ObjectModel { | ||
StatusButton { | ||
enabled: d.tokensNumber > 0 | ||
text: qsTr("Self-destruct %1 tokens").arg(d.tokensNumber) | ||
type: StatusBaseButton.Type.Danger | ||
onClicked: root.selfDestructClicked() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
CreateChannelPopup 1.0 CreateChannelPopup.qml | ||
CommunityTokenPermissionsPopup 1.0 CommunityTokenPermissionsPopup.qml | ||
SignMintTokenTransactionPopup 1.0 SignMintTokenTransactionPopup.qml | ||
RemoteSelfDestructPopup 1.0 RemoteSelfDestructPopup.qml |