Show an "Upgrade plan" button to users that have reached maximum projects

Instead of letting users go through the project creation process only to get rejected with a "subscription limits reached" message, now the "New Library project" button is being replaced with an "Upgrade plan" button when the maximum allowed projects have been reached for the specific amount. The button is accompanied by a tooltip that explains the situation to the user. Once clicked, the user is redirected to the subscriptions page.

CURA-8112
This commit is contained in:
Konstantinos Karmas 2021-07-13 17:28:38 +02:00
parent 9ddb3b7713
commit 2d45b8c2cd
3 changed files with 57 additions and 1 deletions

View file

@ -18,7 +18,7 @@ Item
width: parent.width
height: parent.height
property alias createNewProjectButtonVisible: createNewProjectButton.visible
property bool createNewProjectButtonVisible: true
anchors
{
@ -48,6 +48,7 @@ Item
anchors.verticalCenter: selectProjectLabel.verticalCenter
anchors.right: parent.right
text: "New Library project"
visible: createNewProjectButtonVisible && manager.userAccountCanCreateNewLibraryProject && (manager.retrievingProjectsStatus == DF.RetrievalStatus.Success || manager.retrievingProjectsStatus == DF.RetrievalStatus.Failed)
onClicked:
{
@ -56,6 +57,20 @@ Item
busy: manager.creatingNewProjectStatus == DF.RetrievalStatus.InProgress
}
Cura.SecondaryButton
{
id: upgradePlanButton
anchors.verticalCenter: selectProjectLabel.verticalCenter
anchors.right: parent.right
text: "Upgrade plan"
visible: createNewProjectButtonVisible && !manager.userAccountCanCreateNewLibraryProject && (manager.retrievingProjectsStatus == DF.RetrievalStatus.Success || manager.retrievingProjectsStatus == DF.RetrievalStatus.Failed)
tooltip: "You have reached the maximum number of projects allowed by your subscription. Please upgrade to the Professional subscription to create more projects."
onClicked: Qt.openUrlExternally("https://ultimaker.com/software/enterprise-software")
}
Item
{
id: noLibraryProjectsContainer