Files
amnezia-client/client/ui/qml/Components/HomeServerSummary.qml
T
vkamn 11355e1de0 feat: new design system (#3280)
* refactor: focus controller refactoring

* feat: update to new design system

* feat: update to new desing system

* chore: bump version
2026-10-14 11:13:36 +08:00

126 lines
3.5 KiB
QML

import QtQuick
import QtQuick.Layouts
import Style 1.0
import "../Controls2"
import "../Controls2/TextTypes"
ColumnLayout {
id: root
property bool expanded: false
property bool pressed: false
property bool outdatedWarningVisible: false
property bool protocolSelectionVisible: false
property bool protocolSelectable: false
property string protocolText
signal expandRequested()
signal serverInfoRequested()
signal protocolSelectionRequested()
objectName: "collapsedColumnLayout"
spacing: 0
RowLayout {
objectName: "rowLayout"
Layout.topMargin: 16
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
spacing: 10
H1TextType {
objectName: "collapsedButtonHeader"
Layout.maximumWidth: root.width - 32 - (chevron.visible ? chevron.width + 10 : 0)
maximumLineCount: 1
wrapMode: Text.NoWrap
elide: Qt.ElideRight
text: ServersUiController.defaultServerName
horizontalAlignment: Qt.AlignHCenter
}
IconButtonType {
id: chevron
objectName: "collapsedButtonChevron"
visible: !root.expanded
hoverEnabled: false
down: pressed || root.pressed
size: IconButtonType.Small
icon.source: "qrc:/images/controls/chevron-down.svg"
onClicked: root.expandRequested()
}
}
HomeInfoButton {
objectName: "serverDescriptionButton"
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 6
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.bottomMargin: (root.outdatedWarningVisible || root.protocolSelectionVisible) ? 8 : 16
enabled: ServersUiController.defaultServerImagePathCollapsed !== ""
largeText: true
maximumLineCount: 2
text: ServersUiController.defaultServerDescriptionCollapsed
leftImageSource: ServersUiController.defaultServerImagePathCollapsed
leftImageColor: AmneziaStyle.color.transparent
leftImageWidth: 20
leftImageHeight: 15
rightImageSource: enabled ? (root.expanded ? "qrc:/images/controls/chevron-down.svg" : "qrc:/images/controls/chevron-right.svg") : ""
onClicked: root.serverInfoRequested()
}
NotificationType {
objectName: "outdatedContainerWarning"
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.bottomMargin: 16
visible: root.outdatedWarningVisible
variant: NotificationType.Warning
text: qsTr("AmneziaWG 2.0 is outdated and no longer supported. Continued use requires a fresh installation of the AmneziaWG 3.1 container.")
}
HomeInfoButton {
objectName: "protocolButton"
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
Layout.alignment: Qt.AlignHCenter
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.bottomMargin: 16
visible: root.protocolSelectionVisible
enabled: root.protocolSelectable
largeText: true
text: root.protocolText
leftImageSource: "qrc:/images/controls/arrow-left-right.svg"
leftImageColor: AmneziaStyle.color.iconSecondary
rightImageSource: enabled ? "qrc:/images/controls/chevron-down.svg" : ""
onClicked: root.protocolSelectionRequested()
}
}