import QtQuick
import QtQuick.Layouts
import Quickshell
import QtQuick.Controls
import Quickshell.Widgets
import Quickshell.Services.SystemTray
import "root:/DataSources"

Item {
  required property QsMenuHandle modelData

  width: parent.width
  height: 30

  Rectangle {
    anchors {
      fill: parent
      leftMargin: 5
      rightMargin: 5
    }

    color: Stylix.base01
    radius: 5

    Text {
      anchors {
        centerIn: parent
      }
      width: parent.width - 10
      horizontalAlignment: Text.AlignHCenter
      text: modelData?.text ?? ""
      color: Stylix.base05
      font.pointSize: 12
      elide: Text.ElideRight
    }

    MouseArea {
      anchors.fill: parent
      hoverEnabled: true
      acceptedButtons: Qt.LeftButton | Qt.RightButton

      onClicked: mouse => {
        modelData.triggered();
        popup.visible = false;
      }
    }
  }
}
