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:
2026-06-19 00:12:42 +02:00
parent 21c08911df
commit 26ebfad3a2
175 changed files with 12338 additions and 801 deletions

View File

@@ -8,10 +8,20 @@ pub struct BoundingBox {
impl BoundingBox {
pub fn new(x: u16, y: u16, width: u16, height: u16) -> Self {
Self { x, y, width, height }
Self {
x,
y,
width,
height,
}
}
pub fn screen(width: u16, height: u16) -> Self {
Self { x: 0, y: 0, width, height }
Self {
x: 0,
y: 0,
width,
height,
}
}
}

View File

@@ -1,6 +1,6 @@
use std::collections::HashMap;
use domain::{LayoutNode, ContainerNode, Direction, Sizing};
use crate::{BoundingBox, RenderTree};
use domain::{ContainerNode, Direction, LayoutNode, Sizing};
use std::collections::HashMap;
pub struct LayoutEngine;
@@ -11,11 +11,7 @@ impl LayoutEngine {
RenderTree { widget_bounds }
}
fn compute_node(
node: &LayoutNode,
bounds: BoundingBox,
out: &mut HashMap<u16, BoundingBox>,
) {
fn compute_node(node: &LayoutNode, bounds: BoundingBox, out: &mut HashMap<u16, BoundingBox>) {
match node {
LayoutNode::Leaf(id) => {
out.insert(*id, bounds);
@@ -48,16 +44,22 @@ impl LayoutEngine {
let total_gap = container.gap as u16 * (children.len() as u16).saturating_sub(1);
let available = total_axis.saturating_sub(total_gap);
let fixed_total: u16 = children.iter().map(|c| match c.sizing {
Sizing::Fixed(px) => px,
Sizing::Flex(_) => 0,
}).sum();
let fixed_total: u16 = children
.iter()
.map(|c| match c.sizing {
Sizing::Fixed(px) => px,
Sizing::Flex(_) => 0,
})
.sum();
let flex_space = available.saturating_sub(fixed_total);
let flex_total: u16 = children.iter().map(|c| match c.sizing {
Sizing::Flex(w) => w as u16,
Sizing::Fixed(_) => 0,
}).sum();
let flex_total: u16 = children
.iter()
.map(|c| match c.sizing {
Sizing::Flex(w) => w as u16,
Sizing::Fixed(_) => 0,
})
.sum();
let mut offset = 0u16;
@@ -74,19 +76,9 @@ impl LayoutEngine {
};
let child_bounds = if is_row {
BoundingBox::new(
inner.x + offset,
inner.y,
child_size,
inner.height,
)
BoundingBox::new(inner.x + offset, inner.y, child_size, inner.height)
} else {
BoundingBox::new(
inner.x,
inner.y + offset,
inner.width,
child_size,
)
BoundingBox::new(inner.x, inner.y + offset, inner.width, child_size)
};
Self::compute_node(&child.node, child_bounds, out);

View File

@@ -1,9 +1,9 @@
mod bounding_box;
mod layout_engine;
mod render_tree;
pub mod ports;
mod render_tree;
pub use bounding_box::BoundingBox;
pub use layout_engine::LayoutEngine;
pub use ports::{ClientConfig, DisplayPort, NetworkPort, StoragePort};
pub use render_tree::RenderTree;
pub use ports::{DisplayPort, NetworkPort, StoragePort, ClientConfig};

View File

@@ -4,7 +4,13 @@ pub trait DisplayPort {
type Error;
fn clear_region(&mut self, bounds: BoundingBox) -> Result<(), Self::Error>;
fn draw_text(&mut self, text: &str, x: u16, y: u16, bounds: BoundingBox) -> Result<(), Self::Error>;
fn draw_text(
&mut self,
text: &str,
x: u16,
y: u16,
bounds: BoundingBox,
) -> Result<(), Self::Error>;
fn draw_icon(&mut self, icon: &str, x: u16, y: u16) -> Result<(), Self::Error>;
fn fill_background(&mut self, bounds: BoundingBox) -> Result<(), Self::Error>;
fn flush(&mut self) -> Result<(), Self::Error>;

View File

@@ -4,4 +4,4 @@ mod storage;
pub use display::DisplayPort;
pub use network::NetworkPort;
pub use storage::{StoragePort, ClientConfig};
pub use storage::{ClientConfig, StoragePort};

View File

@@ -1,6 +1,6 @@
use std::collections::HashMap;
use domain::WidgetId;
use crate::BoundingBox;
use domain::WidgetId;
use std::collections::HashMap;
pub struct RenderTree {
pub widget_bounds: HashMap<WidgetId, BoundingBox>,