2022-10-05 14:51:42 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-10-20 11:57:41 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2022-10-05 14:51:42 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property bool pending: false
|
|
|
|
property bool accepted: false
|
|
|
|
property bool declined: false
|
|
|
|
|
|
|
|
signal acceptRequestToJoinCommunity()
|
|
|
|
signal declineRequestToJoinCommunity()
|
|
|
|
|
2022-10-20 11:57:41 +00:00
|
|
|
implicitWidth: Math.max(textItem.width, buttons.width)
|
|
|
|
implicitHeight: Math.max(textItem.height, buttons.height)
|
2022-10-05 14:51:42 +00:00
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
id: textItem
|
2022-10-19 12:56:00 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.right: parent.right
|
2022-11-15 10:11:55 +00:00
|
|
|
anchors.rightMargin: Style.current.smallPadding
|
2022-10-05 14:51:42 +00:00
|
|
|
visible: !pending
|
|
|
|
text: {
|
|
|
|
if (root.accepted) {
|
|
|
|
return qsTr("Accepted")
|
2022-10-20 11:57:41 +00:00
|
|
|
}
|
|
|
|
if (root.declined) {
|
2022-10-05 14:51:42 +00:00
|
|
|
return qsTr("Declined")
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
color: {
|
|
|
|
if (root.accepted) {
|
|
|
|
return Theme.palette.successColor1
|
2022-10-20 11:57:41 +00:00
|
|
|
}
|
|
|
|
if (root.declined) {
|
2022-10-05 14:51:42 +00:00
|
|
|
return Theme.palette.dangerColor1
|
|
|
|
}
|
|
|
|
return Theme.palette.directColor1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Row {
|
|
|
|
id: buttons
|
|
|
|
anchors.centerIn: parent
|
|
|
|
visible: pending
|
|
|
|
spacing: Style.current.padding
|
|
|
|
|
2022-10-20 11:57:41 +00:00
|
|
|
StatusRoundButton {
|
|
|
|
icon.name: "thumbs-up"
|
|
|
|
icon.color: Style.current.white
|
|
|
|
icon.hoverColor: Style.current.white
|
|
|
|
implicitWidth: 28
|
|
|
|
implicitHeight: 28
|
|
|
|
color: Theme.palette.successColor1
|
|
|
|
onClicked: root.acceptRequestToJoinCommunity()
|
2022-10-05 14:51:42 +00:00
|
|
|
}
|
|
|
|
|
2022-10-20 11:57:41 +00:00
|
|
|
StatusRoundButton {
|
|
|
|
icon.name: "thumbs-down"
|
|
|
|
icon.color: Style.current.white
|
|
|
|
icon.hoverColor: Style.current.white
|
|
|
|
implicitWidth: 28
|
|
|
|
implicitHeight: 28
|
|
|
|
color: Theme.palette.dangerColor1
|
|
|
|
onClicked: root.declineRequestToJoinCommunity()
|
2022-10-05 14:51:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|