[#2563] Fixed hover over Join button has wrong shape

For performance reasons clipping doesn't work
with rounded corners - wrapping Join button in
an Item and apply clipping there instead

Closes #2563
This commit is contained in:
Alexandra Betouni 2021-07-20 15:08:36 +03:00 committed by Iuri Matias
parent 076a5bc5b7
commit 7ac63b4451
1 changed files with 57 additions and 52 deletions

View File

@ -63,7 +63,7 @@ Item {
} }
} }
} }
Loader { Loader {
id: rectangleBubbleLoader id: rectangleBubbleLoader
@ -127,8 +127,8 @@ Item {
State { State {
name: "requestToJoin" name: "requestToJoin"
when: invitedCommunity.access === Constants.communityChatOnRequestAccess && when: invitedCommunity.access === Constants.communityChatOnRequestAccess &&
// !invitedCommunity.joined && !invitedCommunity.isMember // !invitedCommunity.joined && !invitedCommunity.isMember
invitedCommunity.canRequestAccess invitedCommunity.canRequestAccess
PropertyChanges { PropertyChanges {
target: joinBtn target: joinBtn
//% "Request Access" //% "Request Access"
@ -178,17 +178,17 @@ Item {
id: invitedYou id: invitedYou
text: { text: {
if (chatsModel.channelView.activeChannel.chatType === Constants.chatTypeOneToOne) { if (chatsModel.channelView.activeChannel.chatType === Constants.chatTypeOneToOne) {
return isCurrentUser ? return isCurrentUser ?
//% "You invited %1 to join a community" //% "You invited %1 to join a community"
qsTrId("you-invited--1-to-join-a-community").arg(chatsModel.userNameOrAlias(chatsModel.channelView.activeChannel.id)) qsTrId("you-invited--1-to-join-a-community").arg(chatsModel.userNameOrAlias(chatsModel.channelView.activeChannel.id))
//% "%1 invited you to join a community" //% "%1 invited you to join a community"
: qsTrId("-1-invited-you-to-join-a-community").arg(displayUserName) : qsTrId("-1-invited-you-to-join-a-community").arg(displayUserName)
} else { } else {
return isCurrentUser ? return isCurrentUser ?
//% "You shared a community" //% "You shared a community"
qsTrId("you-shared-a-community") qsTrId("you-shared-a-community")
//% "A community has been shared" //% "A community has been shared"
: qsTrId("a-community-has-been-shared") : qsTrId("a-community-has-been-shared")
} }
} }
anchors.top: title.bottom anchors.top: title.bottom
@ -254,56 +254,61 @@ Item {
anchors.top: communityNbMembers.bottom anchors.top: communityNbMembers.bottom
anchors.topMargin: Style.current.halfPadding anchors.topMargin: Style.current.halfPadding
} }
Item {
StatusButton {
id: joinBtn
type: "secondary"
anchors.top: sep2.bottom
width: parent.width width: parent.width
height: 44 height: 44
enabled: true anchors.bottom: parent.bottom
//% "Unsupported state" clip: true
text: qsTrId("unsupported-state") StatusButton {
onClicked: { id: joinBtn
let onBtnClick = function(){ type: "secondary"
let error anchors.top: parent.top
anchors.topMargin: -Style.current.smallPadding
borderRadius: 16
width: parent.width
height: 54
enabled: true
//% "Unsupported state"
text: qsTrId("unsupported-state")
onClicked: {
let onBtnClick = function(){
let error
if (rectangleBubble.state === "joined") { if (rectangleBubble.state === "joined") {
chatsModel.communities.setActiveCommunity(communityId); chatsModel.communities.setActiveCommunity(communityId);
return return
} else if (rectangleBubble.state === "unjoined") { } else if (rectangleBubble.state === "unjoined") {
error = chatsModel.communities.joinCommunity(communityId, true) error = chatsModel.communities.joinCommunity(communityId, true)
} }
else if (rectangleBubble.state === "requestToJoin") { else if (rectangleBubble.state === "requestToJoin") {
error = chatsModel.communities.requestToJoinCommunity(communityId, error = chatsModel.communities.requestToJoinCommunity(communityId,
profileModel.profile.ensVerified ? profileModel.profile.username : "") profileModel.profile.ensVerified ? profileModel.profile.username : "")
if (!error) { if (!error) {
rectangleBubble.isPendingRequest = chatsModel.communities.isCommunityRequestPending(communityId) rectangleBubble.isPendingRequest = chatsModel.communities.isCommunityRequestPending(communityId)
}
}
if (error) {
joiningError.text = error
return joiningError.open()
} }
} }
if (error) { if (appSettings.communitiesEnabled) {
joiningError.text = error onBtnClick();
return joiningError.open() } else {
openPopup(confirmationPopupComponent, { onConfirmed: onBtnClick });
} }
} }
if(appSettings.communitiesEnabled){ MessageDialog {
onBtnClick(); id: joiningError
} else { //% "Error joining the community"
openPopup(confirmationPopupComponent, { title: qsTrId("error-joining-the-community")
onConfirmed: onBtnClick icon: StandardIcon.Critical
}); standardButtons: StandardButton.Ok
} }
} }
MessageDialog {
id: joiningError
//% "Error joining the community"
title: qsTrId("error-joining-the-community")
icon: StandardIcon.Critical
standardButtons: StandardButton.Ok
}
} }
} }
} }