Skip to content

Commit

Permalink
feat(ActivityCenter): Kicked from community notification
Browse files Browse the repository at this point in the history
  • Loading branch information
MishkaRogachev committed Oct 19, 2022
1 parent fd68ffb commit bdb84cc
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ui/app/mainui/activitycenter/controls/Badge.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Rectangle {
id: root

z: 100 // NOTE: workaround for message overlay
height: visible ? 24 : 0
width: childrenRect.width + Style.current.smallPadding * 2
implicitWidth: childrenRect.width + Style.current.smallPadding
implicitHeight: visible ? 24 : 0
radius: height / 2
border.width: 1
border.color: Style.current.borderSecondary
Expand Down
15 changes: 14 additions & 1 deletion ui/app/mainui/activitycenter/popups/ActivityCenterPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ Popup {
case ActivityCenterPopup.ActivityCategory.Membership:
return notificationType === Constants.activityCenterNotificationTypeCommunityInvitation ||
notificationType === Constants.activityCenterNotificationTypeCommunityMembershipRequest ||
notificationType === Constants.activityCenterNotificationTypeCommunityRequest
notificationType === Constants.activityCenterNotificationTypeCommunityRequest ||
notificationType === Constants.activityCenterNotificationTypeCommunityKicked
default:
return false
}
Expand Down Expand Up @@ -92,6 +93,9 @@ Popup {
case Constants.activityCenterNotificationTypeCommunityRequest:
root.membershipCount += cnt;
break;
case Constants.ActivityCenterNotificationTypeCommunityKicked:
root.membershipCount += cnt;
break;
default:
break;
}
Expand Down Expand Up @@ -250,6 +254,15 @@ Popup {
notification: model
}
}
DelegateChoice {
roleValue: Constants.activityCenterNotificationTypeCommunityKicked

ActivityNotificationCommunityKicked {
width: listView.availableWidth
store: root.store
notification: model
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import QtQuick 2.14
import QtQuick.Layouts 1.14

import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1

import shared 1.0
import shared.panels 1.0
import shared.controls 1.0
import utils 1.0

import "../controls"

ActivityNotificationBase {
id: root

bodyComponent: RowLayout {
readonly property var community: root.store.getCommunityDetailsAsJson(notification.communityId)

StatusSmartIdenticon {
id: identicon
name: community.name
asset.width: 40
asset.height: 40
asset.color: community.color
asset.letterSize: width / 2.4
asset.name: community.image
asset.isImage: true
Layout.leftMargin: Style.current.padding
}

StatusBaseText {
text: qsTr("You were kicked from")
Layout.alignment: Qt.AlignVCenter
}

CommunityBadge {
communityName: community.name
communityImage: community.image
communityColor: community.color
onCommunityNameClicked: root.store.setActiveCommunity(notification.communityId)
Layout.alignment: Qt.AlignVCenter
}

Item {
Layout.fillWidth: true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ ActivityNotificationBase {
asset.letterSize: width / 2.4
asset.name: community.image
asset.isImage: true
Layout.leftMargin: Style.current.padding
}

StyledText {
StatusBaseText {
text: qsTr("Request to join")
font.weight: Font.Medium
font.pixelSize: 13
Layout.alignment: Qt.AlignVCenter
}

Expand All @@ -44,7 +43,7 @@ ActivityNotificationBase {
Layout.alignment: Qt.AlignVCenter
}

StyledText {
StatusBaseText {
text: {
if (notification.membershipStatus === Constants.activityCenterMembershipStatusPending)
return qsTr("pending")
Expand All @@ -54,13 +53,13 @@ ActivityNotificationBase {
return qsTr("declined")
return ""
}
font.weight: Font.Medium
font.pixelSize: 13
color: Style.current.secondaryText
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
}
}

ctaComponent: notification.membershipStatus === Constants.activityCenterMembershipStatusPending ? visitComponent : null
ctaComponent: notification.membershipStatus === Constants.activityCenterMembershipStatusAccepted ? visitComponent : null

Component {
id: visitComponent
Expand Down
1 change: 1 addition & 0 deletions ui/imports/utils/Constants.qml
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ QtObject {
readonly property int activityCenterNotificationTypeCommunityInvitation: 6
readonly property int activityCenterNotificationTypeCommunityRequest: 7
readonly property int activityCenterNotificationTypeCommunityMembershipRequest: 8
readonly property int activityCenterNotificationTypeCommunityKicked: 9

readonly property int activityCenterMembershipStatusPending: 1
readonly property int activityCenterMembershipStatusAccepted: 2
Expand Down
2 changes: 1 addition & 1 deletion vendor/status-go

0 comments on commit bdb84cc

Please sign in to comment.