import QtQuick import Quickshell import qs.Common import qs.Widgets Item { id: widget property var service: null readonly property var selected: { const stored = (service && service.pluginData) ? service.pluginData.haEntities : null; return Array.isArray(stored) ? stored : []; } readonly property bool configured: service ? service.configured : false Component.onCompleted: { if (service) service.addConsumer(); } Component.onDestruction: { if (service) service.removeConsumer(); } DankFlickable { id: list anchors.fill: parent visible: widget.configured && widget.selected.length > 0 clip: true contentHeight: entityColumn.height contentWidth: width Column { id: entityColumn width: list.width spacing: Theme.spacingXS Repeater { model: widget.selected delegate: HomeRow { required property var modelData width: entityColumn.width service: widget.service entityId: modelData } } } } Column { anchors.centerIn: parent width: parent.width - Theme.spacingL spacing: Theme.spacingS visible: !list.visible DankIcon { anchors.horizontalCenter: parent.horizontalCenter name: widget.configured ? "playlist_add" : "home" size: Theme.iconSizeLarge color: Theme.surfaceVariantText } StyledText { width: parent.width horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap text: widget.configured ? "No entities picked yet.\nChoose them in Settings > Plugins > Game Bar." : "Home Assistant is not set up.\nAdd your URL and token in Settings > Plugins > Game Bar." font.pixelSize: Theme.fontSizeSmall color: Theme.surfaceVariantText } } StyledText { anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right text: widget.service ? widget.service.lastError : "" font.pixelSize: Theme.fontSizeSmall color: Theme.error elide: Text.ElideRight visible: text !== "" } }