fix: ui fixes for renewal subscription (#2406)

This commit is contained in:
NickVs2015
2026-03-25 07:34:42 +03:00
committed by GitHub
parent f0f0f7c5be
commit 9a0222aee3
8 changed files with 193 additions and 37 deletions
@@ -19,6 +19,15 @@ ListViewType {
id: root
property int selectedIndex: ServersModel.defaultIndex
property int expiredServerIndex: -1
property bool expiringSoon: false
Connections {
target: ApiAccountInfoModel
function onModelReset() {
root.expiringSoon = ApiAccountInfoModel.data("isSubscriptionExpiringSoon")
}
}
anchors.top: serversMenuHeader.bottom
anchors.right: parent.right
@@ -35,6 +44,13 @@ ListViewType {
}
}
Connections {
target: ApiConfigsController
function onSubscriptionExpiredOnServer() {
root.expiredServerIndex = ServersModel.defaultIndex
}
}
delegate: Item {
id: menuContentDelegate
objectName: "menuContentDelegate"
@@ -126,6 +142,18 @@ ListViewType {
}
}
CaptionTextType {
visible: isServerFromGatewayApi && (index === root.expiredServerIndex || (root.expiringSoon && index === root.selectedIndex && index !== root.expiredServerIndex))
Layout.fillWidth: true
Layout.leftMargin: 64
Layout.bottomMargin: 8
text: index === root.expiredServerIndex ? qsTr("Subscription expired. Please renew.") : qsTr("Subscription expiring soon.")
color: index === root.expiredServerIndex ? AmneziaStyle.color.vibrantRed : AmneziaStyle.color.goldenApricot
wrapMode: Text.WordWrap
}
DividerType {
Layout.fillWidth: true
Layout.leftMargin: 0
@@ -37,29 +37,11 @@ DrawerType2 {
Header2TextType {
id: titleText
anchors.left: parent.left
anchors.right: icon.left
anchors.rightMargin: 8
anchors.right: parent.right
text: qsTr("Amnezia Premium subscription has expired")
horizontalAlignment: Text.AlignLeft
}
Image {
id: icon
anchors.right: parent.right
anchors.top: parent.top
width: 40
height: 40
source: "qrc:/images/controls/history.svg"
fillMode: Image.PreserveAspectFit
visible: false
}
ColorOverlay {
anchors.fill: icon
source: icon
color: AmneziaStyle.color.goldenApricot
}
}
ParagraphTextType {
@@ -91,11 +73,11 @@ DrawerType2 {
}
BasicButtonType {
Layout.fillWidth: true
Layout.topMargin: 4
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 8
Layout.bottomMargin: 8
Layout.rightMargin: 16
Layout.leftMargin: 16
implicitHeight: 25
defaultColor: AmneziaStyle.color.transparent
hoveredColor: AmneziaStyle.color.translucentWhite