add SPA config UI, wire media/rss adapters, event-driven layout push
- React SPA: dashboard, data sources CRUD, widgets CRUD, layout builder, presets. TanStack Router + Query, shadcn/ui, Vite proxy to :3000 - wire media + rss adapters into polling loop, remove xtb source type - media adapter: read username/password from headers, proper subsonic auth - event handler: subscribe to LayoutChanged, push screen update to clients - fix clippy warnings across workspace (Default impls, collapsible ifs, redundant closures, is_none_or, unused imports)
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
use domain::LayoutNode;
|
||||
use client_domain::{BoundingBox, LayoutEngine, RenderTree};
|
||||
use protocol::{
|
||||
ServerMessage, WidgetDescriptor, WireDisplayHint, WireWidgetState, WireLayoutNode,
|
||||
};
|
||||
use domain::LayoutNode;
|
||||
use protocol::{ServerMessage, WidgetDescriptor, WireDisplayHint, WireLayoutNode, WireWidgetState};
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub struct ClientApp {
|
||||
screen: BoundingBox,
|
||||
@@ -33,9 +31,7 @@ impl ClientApp {
|
||||
ServerMessage::ScreenUpdate { layout, widgets } => {
|
||||
self.handle_screen_update(layout, widgets)
|
||||
}
|
||||
ServerMessage::DataUpdate { widgets } => {
|
||||
self.handle_data_update(widgets)
|
||||
}
|
||||
ServerMessage::DataUpdate { widgets } => self.handle_data_update(widgets),
|
||||
ServerMessage::Heartbeat => Vec::new(),
|
||||
}
|
||||
}
|
||||
@@ -50,7 +46,8 @@ impl ClientApp {
|
||||
|
||||
self.widget_states.clear();
|
||||
for w in &widgets {
|
||||
self.widget_states.insert(w.id, (w.display_hint.clone(), w.state.clone()));
|
||||
self.widget_states
|
||||
.insert(w.id, (w.display_hint.clone(), w.state.clone()));
|
||||
}
|
||||
|
||||
let repaints = self.build_repaints_for_all(&new_tree);
|
||||
@@ -58,10 +55,7 @@ impl ClientApp {
|
||||
repaints
|
||||
}
|
||||
|
||||
fn handle_data_update(
|
||||
&mut self,
|
||||
widgets: Vec<WidgetDescriptor>,
|
||||
) -> Vec<RepaintCommand> {
|
||||
fn handle_data_update(&mut self, widgets: Vec<WidgetDescriptor>) -> Vec<RepaintCommand> {
|
||||
let tree = match &self.render_tree {
|
||||
Some(t) => t,
|
||||
None => return Vec::new(),
|
||||
@@ -70,9 +64,10 @@ impl ClientApp {
|
||||
let mut repaints = Vec::new();
|
||||
|
||||
for w in widgets {
|
||||
let changed = self.widget_states
|
||||
let changed = self
|
||||
.widget_states
|
||||
.get(&w.id)
|
||||
.map_or(true, |(_, prev_state)| *prev_state != w.state);
|
||||
.is_none_or(|(_, prev_state)| *prev_state != w.state);
|
||||
|
||||
if changed {
|
||||
if let Some(bounds) = tree.get_widget_bounds(w.id) {
|
||||
|
||||
Reference in New Issue
Block a user