diff --git a/backend/src/web/mod.rs b/backend/src/web/mod.rs index 1befeca..a97e840 100644 --- a/backend/src/web/mod.rs +++ b/backend/src/web/mod.rs @@ -38,13 +38,29 @@ pub async fn app(state: AppState) -> eyre::Result { #[derive(Debug, Clone, Serialize)] pub struct Device { pub id: String, + pub mode: Mode, + pub color: String, +} + +#[derive(Debug, Clone, Serialize)] +pub enum Mode { + #[serde(rename = "off")] + Off, + #[serde(rename = "color")] + Color, + #[serde(rename = "sun")] + Sun, } async fn get_devices(state: State) -> Json> { let devices = state.registered_devices.read().await; let devices = devices .iter() - .map(|(id, _)| Device { id: id.clone() }) + .map(|(id, _)| Device { + id: id.clone(), + mode: Mode::Off, + color: "#ffffffcc".to_string(), + }) .collect(); Json(devices) diff --git a/frontend/src/components/ColorSelect.vue b/frontend/src/components/ColorSelect.vue new file mode 100644 index 0000000..f27673e --- /dev/null +++ b/frontend/src/components/ColorSelect.vue @@ -0,0 +1,96 @@ + + + diff --git a/frontend/src/components/DeviceEntry.vue b/frontend/src/components/DeviceEntry.vue index 414d531..8531190 100644 --- a/frontend/src/components/DeviceEntry.vue +++ b/frontend/src/components/DeviceEntry.vue @@ -1,11 +1,45 @@ diff --git a/frontend/src/types/device.ts b/frontend/src/types/device.ts index 3813aee..975ade6 100644 --- a/frontend/src/types/device.ts +++ b/frontend/src/types/device.ts @@ -1,3 +1,5 @@ export type Device = { id: string; + mode: string; + color: string; };