Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Community Permissions] Update Is allowed, In and Hide permission logic according to the new design #9211

Merged
merged 4 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 56 additions & 31 deletions storybook/pages/CommunityNewPermissionViewPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,76 @@ import QtQuick.Controls 2.14
import AppLayouts.Chat.views.communities 1.0
import AppLayouts.Chat.stores 1.0

import Storybook 1.0
import Models 1.0

Pane {
id: root
SplitView {
orientation: Qt.Vertical
SplitView.fillWidth: true

CommunityNewPermissionView {
Logs { id: logs }

store: CommunitiesStore {
readonly property var assetsModel: AssetsModel {}
readonly property var collectiblesModel: CollectiblesModel {}
readonly property var channelsModel: ChannelsModel {}
readonly property var permissionConflict: QtObject {
property bool exists: true
property string holdings: "1 ETH"
property string permissions: "View and Post"
property string channels: "#general"
Pane {
id: root

}
CommunityNewPermissionView {

function editPermission(index, holdings, permissions, channels, isPrivate) {
logs.logEvent("CommunitiesStore::editPermission - index: " + index)
}
store: CommunitiesStore {
readonly property var assetsModel: AssetsModel {}
readonly property var collectiblesModel: CollectiblesModel {}
readonly property var channelsModel: ChannelsModel {}
readonly property var permissionConflict: QtObject {
property bool exists: true
property string holdings: "1 ETH"
property string permissions: "View and Post"
property string channels: "#general"

function duplicatePermission(index) {
logs.logEvent("CommunitiesStore::duplicatePermission - index: " + index)
}
}

function removePermission(index) {
logs.logEvent("CommunitiesStore::removePermission - index: " + index)
}
}
readonly property bool isOwner: isOwnerCheckBox.checked

function editPermission(index, holdings, permissions, channels, isPrivate) {
logs.logEvent("CommunitiesStore::editPermission - index: " + index)
}

function duplicatePermission(index) {
logs.logEvent("CommunitiesStore::duplicatePermission - index: " + index)
}

rootStore: QtObject {
readonly property QtObject chatCommunitySectionModule: QtObject {
readonly property var model: ChannelsModel {}
function removePermission(index) {
logs.logEvent("CommunitiesStore::removePermission - index: " + index)
}
}

readonly property QtObject mainModuleInst: QtObject {
rootStore: QtObject {
readonly property QtObject chatCommunitySectionModule: QtObject {
readonly property var model: ChannelsModel {}
}

readonly property QtObject mainModuleInst: QtObject {

readonly property QtObject activeSection: QtObject {
readonly property string name: "Socks"
readonly property string image: ModelsData.icons.socks
readonly property color color: "red"
readonly property QtObject activeSection: QtObject {
readonly property string name: "Socks"
readonly property string image: ModelsData.icons.socks
readonly property color color: "red"
}
}
}
}
}

LogsAndControlsPanel {
id: logsAndControlsPanel

SplitView.minimumHeight: 100
SplitView.preferredHeight: 150

logsView.logText: logs.logText

CheckBox {
id: isOwnerCheckBox

text: "Is owner"
}
}
}
113 changes: 60 additions & 53 deletions storybook/pages/CommunityPermissionsSettingsPanelPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,78 +8,85 @@ import StatusQ.Core.Theme 0.1
import Storybook 1.0
import Models 1.0


SplitView {
orientation: Qt.Vertical
SplitView.fillWidth: true

Logs { id: logs }

SplitView {
orientation: Qt.Vertical
Rectangle {
SplitView.fillWidth: true
SplitView.fillHeight: true
color: Theme.palette.statusAppLayout.rightPanelBackgroundColor
CommunityPermissionsSettingsPanel {
anchors {
fill: parent
topMargin: 50
}
store: CommunitiesStore {
readonly property bool isOwner: isOwnerCheckBox.checked

Rectangle {
SplitView.fillWidth: true
SplitView.fillHeight: true
color: Theme.palette.statusAppLayout.rightPanelBackgroundColor
CommunityPermissionsSettingsPanel {
anchors {
fill: parent
topMargin: 50
}
store: CommunitiesStore {
assetsModel: AssetsModel {}
collectiblesModel: CollectiblesModel {}
channelsModel: ListModel {
Component.onCompleted: {
append([
{
key: "welcome",
iconSource: ModelsData.assets.inch,
name: "#welcome"
},
{
key: "general",
iconSource: ModelsData.assets.inch,
name: "#general"
}
])
}
assetsModel: AssetsModel {}
collectiblesModel: CollectiblesModel {}
channelsModel: ListModel {
Component.onCompleted: {
append([
{
key: "welcome",
iconSource: ModelsData.assets.inch,
name: "#welcome"
},
{
key: "general",
iconSource: ModelsData.assets.inch,
name: "#general"
}
])
}
}

function editPermission(index, holdings, permissions, channels, isPrivate) {
logs.logEvent("CommunitiesStore::editPermission - index: " + index)
}
function editPermission(index, holdings, permissions, channels, isPrivate) {
logs.logEvent("CommunitiesStore::editPermission - index: " + index)
}

function duplicatePermission(index) {
logs.logEvent("CommunitiesStore::duplicatePermission - index: " + index)
}
function duplicatePermission(index) {
logs.logEvent("CommunitiesStore::duplicatePermission - index: " + index)
}

function removePermission(index) {
logs.logEvent("CommunitiesStore::removePermission - index: " + index)
}
function removePermission(index) {
logs.logEvent("CommunitiesStore::removePermission - index: " + index)
}
}

rootStore: QtObject {
readonly property QtObject chatCommunitySectionModule: QtObject {
readonly property var model: ChannelsModel {}
}
rootStore: QtObject {
readonly property QtObject chatCommunitySectionModule: QtObject {
readonly property var model: ChannelsModel {}
}

readonly property QtObject mainModuleInst: QtObject {
readonly property QtObject activeSection: QtObject {
readonly property string name: "Socks"
readonly property string image: ModelsData.icons.socks
readonly property color color: "red"
}
readonly property QtObject mainModuleInst: QtObject {
readonly property QtObject activeSection: QtObject {
readonly property string name: "Socks"
readonly property string image: ModelsData.icons.socks
readonly property color color: "red"
}
}
}
}
}

LogsAndControlsPanel {
id: logsAndControlsPanel

SplitView.minimumHeight: 100
SplitView.preferredHeight: 150

LogsAndControlsPanel {
id: logsAndControlsPanel
logsView.logText: logs.logText

micieslak marked this conversation as resolved.
Show resolved Hide resolved
SplitView.minimumHeight: 100
SplitView.preferredHeight: 150
CheckBox {
id: isOwnerCheckBox

logsView.logText: logs.logText
text: "Is owner"
}
}
}
17 changes: 17 additions & 0 deletions storybook/pages/InDropdownPage.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14

import AppLayouts.Chat.controls.community 1.0

Expand All @@ -23,6 +24,9 @@ SplitView {
parent: pane
anchors.centerIn: parent

allowChoosingEntireCommunity: allowChoosingEntireCommunityCheckBox.checked
showAddChannelButton: showAddChannelButtonCheckBox.checked

communityName: "Socks"
communityImage: ModelsData.icons.socks
communityColor: "red"
Expand Down Expand Up @@ -53,5 +57,18 @@ SplitView {
SplitView.preferredHeight: 200

logsView.logText: logs.logText

ColumnLayout {
CheckBox {
id: allowChoosingEntireCommunityCheckBox

text: "Allow choosing entire community"
}
CheckBox {
id: showAddChannelButtonCheckBox

text: "Show \"Add channel\" button"
}
}
}
}
10 changes: 9 additions & 1 deletion ui/StatusQ/src/StatusQ/Components/StatusItemSelector.qml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ Rectangle {
*/
property bool useLetterIdenticons: false

/*!
\qmlproperty bool StatusItemSelector::itemsClickable
This property determines if items in the selector are clickable (cursor
is changed on hover and itemClicked emitted when clicked)
*/
property bool itemsClickable: true

/*!
\qmlsignal StatusItemSelector::itemClicked
This signal is emitted when the item is clicked.
Expand Down Expand Up @@ -217,7 +224,8 @@ Rectangle {

MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
enabled: root.itemsClickable
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: root.itemClicked(parent, model.index, mouse)
}
Expand Down
10 changes: 10 additions & 0 deletions ui/app/AppLayouts/Chat/controls/community/InDropdown.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import SortFilterProxyModel 0.2
StatusDropdown {
id: root

property bool allowChoosingEntireCommunity: false
property bool showAddChannelButton: false

property string communityName
property string communityImage
property color communityColor
Expand Down Expand Up @@ -100,6 +103,7 @@ StatusDropdown {
Layout.topMargin: 9
Layout.preferredHeight: 44

visible: root.allowChoosingEntireCommunity

title: root.communityName
subTitle: qsTr("Community")
Expand Down Expand Up @@ -147,13 +151,17 @@ StatusDropdown {
Layout.fillWidth: true
Layout.topMargin: 4 - implicitHeight / 2
Layout.bottomMargin: 4 - implicitHeight / 2

visible: root.allowChoosingEntireCommunity
}

StatusScrollView {
id: scrollView

Layout.fillWidth: true
Layout.bottomMargin: 9
Layout.topMargin:
!root.allowChoosingEntireCommunity && !root.allowChoosingEntireCommunity ? 9 : 0

padding: 0

Expand All @@ -166,6 +174,8 @@ StatusDropdown {
StatusIconTextButton {
Layout.preferredHeight: 36

visible: root.showAddChannelButton

leftPadding: 8
spacing: 8
statusIcon: "add"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import StatusQ.Controls 0.1
import QtQuick 2.14
import QtQuick.Controls 2.14

import utils 1.0

StatusListItem {
id: root

Expand All @@ -22,10 +24,17 @@ StatusListItem {
asset.bgWidth: 32
asset.bgHeight: 32

Binding on asset.color {
when: !root.enabled
value: Style.current.darkGrey
}

components: [
StatusRadioButton {
id: radioButton

visible: root.enabled

// reference to root for better integration with ButtonGroup
// by accessing main component via ButtonGroup::checkedButton.item
readonly property alias item: root
Expand Down
Loading