2022-07-25 15:07:19 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Layouts 1.4
|
|
|
|
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
2022-07-25 15:07:19 +00:00
|
|
|
import shared.controls 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.panels 1.0
|
2022-07-25 15:07:19 +00:00
|
|
|
import shared.views 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.status 1.0
|
2021-07-15 11:15:56 +00:00
|
|
|
|
2022-07-25 15:07:19 +00:00
|
|
|
ColumnLayout {
|
2021-04-20 12:31:36 +00:00
|
|
|
id: root
|
|
|
|
|
|
|
|
property string headerTitle: ""
|
|
|
|
|
2022-01-10 16:44:54 +00:00
|
|
|
property var rootStore
|
|
|
|
property var contactsStore
|
2021-07-16 12:36:27 +00:00
|
|
|
property var community
|
2021-04-20 12:31:36 +00:00
|
|
|
|
2022-07-25 15:07:19 +00:00
|
|
|
property var pubKeys: ([])
|
2021-07-15 11:15:56 +00:00
|
|
|
|
2022-08-23 14:57:37 +00:00
|
|
|
spacing: Style.current.bigPadding
|
2021-08-04 12:34:06 +00:00
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: headline
|
|
|
|
text: qsTr("Contacts")
|
|
|
|
font.pixelSize: Style.current.primaryTextFontSize
|
|
|
|
color: Style.current.secondaryText
|
2022-08-23 14:57:37 +00:00
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
Layout.rightMargin: Style.current.padding
|
2021-04-20 12:31:36 +00:00
|
|
|
}
|
|
|
|
|
2022-07-25 15:07:19 +00:00
|
|
|
StatusInput {
|
|
|
|
id: filterInput
|
|
|
|
placeholderText: qsTr("Search contacts")
|
2022-08-11 11:55:08 +00:00
|
|
|
input.asset.name: "search"
|
2022-07-25 15:07:19 +00:00
|
|
|
input.clearable: true
|
|
|
|
Layout.fillWidth: true
|
2022-08-23 14:57:37 +00:00
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
Layout.rightMargin: Style.current.padding
|
|
|
|
maximumHeight: 36
|
|
|
|
topPadding: 0
|
|
|
|
bottomPadding: 0
|
2022-07-25 15:07:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ExistingContacts {
|
|
|
|
id: existingContacts
|
|
|
|
|
2022-09-16 08:30:08 +00:00
|
|
|
rootStore: root.rootStore
|
2022-01-10 16:44:54 +00:00
|
|
|
contactsStore: root.contactsStore
|
2022-09-16 08:30:08 +00:00
|
|
|
communityId: root.community.id
|
|
|
|
|
2021-05-17 09:56:55 +00:00
|
|
|
hideCommunityMembers: true
|
2022-07-25 15:07:19 +00:00
|
|
|
showCheckbox: true
|
|
|
|
filterText: filterInput.text
|
|
|
|
pubKeys: root.pubKeys
|
|
|
|
onContactClicked: function (contact) {
|
|
|
|
if (!contact || typeof contact === "string") {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
const index = root.pubKeys.indexOf(contact.pubKey)
|
|
|
|
const pubKeysCopy = Object.assign([], root.pubKeys)
|
|
|
|
if (index === -1) {
|
|
|
|
pubKeysCopy.push(contact.pubKey)
|
|
|
|
} else {
|
|
|
|
pubKeysCopy.splice(index, 1)
|
|
|
|
}
|
|
|
|
root.pubKeys = pubKeysCopy
|
|
|
|
}
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2022-08-23 14:57:37 +00:00
|
|
|
Layout.leftMargin: Style.current.halfPadding
|
|
|
|
Layout.rightMargin: Style.current.halfPadding
|
2022-07-25 15:07:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusModalDivider {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusDescriptionListItem {
|
|
|
|
title: qsTr("Share community")
|
|
|
|
subTitle: `${Constants.communityLinkPrefix}${root.community && root.community.id.substring(0, 4)}...${root.community && root.community.id.substring(root.community.id.length -2)}`
|
|
|
|
tooltip.text: qsTr("Copied!")
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.name: "copy"
|
2022-07-25 15:07:19 +00:00
|
|
|
iconButton.onClicked: {
|
|
|
|
let link = `${Constants.communityLinkPrefix}${root.community.id}`
|
|
|
|
root.rootStore.copyToClipboard(link)
|
|
|
|
tooltip.visible = !tooltip.visible
|
|
|
|
}
|
2021-04-20 12:31:36 +00:00
|
|
|
}
|
|
|
|
}
|