import QtQuick
import Quickshell
import Quickshell.Wayland
import "../../config" as Cfg

PanelWindow {
    required property var modelData
    screen: modelData
    color: "transparent"

    anchors { top: true; bottom: true; left: true; right: true }

    WlrLayershell.layer:         WlrLayer.Background
    WlrLayershell.exclusiveZone: -1
    mask: Region {}

    property string dateString: ""

    function updateDate() {
        let d = new Date();
        dateString = d.toLocaleDateString(Qt.locale(), "dddd, d MMMM yyyy"); 
    }

    Component.onCompleted: updateDate()

    Text {
        id: dateText
        anchors.centerIn: parent
        color:      Cfg.Config.theme.clockText
        styleColor: Cfg.Config.theme.clockShadow
        font.pixelSize: 64
        font.weight: Font.ExtraLight
        font.letterSpacing: 4
        opacity: 0.55
        style: Text.DropShadow
        text: dateString
    }

    Timer {
        interval: 60000 
        running: true
        repeat: true
        onTriggered: updateDate()
    }
}
