1786095613
This commit is contained in:
@@ -18,11 +18,7 @@ export struct LightData {
|
||||
|
||||
component LightSwitch inherits Horizontal {
|
||||
in property <LightData> light;
|
||||
callback toggled(string);
|
||||
|
||||
TouchArea {
|
||||
clicked => { if root.light.available { root.toggled(root.light.entity_id); } }
|
||||
}
|
||||
callback toggled(LightData, bool);
|
||||
|
||||
alignment: end;
|
||||
label := Text {
|
||||
@@ -33,8 +29,9 @@ component LightSwitch inherits Horizontal {
|
||||
font-weight: root.light.on ? 700 : 500;
|
||||
}
|
||||
switch := Switch {
|
||||
enabled: root.light.on;
|
||||
checked: root.light.available;
|
||||
enabled: root.light.available;
|
||||
checked: root.light.on;
|
||||
checked_state_changed(checked) => { root.toggled(root.light, checked) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,15 +45,13 @@ export component MainWindow inherits Window {
|
||||
default-font-family: "Roboto";
|
||||
|
||||
in property <[LightData]> lights;
|
||||
callback toggle-light(string);
|
||||
callback toggle-light(LightData, bool);
|
||||
|
||||
in-out property <int> current-page: 0;
|
||||
in property <string> next-event-label: "NEXT EVENT";
|
||||
in property <string> next-event-title: "LOADING CALENDAR";
|
||||
in property <string> next-event-time: "6:00 pm";
|
||||
|
||||
callback user-activity();
|
||||
|
||||
Rectangle {
|
||||
x: 0;
|
||||
y: 0;
|
||||
@@ -78,7 +73,7 @@ export component MainWindow inherits Window {
|
||||
y: 5px;
|
||||
width: parent.width - 78px;
|
||||
height: 78px;
|
||||
clicked => { root.user-activity(); root.current-page = 2; }
|
||||
clicked => { root.current-page = 2; }
|
||||
}
|
||||
|
||||
Text {
|
||||
@@ -136,7 +131,7 @@ export component MainWindow inherits Window {
|
||||
|
||||
for light_data in root.lights: LightSwitch {
|
||||
light: light_data;
|
||||
toggled(entity_id) => { root.user-activity(); root.toggle-light(entity_id); }
|
||||
toggled(light, checked) => { root.toggle-light(light, checked); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user