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-01 10:38:56 +00:00
|
|
|
|
import AppLayouts.Chat.helpers 1.0
|
2023-03-07 11:32:45 +00:00
|
|
|
|
import AppLayouts.Chat.panels.communities 1.0
|
|
|
|
|
|
|
|
|
|
StatusScrollView {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
property int viewWidth: 560 // by design
|
|
|
|
|
property bool preview: false
|
2023-05-25 10:31:32 +00:00
|
|
|
|
property bool isAssetView: false
|
2023-03-07 11:32:45 +00:00
|
|
|
|
|
2023-06-01 10:38:56 +00:00
|
|
|
|
property CollectibleObject collectible
|
|
|
|
|
property AssetObject asset
|
|
|
|
|
|
|
|
|
|
readonly property string name: root.isAssetView ? asset.name : collectible.name
|
|
|
|
|
readonly property string symbol: root.isAssetView ? asset.symbol : collectible.symbol
|
|
|
|
|
readonly property url artworkSource: root.isAssetView ? asset.artworkSource : collectible.artworkSource
|
|
|
|
|
readonly property bool infiniteSupply: root.isAssetView ? asset.infiniteSupply : collectible.infiniteSupply
|
|
|
|
|
readonly property int remainingTokens: root.isAssetView ? asset.remainingTokens : collectible.remainingTokens
|
|
|
|
|
readonly property int deployState: root.isAssetView ? asset.deployState : collectible.deployState
|
|
|
|
|
readonly property string accountName: root.isAssetView ? asset.accountName : collectible.accountName
|
|
|
|
|
readonly property string chainName: root.isAssetView ? asset.chainName : collectible.chainName
|
|
|
|
|
readonly property string chainId: root.isAssetView ? asset.chainId : collectible.chainId
|
|
|
|
|
readonly property string accountAddress: root.isAssetView ? asset.accountAddress : collectible.accountAddress
|
|
|
|
|
|
|
|
|
|
// 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-01 10:38:56 +00:00
|
|
|
|
readonly property int burnState: root.isAssetView ? asset.burnState : collectible.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-05-05 11:03:59 +00:00
|
|
|
|
visible: !root.preview && ((root.deployState === Constants.ContractTransactionStatus.InProgress) ||
|
|
|
|
|
(root.deployState === Constants.ContractTransactionStatus.Failed))
|
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-01 10:38:56 +00:00
|
|
|
|
property rect imageCropRect: root.isAssetView ? asset.artworkCropRect : collectible.artworkCropRect
|
|
|
|
|
|
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-05-16 14:50:43 +00:00
|
|
|
|
id: totalbox
|
|
|
|
|
|
2023-06-01 10:38:56 +00:00
|
|
|
|
property int supply: root.isAssetView ? asset.supply : collectible.supply
|
|
|
|
|
|
2023-05-15 12:49:26 +00:00
|
|
|
|
label: qsTr("Total")
|
2023-06-01 10:38:56 +00:00
|
|
|
|
value: root.infiniteSupply ? d.infiniteSymbol : LocaleUtils.numberToLocaleString(supply)
|
2023-05-16 14:50:43 +00:00
|
|
|
|
isLoading: !root.infiniteSupply &&
|
2023-06-01 10:38:56 +00:00
|
|
|
|
((!root.isAssetView && collectible.remotelyDestructState === Constants.ContractTransactionStatus.InProgress) ||
|
|
|
|
|
(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-01 10:38:56 +00:00
|
|
|
|
value: asset.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-01 10:38:56 +00:00
|
|
|
|
value: collectible.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-21 16:41:42 +00:00
|
|
|
|
label: qsTr("Destructible")
|
2023-06-01 10:38:56 +00:00
|
|
|
|
value: collectible.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-01 10:38:56 +00:00
|
|
|
|
source: Style.svg(root.isAssetView ? asset.chainIcon : collectible.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
|
|
|
|
|
|
|
|
|
text: root.isAssetView ? asset.description : collectible.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-04-13 08:09:06 +00:00
|
|
|
|
visible: !root.preview
|
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-01 10:38:56 +00:00
|
|
|
|
showRemotelyDestructMenuItem: !root.isAssetView && collectible.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 {
|
|
|
|
|
target: collectible
|
|
|
|
|
|
|
|
|
|
function onRemotelyDestructStateChanged() {
|
|
|
|
|
if(collectible.remotelyDestructState === Constants.ContractTransactionStatus.Completed) d.startAnimation(false)
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-07 11:32:45 +00:00
|
|
|
|
}
|