2023-05-04 10:01:59 +00:00
|
|
|
|
import QtQuick 2.15
|
2023-03-07 11:32:45 +00:00
|
|
|
|
import QtQuick.Layouts 1.14
|
2023-05-04 10:01:59 +00:00
|
|
|
|
import QtGraphicalEffects 1.0
|
2023-03-07 11:32:45 +00:00
|
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
import StatusQ.Components 0.1
|
2023-05-16 14:50:43 +00:00
|
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
2023-03-07 11:32:45 +00:00
|
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
import shared.panels 1.0
|
|
|
|
|
|
2023-06-23 06:17:04 +00:00
|
|
|
|
import AppLayouts.Communities.helpers 1.0
|
|
|
|
|
import AppLayouts.Communities.panels 1.0
|
2023-03-07 11:32:45 +00:00
|
|
|
|
|
|
|
|
|
StatusScrollView {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
property int viewWidth: 560 // by design
|
|
|
|
|
property bool preview: false
|
2023-06-22 21:24:30 +00:00
|
|
|
|
|
|
|
|
|
// https://bugreports.qt.io/browse/QTBUG-84269
|
2023-07-03 14:56:25 +00:00
|
|
|
|
/* required */ property TokenObject token
|
2023-06-22 21:24:30 +00:00
|
|
|
|
|
2023-07-03 14:44:02 +00:00
|
|
|
|
readonly property bool isAssetView: token.type === Constants.TokenType.ERC20
|
2023-06-22 21:24:30 +00:00
|
|
|
|
|
|
|
|
|
readonly property string name: token.name
|
|
|
|
|
readonly property string description: token.description
|
|
|
|
|
readonly property string symbol: token.symbol
|
|
|
|
|
readonly property int supply: token.supply
|
|
|
|
|
readonly property url artworkSource: token.artworkSource
|
|
|
|
|
readonly property rect artworkCropRect: token.artworkCropRect
|
|
|
|
|
readonly property bool infiniteSupply: token.infiniteSupply
|
|
|
|
|
readonly property int remainingTokens: root.preview ? root.supply : token.remainingTokens
|
|
|
|
|
readonly property int deployState: token.deployState
|
|
|
|
|
readonly property string accountName: token.accountName
|
|
|
|
|
readonly property string chainName: token.chainName
|
|
|
|
|
readonly property string chainId: token.chainId
|
|
|
|
|
readonly property string accountAddress: token.accountAddress
|
|
|
|
|
readonly property bool remotelyDestruct: token.remotelyDestruct
|
|
|
|
|
readonly property int remotelyDestructState: token.remotelyDestructState
|
|
|
|
|
readonly property bool transferable: token.transferable
|
|
|
|
|
readonly property string chainIcon: token.chainIcon
|
|
|
|
|
readonly property int decimals: token.decimals
|
2023-06-01 10:38:56 +00:00
|
|
|
|
|
2023-07-03 14:56:25 +00:00
|
|
|
|
readonly property bool deploymentCompleted:
|
|
|
|
|
deployState === Constants.ContractTransactionStatus.Completed
|
|
|
|
|
|
2023-06-01 10:38:56 +00:00
|
|
|
|
// Models:
|
2023-05-25 10:31:32 +00:00
|
|
|
|
property var tokenOwnersModel
|
|
|
|
|
|
2023-06-01 10:38:56 +00:00
|
|
|
|
signal mintClicked()
|
2023-05-25 10:31:32 +00:00
|
|
|
|
|
2023-06-05 13:49:36 +00:00
|
|
|
|
signal airdropRequested(string address)
|
|
|
|
|
signal generalAirdropRequested
|
|
|
|
|
|
|
|
|
|
signal remoteDestructRequested(string address)
|
|
|
|
|
|
2023-03-07 11:32:45 +00:00
|
|
|
|
QtObject {
|
|
|
|
|
id: d
|
|
|
|
|
|
2023-05-25 10:31:32 +00:00
|
|
|
|
readonly property int imageSelectorRectSize: root.isAssetView ? 104 : 280
|
2023-03-07 11:32:45 +00:00
|
|
|
|
readonly property int iconSize: 20
|
2023-05-15 12:49:26 +00:00
|
|
|
|
readonly property string infiniteSymbol: "∞"
|
2023-06-22 21:24:30 +00:00
|
|
|
|
readonly property int burnState: root.token.burnState
|
2023-05-16 14:50:43 +00:00
|
|
|
|
|
|
|
|
|
function startAnimation(isBurn) {
|
|
|
|
|
totalbox.highlighted = true
|
|
|
|
|
|
|
|
|
|
if(isBurn)
|
|
|
|
|
remainingBox.highlighted = true
|
|
|
|
|
}
|
2023-06-01 10:38:56 +00:00
|
|
|
|
|
|
|
|
|
onBurnStateChanged: if(burnState === Constants.ContractTransactionStatus.Completed) d.startAnimation(true)
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
padding: 0
|
2023-06-20 06:55:16 +00:00
|
|
|
|
contentWidth: mainLayout.width
|
|
|
|
|
contentHeight: mainLayout.height
|
2023-03-07 11:32:45 +00:00
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: mainLayout
|
|
|
|
|
|
|
|
|
|
width: root.viewWidth
|
|
|
|
|
spacing: Style.current.padding
|
|
|
|
|
|
|
|
|
|
RowLayout {
|
2023-07-03 14:56:25 +00:00
|
|
|
|
visible: !root.preview && !root.deploymentCompleted
|
2023-03-07 11:32:45 +00:00
|
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
|
|
2023-06-01 10:38:56 +00:00
|
|
|
|
StatusDotsLoadingIndicator { visible: (root.deployState === Constants.ContractTransactionStatus.InProgress) }
|
2023-05-17 10:00:52 +00:00
|
|
|
|
|
|
|
|
|
StatusIcon {
|
2023-05-05 11:03:59 +00:00
|
|
|
|
visible: (root.deployState === Constants.ContractTransactionStatus.Failed)
|
2023-05-17 10:00:52 +00:00
|
|
|
|
icon: "warning"
|
|
|
|
|
color: Theme.palette.dangerColor1
|
|
|
|
|
}
|
2023-03-07 11:32:45 +00:00
|
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
font.pixelSize: Theme.primaryTextFontSize
|
2023-05-05 11:03:59 +00:00
|
|
|
|
text: (root.deployState === Constants.ContractTransactionStatus.InProgress) ?
|
2023-05-25 10:31:32 +00:00
|
|
|
|
(root.isAssetView ?
|
|
|
|
|
qsTr("Asset is being minted") : qsTr("Collectible is being minted")) :
|
2023-05-05 11:03:59 +00:00
|
|
|
|
(root.deployState === Constants.ContractTransactionStatus.Failed) ?
|
2023-05-25 10:31:32 +00:00
|
|
|
|
(root.isAssetView ? qsTr("Asset minting failed") : qsTr("Collectible minting failed")) : ""
|
2023-05-05 11:03:59 +00:00
|
|
|
|
color: (root.deployState === Constants.ContractTransactionStatus.Failed) ? Theme.palette.dangerColor1 : Theme.palette.directColor1
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
Layout.preferredHeight: d.imageSelectorRectSize
|
|
|
|
|
Layout.preferredWidth: Layout.preferredHeight
|
2023-05-04 10:01:59 +00:00
|
|
|
|
|
2023-05-25 10:31:32 +00:00
|
|
|
|
radius: root.isAssetView ? Layout.preferredWidth / 2 : 8
|
2023-05-04 10:01:59 +00:00
|
|
|
|
color:Theme.palette.baseColor2
|
|
|
|
|
clip: true
|
2023-03-07 11:32:45 +00:00
|
|
|
|
|
|
|
|
|
Image {
|
|
|
|
|
id: image
|
|
|
|
|
|
2023-06-22 21:24:30 +00:00
|
|
|
|
readonly property rect imageCropRect: root.artworkCropRect
|
2023-06-01 10:38:56 +00:00
|
|
|
|
|
2023-03-07 11:32:45 +00:00
|
|
|
|
anchors.fill: parent
|
|
|
|
|
fillMode: Image.PreserveAspectFit
|
2023-05-04 10:01:59 +00:00
|
|
|
|
visible: false
|
2023-06-01 10:38:56 +00:00
|
|
|
|
source: root.artworkSource
|
|
|
|
|
sourceClipRect: imageCropRect ? imageCropRect : undefined
|
2023-05-04 10:01:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OpacityMask {
|
|
|
|
|
anchors.fill: image
|
|
|
|
|
source: image
|
|
|
|
|
maskSource: parent
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Flow {
|
|
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
|
|
component CustomPreviewBox: Rectangle {
|
|
|
|
|
id: previewBox
|
|
|
|
|
|
|
|
|
|
property string label
|
|
|
|
|
property string value
|
2023-05-16 14:50:43 +00:00
|
|
|
|
property bool isLoading: false
|
|
|
|
|
property bool highlighted: false
|
2023-03-07 11:32:45 +00:00
|
|
|
|
|
|
|
|
|
radius: 8
|
|
|
|
|
border.color: Theme.palette.baseColor2
|
|
|
|
|
implicitWidth: Math.min(boxContent.implicitWidth + Style.current.padding, mainLayout.width)
|
|
|
|
|
implicitHeight: boxContent.implicitHeight + Style.current.padding
|
2023-05-16 14:50:43 +00:00
|
|
|
|
states: [
|
|
|
|
|
State {
|
|
|
|
|
when: !previewBox.highlighted
|
|
|
|
|
PropertyChanges { target: previewBox; color: "transparent" }
|
|
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
when: previewBox.highlighted
|
|
|
|
|
PropertyChanges { target: previewBox; color: Theme.palette.primaryColor3 }
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
onHighlightedChanged: if(highlighted) animation.start()
|
2023-03-07 11:32:45 +00:00
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: boxContent
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
spacing: 2
|
|
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
text: previewBox.label
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
font.pixelSize: 13
|
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-16 14:50:43 +00:00
|
|
|
|
RowLayout {
|
|
|
|
|
spacing: 3
|
|
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
text: StatusQUtils.Emoji.fromCodePoint("1f525") // :fire: emoji
|
|
|
|
|
font.pixelSize: Theme.tertiaryTextFontSize
|
|
|
|
|
visible: previewBox.isLoading
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
Layout.maximumWidth: mainLayout.width - Style.current.padding
|
|
|
|
|
text: previewBox.value
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
font.pixelSize: Theme.primaryTextFontSize
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusLoadingIndicator {
|
|
|
|
|
Layout.preferredHeight: Theme.primaryTextFontSize
|
|
|
|
|
Layout.preferredWidth: Layout.preferredHeight
|
|
|
|
|
Layout.leftMargin: 6
|
|
|
|
|
Layout.rightMargin: 3
|
|
|
|
|
visible: previewBox.isLoading
|
|
|
|
|
color: Theme.palette.primaryColor1
|
|
|
|
|
}
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-05-16 14:50:43 +00:00
|
|
|
|
|
|
|
|
|
Timer {
|
|
|
|
|
id: animation
|
|
|
|
|
|
|
|
|
|
interval: 1500
|
|
|
|
|
onRunningChanged: if(!running) previewBox.highlighted = false
|
|
|
|
|
}
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CustomPreviewBox {
|
2023-05-15 12:49:26 +00:00
|
|
|
|
id: symbolBox
|
|
|
|
|
|
|
|
|
|
label: qsTr("Symbol")
|
2023-06-01 10:38:56 +00:00
|
|
|
|
value: root.symbol
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CustomPreviewBox {
|
2023-06-22 05:27:18 +00:00
|
|
|
|
id: totalbox
|
2023-06-01 10:38:56 +00:00
|
|
|
|
|
2023-05-15 12:49:26 +00:00
|
|
|
|
label: qsTr("Total")
|
2023-06-22 05:27:18 +00:00
|
|
|
|
value: root.infiniteSupply ? d.infiniteSymbol : LocaleUtils.numberToLocaleString(root.supply)
|
2023-05-16 14:50:43 +00:00
|
|
|
|
isLoading: !root.infiniteSupply &&
|
2023-06-22 21:24:30 +00:00
|
|
|
|
((!root.isAssetView && root.remotelyDestructState === Constants.ContractTransactionStatus.InProgress) ||
|
2023-06-01 10:38:56 +00:00
|
|
|
|
(d.burnState === Constants.ContractTransactionStatus.InProgress))
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CustomPreviewBox {
|
2023-05-16 14:50:43 +00:00
|
|
|
|
id: remainingBox
|
|
|
|
|
|
2023-05-15 12:49:26 +00:00
|
|
|
|
label: qsTr("Remaining")
|
|
|
|
|
value: root.infiniteSupply ? d.infiniteSymbol : LocaleUtils.numberToLocaleString(root.remainingTokens)
|
2023-06-01 10:38:56 +00:00
|
|
|
|
isLoading: !root.infiniteSupply && (d.burnState === Constants.ContractTransactionStatus.InProgress)
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CustomPreviewBox {
|
2023-05-25 10:31:32 +00:00
|
|
|
|
visible: root.isAssetView
|
|
|
|
|
label: qsTr("DP")
|
2023-06-22 21:24:30 +00:00
|
|
|
|
value: root.decimals
|
2023-05-25 10:31:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CustomPreviewBox {
|
|
|
|
|
visible: !root.isAssetView
|
2023-05-15 12:49:26 +00:00
|
|
|
|
label: qsTr("Transferable")
|
2023-06-22 21:24:30 +00:00
|
|
|
|
value: root.transferable ? qsTr("Yes") : qsTr("No")
|
2023-05-15 12:49:26 +00:00
|
|
|
|
}
|
2023-03-07 11:32:45 +00:00
|
|
|
|
|
2023-05-15 12:49:26 +00:00
|
|
|
|
CustomPreviewBox {
|
2023-05-25 10:31:32 +00:00
|
|
|
|
visible: !root.isAssetView
|
2023-06-22 21:24:30 +00:00
|
|
|
|
|
2023-06-21 16:41:42 +00:00
|
|
|
|
label: qsTr("Destructible")
|
2023-06-22 21:24:30 +00:00
|
|
|
|
value: root.remotelyDestruct ? qsTr("Yes") : qsTr("No")
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-17 15:09:27 +00:00
|
|
|
|
CustomPreviewBox {
|
|
|
|
|
label: qsTr("Account")
|
2023-06-01 10:38:56 +00:00
|
|
|
|
value: root.accountName
|
2023-03-17 15:09:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-07 11:32:45 +00:00
|
|
|
|
Rectangle {
|
|
|
|
|
height: symbolBox.height
|
|
|
|
|
width: rowChain.implicitWidth + 2 * Style.current.padding
|
|
|
|
|
border.width: 1
|
|
|
|
|
radius: 8
|
|
|
|
|
border.color: Theme.palette.baseColor2
|
|
|
|
|
color: "transparent"
|
|
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
|
id: rowChain
|
|
|
|
|
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
spacing: Style.current.padding
|
|
|
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
2023-06-01 10:38:56 +00:00
|
|
|
|
|
2023-03-07 11:32:45 +00:00
|
|
|
|
height: 24
|
|
|
|
|
width: height
|
2023-06-22 21:24:30 +00:00
|
|
|
|
source: Style.svg(root.chainIcon)
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
2023-06-01 10:38:56 +00:00
|
|
|
|
|
|
|
|
|
text: root.chainName
|
2023-03-07 11:32:45 +00:00
|
|
|
|
font.pixelSize: 13
|
|
|
|
|
font.weight: Font.Medium
|
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-15 12:49:26 +00:00
|
|
|
|
StatusBaseText {
|
|
|
|
|
Layout.fillWidth: true
|
2023-06-01 10:38:56 +00:00
|
|
|
|
|
2023-06-22 21:24:30 +00:00
|
|
|
|
text: root.description
|
2023-05-15 12:49:26 +00:00
|
|
|
|
wrapMode: TextEdit.WordWrap
|
|
|
|
|
font.pixelSize: Theme.primaryTextFontSize
|
|
|
|
|
lineHeight: 1.2
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-07 11:32:45 +00:00
|
|
|
|
RowLayout {
|
|
|
|
|
visible: root.preview
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
|
|
StatusIcon {
|
|
|
|
|
Layout.preferredWidth: d.iconSize
|
|
|
|
|
Layout.preferredHeight: d.iconSize
|
|
|
|
|
Layout.alignment: Qt.AlignTop
|
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
icon: "info"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
font.pixelSize: Style.current.primaryTextFontSize
|
|
|
|
|
color: Theme.palette.baseColor1
|
2023-05-15 12:49:26 +00:00
|
|
|
|
text: qsTr("Make sure you’re happy with your token before minting it as it can’t be edited later")
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
|
visible: root.preview
|
|
|
|
|
Layout.preferredHeight: 44
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.topMargin: Style.current.halfPadding
|
|
|
|
|
text: qsTr("Mint")
|
|
|
|
|
|
2023-06-01 10:38:56 +00:00
|
|
|
|
onClicked: root.mintClicked()
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-05 13:49:36 +00:00
|
|
|
|
SortableTokenHoldersPanel {
|
2023-07-03 14:56:25 +00:00
|
|
|
|
visible: !root.preview && root.deploymentCompleted
|
2023-06-05 13:49:36 +00:00
|
|
|
|
|
2023-04-13 08:09:06 +00:00
|
|
|
|
model: root.tokenOwnersModel
|
2023-06-05 13:49:36 +00:00
|
|
|
|
tokenName: root.name
|
2023-06-22 21:24:30 +00:00
|
|
|
|
showRemotelyDestructMenuItem: !root.isAssetView && root.remotelyDestruct
|
2023-06-05 13:49:36 +00:00
|
|
|
|
|
2023-03-07 11:32:45 +00:00
|
|
|
|
Layout.topMargin: Style.current.padding
|
|
|
|
|
Layout.fillWidth: true
|
2023-06-05 13:49:36 +00:00
|
|
|
|
|
|
|
|
|
onAirdropRequested: root.airdropRequested(address)
|
|
|
|
|
onGeneralAirdropRequested: root.generalAirdropRequested()
|
|
|
|
|
onRemoteDestructRequested: root.remoteDestructRequested(address)
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-01 10:38:56 +00:00
|
|
|
|
|
|
|
|
|
Connections {
|
2023-06-22 21:24:30 +00:00
|
|
|
|
target: root.token
|
2023-06-01 10:38:56 +00:00
|
|
|
|
|
|
|
|
|
function onRemotelyDestructStateChanged() {
|
2023-06-22 21:24:30 +00:00
|
|
|
|
if(root.remotelyDestructState === Constants.ContractTransactionStatus.Completed) d.startAnimation(false)
|
2023-06-01 10:38:56 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|