mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-02 09:46:38 +00:00
add export function and button
This commit is contained in:
parent
93376f0047
commit
82405cc425
@ -714,4 +714,11 @@ QtObject:
|
||||
self.status.chat.inviteUserToCommunity(self.activeCommunity.id(), pubKey)
|
||||
except Exception as e:
|
||||
error "Error inviting to the community", msg = e.msg
|
||||
result = fmt"Error inviting to the community: {e.msg}"
|
||||
result = fmt"Error inviting to the community: {e.msg}"
|
||||
|
||||
proc exportComumnity*(self: ChatsView): string {.slot.} =
|
||||
try:
|
||||
result = self.status.chat.exportCommunity(self.activeCommunity.communityItem.id)
|
||||
except Exception as e:
|
||||
error "Error exporting the community", msg = e.msg
|
||||
result = fmt"Error exporting the community: {e.msg}"
|
||||
|
@ -396,4 +396,7 @@ proc leaveCommunity*(self: ChatModel, communityId: string) =
|
||||
proc inviteUserToCommunity*(self: ChatModel, communityId: string, pubKey: string) =
|
||||
status_chat.inviteUserToCommunity(communityId, pubKey)
|
||||
# After sending the invite, we send a message with the community ID so they can join
|
||||
self.sendMessage(pubKey, "Upgrade here to see an invitation to community", "", ContentType.Community.int, communityId)
|
||||
self.sendMessage(pubKey, "Upgrade here to see an invitation to community", "", ContentType.Community.int, communityId)
|
||||
|
||||
proc exportCommunity*(self: ChatModel, communityId: string): string =
|
||||
result = status_chat.exportCommunity(communityId)
|
@ -300,4 +300,7 @@ proc leaveCommunity*(communityId: string) =
|
||||
|
||||
proc inviteUserToCommunity*(communityId: string, pubKey: string) =
|
||||
let res = callPrivateRPC("inviteUserToCommunity".prefix, %*[communityId, pubKey])#.parseJSON()["result"]
|
||||
debug "RESULT", res
|
||||
debug "RESULT", res
|
||||
|
||||
proc exportCommunity*(communityId: string):string =
|
||||
result = callPrivateRPC("exportCommunity".prefix, %*[communityId]).parseJson()["result"].getStr
|
@ -17,7 +17,7 @@ ModalPopup {
|
||||
property string source: "../../../img/ens-header-dark@2x.png"
|
||||
property int nbMembers: community.nbMembers
|
||||
property bool isAdmin: true // TODO:
|
||||
height: isAdmin ? 627 : 509
|
||||
height: isAdmin ? 640 : 509
|
||||
|
||||
id: popup
|
||||
|
||||
@ -181,6 +181,7 @@ ModalPopup {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CommunityPopupButton {
|
||||
id: notificationsBtn
|
||||
label: qsTr("Notifications")
|
||||
@ -199,9 +200,11 @@ ModalPopup {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Separator {
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
Loader {
|
||||
active: isAdmin
|
||||
width: parent.width
|
||||
@ -217,10 +220,52 @@ ModalPopup {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
property string exportResult: ""
|
||||
|
||||
active: isAdmin
|
||||
width: parent.width
|
||||
sourceComponent: !exportResult ? exportBtn : resultComponent
|
||||
|
||||
Component {
|
||||
id: exportBtn
|
||||
CommunityPopupButton {
|
||||
label: qsTr("Export community")
|
||||
iconName: "../fetch"
|
||||
onClicked: exportResult = chatsModel.exportComumnity()
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: resultComponent
|
||||
StyledText {
|
||||
property bool isError: !exportResult.startsWith("0x")
|
||||
|
||||
text: exportResult
|
||||
color: isError ? Style.current.danger : Style.current.textColor
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Style.current.smallPadding + copyToClipboardBtn.width
|
||||
wrapMode: TextEdit.WrapAnywhere
|
||||
|
||||
CopyToClipBoardButton {
|
||||
id: copyToClipboardBtn
|
||||
visible: !isError
|
||||
textToCopy: exportResult
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.right
|
||||
anchors.leftMargin: Style.current.smallPadding
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CommunityPopupButton {
|
||||
label: qsTr("Leave community")
|
||||
iconName: "leave"
|
||||
}
|
||||
|
||||
Loader {
|
||||
active: isAdmin
|
||||
width: parent.width
|
||||
|
Loading…
x
Reference in New Issue
Block a user