status-desktop/ui/app/AppLayouts/Communities/controls/AirdropRecipientsSelector.qml
Noelia 0ab8a62896 feat(Communities): Communities folder reorganization
- Renamed main `CommunitiesPortal` folder to `Communities`.
- Created new `layouts` folder.
- Moved layout files from chat to communities.
- Created new `helpers` folder.
- Moved helpers files from chat to communities.
- Moved `controls/community` files from chat to communities `controls`.
- Moved `panels/communities` files from chat to communities `panels`.
- Moved `popups/community` files from chat to communities `popups`.
- Moved `views/community` files from chat to communities `views`.
- Moved `CommunityBanner` file from shared to `Communities/controls`. Only used in communities context.
- Moved `CommunitySettingsView` and `CommunityColumnView` files from chat to communities `views`.
- Moved `PermissionsStore.qml` file to `shared/stores`.
- Updated imports.
- Updated storybook.

Part of #6204
2023-06-28 14:28:47 +02:00

100 lines
3.0 KiB
QML

import QtQuick 2.15
import StatusQ.Core 0.1
import StatusQ.Components 0.1
import StatusQ.Core.Theme 0.1
import utils 1.0
StatusFlowSelector {
id: root
property alias addressesModel: addressesSelectorPanel.model
property alias membersModel: membersSelectorPanel.model
property alias loadingAddresses: addressesSelectorPanel.loading
property alias addressesInputText: addressesSelectorPanel.text
property bool showAddressesInputWhenEmpty: false
property int maxNumberOfRecipients: 0
property bool infiniteMaxNumberOfRecipients: false
readonly property int count: addressesSelectorPanel.count +
membersSelectorPanel.count
readonly property bool valid:
addressesSelectorPanel.invalidAddressesCount === 0 &&
(infiniteMaxNumberOfRecipients || count <= maxNumberOfRecipients)
signal addAddressesRequested(string addresses)
signal removeAddressRequested(int index)
signal removeMemberRequested(int index)
placeholderItem.visible: !addressesSelectorPanel.visible &&
!membersSelectorPanel.visible
title: qsTr("To")
icon: Style.svg("member")
flowSpacing: addressesSelectorPanel.visible || membersSelectorPanel.visible
? 12 : 6
placeholderText: qsTr("Example: 12 addresses and 3 members")
function forceInputFocus() {
addressesSelectorPanel.forceInputFocus()
}
function clearAddressesInput() {
addressesSelectorPanel.clearInput()
}
function positionAddressesListAtEnd() {
addressesSelectorPanel.positionListAtEnd()
}
function positionMembersListAtEnd() {
membersSelectorPanel.positionListAtEnd()
}
StatusBaseText {
parent: label
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
readonly property bool valid: root.infiniteMaxNumberOfRecipients ||
root.count <= root.maxNumberOfRecipients
text: root.count + " / " + (root.infiniteMaxNumberOfRecipients
? qsTr("∞ recipients", "infinite number of recipients")
: qsTr("%n recipient(s)", "", root.maxNumberOfRecipients))
font.pixelSize: Theme.tertiaryTextFontSize + 1
color: valid ? Theme.palette.baseColor1 : Theme.palette.dangerColor1
elide: Text.ElideRight
}
AddressesSelectorPanel {
id: addressesSelectorPanel
visible: count > 0 || root.showAddressesInputWhenEmpty
width: root.availableWidth
Component.onCompleted: {
addAddressesRequested.connect(root.addAddressesRequested)
removeAddressRequested.connect(root.removeAddressRequested)
}
}
MembersSelectorPanel {
id: membersSelectorPanel
visible: count > 0
width: root.availableWidth
Component.onCompleted: removeMemberRequested.connect(
root.removeMemberRequested)
}
}