chore(ChannelPermissions): Update storybook to support channel permissions in the create channel popup

This commit is contained in:
Alex Jbanca 2024-02-06 11:32:34 +02:00 committed by Alex Jbanca
parent 0b856737b1
commit b891243ad8
2 changed files with 55 additions and 25 deletions

View File

@ -3,7 +3,11 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQml 2.15
import StatusQ 0.1
import StatusQ.Core.Utils 0.1 as StatusQUtils
import Storybook 1.0
import Models 1.0
import AppLayouts.Communities.popups 1.0
@ -47,27 +51,29 @@ SplitView {
modal: false
closePolicy: Popup.NoAutoClose
destroyOnClose: true
isEdit: isEditCheckBox.checked
isEdit: true
isDeleteable: isDeleteableCheckBox.checked
isDiscordImport: isDiscordCheckBox.checked
Binding on channelName {
value: "test-channel"
when: dialog.isEdit
restoreMode: Binding.RestoreBindingOrValue
chatId: "_general"
channelName: "general"
channelDescription: "general discussion"
channelColor: "#4360DF"
activeCommunity: QtObject {
readonly property string id: "0x039c47e9837a1a7dcd00a6516399d0eb521ab0a92d512ca20a44ac6278bfdbb5c5"
readonly property string name: "test-1"
readonly property string image: ModelsData.icons.superRare
readonly property string color: "#4360DF"
readonly property int memberRole: 0
}
assetsModel: AssetsModel {}
channelsModel: ChannelsModel {}
collectiblesModel: CollectiblesModel {}
Binding on channelDescription {
value: "TEST TEST TEST"
when: dialog.isEdit
restoreMode: Binding.RestoreBindingOrValue
permissionsModel: ListModel {
id: permissionsModel
Component.onCompleted: {
append(PermissionsModel.channelsOnlyPermissionsModelData)
}
Binding on channelColor {
value: "pink"
when: dialog.isEdit
restoreMode: Binding.RestoreBindingOrValue
}
communitiesStore: QtObject {
@ -179,19 +185,12 @@ SplitView {
logsView.logText: logs.logText
RowLayout {
CheckBox {
id: isEditCheckBox
text: "isEdit"
onToggled: if (checked) isDiscordCheckBox.checked = false
}
CheckBox {
id: isDeleteableCheckBox
enabled: isEditCheckBox.checked
text: "isDeleteable"
}
CheckBox {
id: isDiscordCheckBox
enabled: !isEditCheckBox.checked
text: "isDiscordImport"
onToggled: {
if (!!dialog && dialog.opened)

View File

@ -57,6 +57,17 @@ QtObject {
}
]
readonly property var oneChannelPermissionsModelData: [
{
key: "iamakey",
holdingsListModel: root.createHoldingsModel4(),
channelsListModel: root.createChannelsModel(),
permissionType: PermissionTypes.Type.Admin,
permissionState: PermissionTypes.State.Approved,
isPrivate: false
}
]
readonly property var longPermissionsModelData: [
{
holdingsListModel: root.createHoldingsModel4(),
@ -460,6 +471,17 @@ QtObject {
}
}
readonly property var oneChannelPermissionsModel: ListModel {
readonly property ModelChangeGuard guard: ModelChangeGuard {
model: root.oneChannelPermissionsModel
}
Component.onCompleted: {
append(oneChannelPermissionsModelData)
guard.enabled = true
}
}
readonly property var longPermissionsModel: ListModel {
readonly property ModelChangeGuard guard: ModelChangeGuard {
model: root.longPermissionsModel
@ -726,6 +748,15 @@ QtObject {
]
}
function createChannelsModel() {
return [
{
key: "general",
channelName: "general discussion"
}
]
}
function createChannelsModel1() {
return [
{