2023-02-28 15:00:10 +00:00
|
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
|
2024-03-14 17:31:38 +00:00
|
|
|
|
import StatusQ 0.1
|
2023-02-28 15:00:10 +00:00
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
import StatusQ.Popups.Dialog 0.1
|
|
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
|
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
import shared.controls 1.0 // Timer
|
|
|
|
|
|
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
|
|
|
|
Control {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
property alias currentTabIndex: stackLayout.currentIndex
|
2024-03-29 11:43:49 +00:00
|
|
|
|
|
|
|
|
|
property alias communitiesModel: communitiesProxyModel.sourceModel
|
|
|
|
|
property alias accountsModel: accountsProxyModel.sourceModel
|
|
|
|
|
property alias collectiblesModel: collectiblesProxyModel.sourceModel
|
|
|
|
|
property alias assetsModel: assetsProxyModel.sourceModel
|
|
|
|
|
property alias socialLinksModel: socialLinksProxyModel.sourceModel
|
|
|
|
|
|
|
|
|
|
required property string mainDisplayName
|
|
|
|
|
required property bool readOnly
|
|
|
|
|
required property bool sendToAccountEnabled
|
|
|
|
|
|
2023-02-28 15:00:10 +00:00
|
|
|
|
signal closeRequested()
|
2024-03-29 11:43:49 +00:00
|
|
|
|
signal copyToClipboard(string text)
|
2023-10-31 15:26:15 +00:00
|
|
|
|
|
2023-02-28 15:00:10 +00:00
|
|
|
|
horizontalPadding: readOnly ? 20 : 40 // smaller in settings/preview
|
|
|
|
|
topPadding: Style.current.bigPadding
|
|
|
|
|
|
2024-03-14 17:31:38 +00:00
|
|
|
|
StatusQUtils.QObject {
|
2023-02-28 15:00:10 +00:00
|
|
|
|
id: d
|
|
|
|
|
|
|
|
|
|
readonly property string copyLiteral: qsTr("Copy")
|
2024-03-29 11:43:49 +00:00
|
|
|
|
}
|
2023-02-28 15:00:10 +00:00
|
|
|
|
|
2024-03-29 11:43:49 +00:00
|
|
|
|
component PositionSFPM: SortFilterProxyModel {
|
|
|
|
|
sorters: [
|
|
|
|
|
RoleSorter {
|
|
|
|
|
roleName: "showcasePosition"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
filters: AnyOf {
|
|
|
|
|
inverted: true
|
|
|
|
|
UndefinedFilter {
|
2024-03-14 17:31:38 +00:00
|
|
|
|
roleName: "showcaseVisibility"
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-29 11:43:49 +00:00
|
|
|
|
ValueFilter {
|
2024-03-14 17:31:38 +00:00
|
|
|
|
roleName: "showcaseVisibility"
|
|
|
|
|
value: Constants.ShowcaseVisibility.NoOne
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-03-29 11:43:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PositionSFPM {
|
|
|
|
|
id: communitiesProxyModel
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PositionSFPM {
|
|
|
|
|
id: accountsProxyModel
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PositionSFPM {
|
|
|
|
|
id: collectiblesProxyModel
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PositionSFPM {
|
|
|
|
|
id: assetsProxyModel
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PositionSFPM {
|
|
|
|
|
id: socialLinksProxyModel
|
2023-02-28 15:00:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
background: StatusDialogBackground {
|
|
|
|
|
color: Theme.palette.baseColor4
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
height: parent.radius
|
|
|
|
|
color: parent.color
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
contentItem: StackLayout {
|
|
|
|
|
id: stackLayout
|
|
|
|
|
|
|
|
|
|
// communities
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
|
visible: communitiesView.count == 0
|
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
text: qsTr("%1 hasn't joined any communities yet").arg(root.mainDisplayName)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusGridView {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
id: communitiesView
|
2024-03-29 11:43:49 +00:00
|
|
|
|
model: communitiesProxyModel
|
2023-02-28 15:00:10 +00:00
|
|
|
|
rightMargin: Style.current.halfPadding
|
|
|
|
|
cellWidth: (width-rightMargin)/2
|
|
|
|
|
cellHeight: cellWidth/2
|
|
|
|
|
visible: count
|
|
|
|
|
ScrollBar.vertical: StatusScrollBar { }
|
|
|
|
|
delegate: StatusListItem { // TODO custom delegate
|
|
|
|
|
width: GridView.view.cellWidth - Style.current.smallPadding
|
|
|
|
|
height: GridView.view.cellHeight - Style.current.smallPadding
|
2024-03-29 11:43:49 +00:00
|
|
|
|
title: model.name ?? ""
|
2023-02-28 15:00:10 +00:00
|
|
|
|
statusListItemTitle.font.pixelSize: 17
|
|
|
|
|
statusListItemTitle.font.bold: true
|
2024-03-29 11:43:49 +00:00
|
|
|
|
subTitle: model.description ?? ""
|
|
|
|
|
tertiaryTitle: qsTr("%n member(s)", "", model.membersCount ?? 0)
|
|
|
|
|
asset.name: model.image ?? model.name ?? ""
|
2023-06-15 00:06:10 +00:00
|
|
|
|
asset.isImage: asset.name.startsWith(Constants.dataImagePrefix)
|
2023-02-28 15:00:10 +00:00
|
|
|
|
asset.isLetterIdenticon: !model.image
|
2024-03-29 11:43:49 +00:00
|
|
|
|
asset.color: model.color ?? ""
|
2023-02-28 15:00:10 +00:00
|
|
|
|
asset.width: 40
|
|
|
|
|
asset.height: 40
|
|
|
|
|
border.width: 1
|
|
|
|
|
border.color: Theme.palette.baseColor2
|
2024-03-29 11:43:49 +00:00
|
|
|
|
loading: !model.id
|
2023-02-28 15:00:10 +00:00
|
|
|
|
components: [
|
|
|
|
|
StatusIcon {
|
2024-03-29 11:43:49 +00:00
|
|
|
|
visible: !!model.memberRole &&
|
|
|
|
|
model.memberRole === Constants.memberRole.owner ||
|
2023-08-22 18:09:34 +00:00
|
|
|
|
model.memberRole === Constants.memberRole.admin ||
|
|
|
|
|
model.memberRole === Constants.memberRole.tokenMaster
|
2023-02-28 15:00:10 +00:00
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
icon: "crown"
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
onClicked: {
|
2024-03-29 11:43:49 +00:00
|
|
|
|
if (root.readOnly || loading)
|
2023-02-28 15:00:10 +00:00
|
|
|
|
return
|
|
|
|
|
root.closeRequested()
|
|
|
|
|
Global.switchToCommunity(model.id)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// wallets/accounts
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
|
visible: accountsView.count == 0
|
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
text: qsTr("%1 doesn't have any wallet accounts yet").arg(root.mainDisplayName)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusListView {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
id: accountsView
|
2024-03-29 11:43:49 +00:00
|
|
|
|
model: accountsProxyModel
|
2023-02-28 15:00:10 +00:00
|
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
|
visible: count
|
|
|
|
|
delegate: StatusListItem {
|
|
|
|
|
id: accountDelegate
|
2023-12-29 13:10:55 +00:00
|
|
|
|
|
2023-02-28 15:00:10 +00:00
|
|
|
|
border.width: 1
|
|
|
|
|
border.color: Theme.palette.baseColor2
|
|
|
|
|
width: ListView.view.width
|
|
|
|
|
title: model.name
|
|
|
|
|
subTitle: StatusQUtils.Utils.elideText(model.address, 6, 4).replace("0x", "0×")
|
2023-05-22 15:55:47 +00:00
|
|
|
|
asset.color: Utils.getColorForId(model.colorId)
|
2023-02-28 15:00:10 +00:00
|
|
|
|
asset.emoji: model.emoji ?? ""
|
|
|
|
|
asset.name: asset.emoji || "filled-account"
|
|
|
|
|
asset.isLetterIdenticon: asset.emoji
|
|
|
|
|
asset.letterSize: 14
|
|
|
|
|
asset.bgColor: Theme.palette.primaryColor3
|
|
|
|
|
asset.isImage: asset.emoji
|
|
|
|
|
components: [
|
|
|
|
|
StatusIcon {
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
icon: "show"
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
},
|
|
|
|
|
StatusFlatButton {
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
size: StatusBaseButton.Size.Small
|
2024-03-29 11:43:49 +00:00
|
|
|
|
enabled: !model.saved
|
|
|
|
|
text: model.saved ? qsTr("Address saved") : qsTr("Save Address")
|
2023-02-28 15:00:10 +00:00
|
|
|
|
onClicked: {
|
2023-12-29 13:10:55 +00:00
|
|
|
|
// From here, we should just run add saved address popup
|
|
|
|
|
Global.openAddEditSavedAddressesPopup({
|
|
|
|
|
addAddress: true,
|
|
|
|
|
address: model.address
|
|
|
|
|
})
|
2023-02-28 15:00:10 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
StatusFlatRoundButton {
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
type: StatusFlatRoundButton.Type.Secondary
|
|
|
|
|
icon.name: "send"
|
|
|
|
|
tooltip.text: qsTr("Send")
|
2024-03-29 11:43:49 +00:00
|
|
|
|
enabled: root.sendToAccountEnabled
|
2023-02-28 15:00:10 +00:00
|
|
|
|
onClicked: {
|
|
|
|
|
Global.openSendModal(model.address)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
StatusFlatRoundButton {
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
type: StatusFlatRoundButton.Type.Secondary
|
|
|
|
|
icon.name: "copy"
|
|
|
|
|
tooltip.text: d.copyLiteral
|
|
|
|
|
onClicked: {
|
|
|
|
|
tooltip.text = qsTr("Copied")
|
2024-03-29 11:43:49 +00:00
|
|
|
|
root.copyToClipboard(model.address)
|
|
|
|
|
Backpressure.setTimeout(this, 2000, () => tooltip.text = d.copyLiteral)
|
2023-02-28 15:00:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// collectibles/NFTs
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
|
visible: collectiblesView.count == 0
|
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
text: qsTr("%1 doesn't have any collectibles/NFTs yet").arg(root.mainDisplayName)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusGridView {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
id: collectiblesView
|
2024-03-29 11:43:49 +00:00
|
|
|
|
model: collectiblesProxyModel
|
2023-02-28 15:00:10 +00:00
|
|
|
|
rightMargin: Style.current.halfPadding
|
|
|
|
|
cellWidth: (width-rightMargin)/4
|
|
|
|
|
cellHeight: cellWidth
|
|
|
|
|
visible: count
|
|
|
|
|
ScrollBar.vertical: StatusScrollBar { }
|
|
|
|
|
delegate: StatusRoundedImage {
|
|
|
|
|
width: GridView.view.cellWidth - Style.current.smallPadding
|
|
|
|
|
height: GridView.view.cellHeight - Style.current.smallPadding
|
|
|
|
|
border.width: 1
|
|
|
|
|
border.color: Theme.palette.directColor7
|
|
|
|
|
color: !!model.backgroundColor ? model.backgroundColor : "transparent"
|
|
|
|
|
radius: Style.current.radius
|
2024-03-29 11:43:49 +00:00
|
|
|
|
showLoadingIndicator: true
|
|
|
|
|
isLoading: image.isLoading || !model.imageUrl
|
2023-02-28 15:00:10 +00:00
|
|
|
|
image.fillMode: Image.PreserveAspectCrop
|
|
|
|
|
image.source: model.imageUrl ?? ""
|
|
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.leftMargin: Style.current.halfPadding
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.bottomMargin: Style.current.halfPadding
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.rightMargin: Style.current.halfPadding
|
|
|
|
|
|
|
|
|
|
Control {
|
|
|
|
|
Layout.maximumWidth: parent.width
|
|
|
|
|
horizontalPadding: Style.current.halfPadding
|
|
|
|
|
verticalPadding: Style.current.halfPadding/2
|
|
|
|
|
visible: !!model.id
|
|
|
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
|
radius: Style.current.halfPadding/2
|
|
|
|
|
color: Theme.palette.indirectColor2
|
|
|
|
|
}
|
|
|
|
|
contentItem: StatusBaseText {
|
|
|
|
|
font.pixelSize: 13
|
|
|
|
|
font.weight: Font.Medium
|
|
|
|
|
maximumLineCount: 1
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
text: `#${model.id}`
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusToolTip {
|
2024-02-07 14:56:45 +00:00
|
|
|
|
visible: hhandler.hovered && (!!model.name || !!model.collectionName)
|
2023-02-28 15:00:10 +00:00
|
|
|
|
text: {
|
|
|
|
|
const name = model.name
|
2024-02-07 14:56:45 +00:00
|
|
|
|
const descr = model.collectionName
|
2023-02-28 15:00:10 +00:00
|
|
|
|
const sep = !!name && !!descr ? "<br>" : ""
|
|
|
|
|
return `<b>${name}</b>${sep}${descr}`
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HoverHandler {
|
|
|
|
|
id: hhandler
|
|
|
|
|
cursorShape: hovered ? Qt.PointingHandCursor : undefined
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TapHandler {
|
|
|
|
|
onSingleTapped: {
|
|
|
|
|
Global.openLink(model.permalink)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// assets/tokens
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
|
visible: assetsView.count == 0
|
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
text: qsTr("%1 doesn't have any assets/tokens yet").arg(root.mainDisplayName)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusGridView {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
id: assetsView
|
2024-03-29 11:43:49 +00:00
|
|
|
|
model: assetsProxyModel
|
2023-02-28 15:00:10 +00:00
|
|
|
|
rightMargin: Style.current.halfPadding
|
|
|
|
|
cellWidth: (width-rightMargin)/3
|
|
|
|
|
cellHeight: cellWidth/2.5
|
|
|
|
|
visible: count
|
|
|
|
|
ScrollBar.vertical: StatusScrollBar { }
|
|
|
|
|
delegate: StatusListItem {
|
|
|
|
|
readonly property double changePct24hour: model.changePct24hour ?? 0
|
|
|
|
|
readonly property string textColor: changePct24hour === 0
|
|
|
|
|
? Theme.palette.baseColor1 : changePct24hour < 0
|
|
|
|
|
? Theme.palette.dangerColor1 : Theme.palette.successColor1
|
|
|
|
|
readonly property string arrow: changePct24hour === 0 ? "" : changePct24hour < 0 ? "↓" : "↑"
|
|
|
|
|
|
|
|
|
|
width: GridView.view.cellWidth - Style.current.halfPadding
|
|
|
|
|
height: GridView.view.cellHeight - Style.current.halfPadding
|
2024-02-07 14:56:45 +00:00
|
|
|
|
title: model.name
|
|
|
|
|
//subTitle: LocaleUtils.currencyAmountToLocaleString(model.enabledNetworkBalance)
|
2023-02-28 15:00:10 +00:00
|
|
|
|
statusListItemTitle.font.weight: Font.Medium
|
|
|
|
|
tertiaryTitle: qsTr("%1% today %2")
|
|
|
|
|
.arg(LocaleUtils.numberToLocaleString(changePct24hour, changePct24hour === 0 ? 0 : 2)).arg(arrow)
|
|
|
|
|
statusListItemTertiaryTitle.color: textColor
|
|
|
|
|
statusListItemTertiaryTitle.font.pixelSize: Theme.asideTextFontSize
|
|
|
|
|
statusListItemTertiaryTitle.anchors.topMargin: 6
|
|
|
|
|
leftPadding: Style.current.halfPadding
|
|
|
|
|
rightPadding: Style.current.halfPadding
|
|
|
|
|
border.width: 1
|
|
|
|
|
border.color: Theme.palette.baseColor2
|
|
|
|
|
components: [
|
|
|
|
|
Image {
|
|
|
|
|
width: 40
|
|
|
|
|
height: 40
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2023-03-20 12:29:05 +00:00
|
|
|
|
source: Constants.tokenIcon(model.symbol)
|
2023-02-28 15:00:10 +00:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
onClicked: {
|
|
|
|
|
if (root.readOnly)
|
|
|
|
|
return
|
|
|
|
|
// TODO what to do here?
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|