Tweak frontend layout and style

This commit is contained in:
2023-11-06 21:27:27 +01:00
parent d5a221e1a3
commit 924a14cdcb
2 changed files with 44 additions and 33 deletions

View File

@ -3,7 +3,7 @@ use crate::css::C;
use chrono::{NaiveTime, Weekday};
use common::{BulbGroup, BulbGroupShape, BulbMap, ClientMessage, ServerMessage};
use lighter_lib::{BulbId, BulbMode};
use seed::{attrs, button, div, input, C};
use seed::{attrs, button, div, h2, input, table, td, tr, C};
use seed::{prelude::*, IF};
use seed_router::Page;
use std::collections::{BTreeMap, HashMap, HashSet};
@ -235,14 +235,14 @@ impl Page for Model {
.and_then(|b| b.wake_schedule.get(&day))
.map(|t| t.to_string())
.unwrap_or_default();
div![
tr![
C![C.calendar_day],
day.to_string(),
input![
td![day.to_string()],
td![input![
C![C.calendar_time_input],
attrs! {At::Placeholder => time},
input_ev(Ev::Input, move |input| Msg::LightTime(input, day))
],
]],
]
};
@ -251,14 +251,14 @@ impl Page for Model {
div![
C![C.bulb_map],
attrs! {
At::Style => format!("width: {}rem; height: {}rem;", bulb_map_width, bulb_map_height),
At::Style => format!("min-width: {}rem; height: {}rem;", bulb_map_width, bulb_map_height),
},
ev(Ev::Click, |_| Msg::DeselectGroups),
self.bulb_map.groups.iter().enumerate().map(view_bulb_group),
],
div![
C![C.bulb_controls],
IF!(selected_bulb.is_none() => C![C.bulb_controls_disable]),
IF!(selected_bulb.is_none() => C![C.cross_out]),
self.color_picker.view().map_msg(Msg::ColorPicker),
button![
if selected_bulb.map(|b| b.mode.power).unwrap_or(false) {
@ -279,13 +279,17 @@ impl Page for Model {
],
div![
C![C.calendar_box],
calendar_day(Weekday::Mon),
calendar_day(Weekday::Tue),
calendar_day(Weekday::Wed),
calendar_day(Weekday::Thu),
calendar_day(Weekday::Fri),
calendar_day(Weekday::Sat),
calendar_day(Weekday::Sun),
IF!(selected_bulb.is_none() => C![C.cross_out]),
h2!["Wake Schedule"],
table![
calendar_day(Weekday::Mon),
calendar_day(Weekday::Tue),
calendar_day(Weekday::Wed),
calendar_day(Weekday::Thu),
calendar_day(Weekday::Fri),
calendar_day(Weekday::Sat),
calendar_day(Weekday::Sun),
],
],
]
}