2023-07-05 15:17:51 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import StatusQ.Controls 0.1
|
2023-03-07 11:32:45 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-07-05 15:17:51 +00:00
|
|
|
import StatusQ.Core.Utils 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
2023-03-07 11:32:45 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import shared.controls 1.0
|
|
|
|
|
|
|
|
Control {
|
|
|
|
id: root
|
|
|
|
property var model
|
|
|
|
property string tokenName
|
2023-03-31 10:20:23 +00:00
|
|
|
property bool isSelectorMode: false
|
|
|
|
|
2023-04-27 10:12:09 +00:00
|
|
|
signal selfDestructAmountChanged(string walletAddress, int amount)
|
|
|
|
signal selfDestructRemoved(string walletAddress)
|
2023-07-05 15:17:51 +00:00
|
|
|
bottomPadding: 16
|
2023-03-07 11:32:45 +00:00
|
|
|
|
2023-07-05 15:17:51 +00:00
|
|
|
TokenHoldersProxyModel {
|
|
|
|
id: filteredModel
|
|
|
|
sourceModel: root.model
|
|
|
|
searchText: searcher.text
|
2023-03-07 11:32:45 +00:00
|
|
|
|
2023-07-05 15:17:51 +00:00
|
|
|
sortBy: holdersList.sortBy
|
|
|
|
sortOrder: holdersList.sortOrder ? Qt.DescendingOrder : Qt.AscendingOrder
|
2023-03-07 11:32:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
contentItem: ColumnLayout {
|
2023-07-05 15:17:51 +00:00
|
|
|
id: column
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
spacing: 0
|
|
|
|
StatusBaseText {
|
|
|
|
id: txtLabel
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
Layout.rightMargin: Style.current.padding
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
font.pixelSize: Style.current.primaryTextFontSize
|
|
|
|
color: Theme.palette.baseColor1
|
2023-03-07 11:32:45 +00:00
|
|
|
|
2023-07-05 15:17:51 +00:00
|
|
|
text: qsTr("%1 token holders").arg(root.tokenName)
|
2023-03-07 11:32:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SearchBox {
|
|
|
|
id: searcher
|
|
|
|
Layout.fillWidth: true
|
2023-07-05 15:17:51 +00:00
|
|
|
Layout.topMargin: 12
|
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
Layout.rightMargin: Style.current.padding
|
|
|
|
visible: !root.empty
|
2023-03-07 11:32:45 +00:00
|
|
|
topPadding: 0
|
|
|
|
bottomPadding: 0
|
|
|
|
minimumHeight: 36 // by design
|
|
|
|
maximumHeight: minimumHeight
|
2023-07-05 15:17:51 +00:00
|
|
|
placeholderText: qsTr("Search hodlers")
|
2023-03-07 11:32:45 +00:00
|
|
|
}
|
2023-03-31 10:20:23 +00:00
|
|
|
StatusBaseText {
|
2023-07-05 15:17:51 +00:00
|
|
|
id: anotherLabel
|
2023-03-31 10:20:23 +00:00
|
|
|
Layout.fillWidth: true
|
2023-07-05 15:17:51 +00:00
|
|
|
Layout.topMargin: 12
|
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
Layout.rightMargin: Style.current.padding
|
2023-03-07 11:32:45 +00:00
|
|
|
|
2023-03-31 10:20:23 +00:00
|
|
|
wrapMode: Text.Wrap
|
|
|
|
font.pixelSize: Style.current.primaryTextFontSize
|
|
|
|
color: Theme.palette.baseColor1
|
2023-07-05 15:17:51 +00:00
|
|
|
visible: (searcher.text.length > 0 && filteredModel.count === 0)
|
|
|
|
text: visible ? qsTr("No hodlers found") : ""
|
2023-03-31 10:20:23 +00:00
|
|
|
}
|
2023-07-05 15:17:51 +00:00
|
|
|
TokenHoldersList {
|
|
|
|
id: holdersList
|
2023-03-07 11:32:45 +00:00
|
|
|
Layout.fillWidth: true
|
2023-05-31 20:58:23 +00:00
|
|
|
Layout.fillHeight: true
|
2023-07-05 15:17:51 +00:00
|
|
|
Layout.topMargin: 12
|
|
|
|
isSelectorMode: root.isSelectorMode
|
|
|
|
model: filteredModel
|
|
|
|
onSelfDestructRemoved: {
|
|
|
|
root.selfDestructRemoved(walletAddress);
|
|
|
|
}
|
|
|
|
onSelfDestructAmountChanged: {
|
|
|
|
root.selfDestructAmountChanged(walletAddress, amount);
|
2023-03-07 11:32:45 +00:00
|
|
|
}
|
|
|
|
}
|
2023-07-05 15:17:51 +00:00
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 4
|
|
|
|
Layout.alignment: Qt.AlignBottom
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
opacity: holdersList.bottomSeparatorVisible ? 1.0 : 0.0
|
|
|
|
}
|
2023-03-07 11:32:45 +00:00
|
|
|
}
|
|
|
|
}
|