feat(Community Permission): Add conflicts warning panel

It adds conflicts warning in `New permission` page. Mocked data.

Closes #8738
This commit is contained in:
Noelia 2023-01-23 16:50:34 +01:00 committed by Noelia
parent 75711aef2e
commit a3313b563f
4 changed files with 85 additions and 2 deletions

View File

@ -0,0 +1,65 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import utils 1.0
Control {
id: root
property string holdings
property string permissions
property string channels
spacing: 8
QtObject {
id: d
property int iconSize: 20
}
contentItem: ColumnLayout {
spacing: 4
RowLayout {
spacing: root.spacing
StatusIcon {
Layout.preferredWidth: d.iconSize
Layout.preferredHeight: d.iconSize
Layout.alignment: Qt.AlignTop
color: Theme.palette.dangerColor1
icon: "warning"
}
StatusBaseText {
Layout.fillWidth: true
wrapMode: Text.Wrap
font.pixelSize: Style.current.primaryTextFontSize
color: Theme.palette.dangerColor1
font.bold: true
text: qsTr("Conflicts with existing permission:")
}
}
StatusBaseText {
Layout.leftMargin: root.spacing + d.iconSize
Layout.fillWidth: true
wrapMode: Text.Wrap
font.pixelSize: Style.current.primaryTextFontSize
font.bold: true
text: qsTr("\"Anyone who holds %1 can %2 in %3\"").arg(root.holdings).arg(root.permissions).arg(root.channels)
}
StatusBaseText {
Layout.leftMargin: root.spacing + d.iconSize
Layout.fillWidth: true
wrapMode: Text.Wrap
font.pixelSize: Style.current.primaryTextFontSize
text: qsTr("Edit permissions to resolve a conflict.")
}
}
}

View File

@ -2,3 +2,4 @@ CommunityPermissionsSettingsPanel 1.0 CommunityPermissionsSettingsPanel.qml
CommunityProfilePopupInviteFriendsPanel 1.0 CommunityProfilePopupInviteFriendsPanel.qml
CommunityProfilePopupInviteMessagePanel 1.0 CommunityProfilePopupInviteMessagePanel.qml
PermissionQualificationPanel 1.0 PermissionQualificationPanel.qml
PermissionConflictWarningPanel 1.0 PermissionConflictWarningPanel.qml

View File

@ -3,7 +3,14 @@ import QtQuick 2.0
QtObject {
id: root
property var permissionsModel: ListModel {} // Backend permissions list object model asignement. Please check the current expected data in qml defined in `createPermissions` method
property var permissionsModel: ListModel {} // Backend permissions list object model assignment. Please check the current expected data in qml defined in `createPermissions` method
property var permissionConflict: QtObject { // Backend conflicts object model assignment. Now mocked data.
property bool exists: false
property string holdings: qsTr("1 ETH")
property string permissions: qsTr("View and Post")
property string channels: qsTr("#general")
}
// TODO: Replace to real data, now dummy model
property var assetsModel: ListModel {

View File

@ -518,9 +518,19 @@ StatusScrollView {
}
}
PermissionConflictWarningPanel{
id: conflictPanel
visible: store.permissionConflict.exists
Layout.fillWidth: true
Layout.topMargin: 50 // by desing
holdings: store.permissionConflict.holdings
permissions: store.permissionConflict.permissions
channels: store.permissionConflict.channels
}
StatusButton {
visible: !root.isEditState
Layout.topMargin: 24
Layout.topMargin: conflictPanel.visible ? conflictPanel.Layout.topMargin : 24 // by design
text: qsTr("Create permission")
enabled: d.dirtyValues.holdingsModel && d.dirtyValues.holdingsModel.count > 0 && d.dirtyValues.permissionObject.key !== null
Layout.preferredHeight: 44