+
+ // SVG for connections
+
+
+ // Render blocks
+ { for (*blocks).iter().map(|b| {
+ let block_id = b.id;
+ let style = format!("position:absolute; left:{}px; top:{}px;", b.position.0, b.position.1);
+ let from_id = block_id;
+ let to_id = block_id;
+ let delete_mode = *delete_mode;
+ let delete_block = delete_block.clone();
+
+ let is_target = matches!(b.block_type, BlockType::Target);
+ let is_input = !is_target && matches!(b.block_type, BlockType::InputM3u | BlockType::InputXtream);
+ let is_output = !is_input && !is_target;
+
+ let port_status = if let Some(from_id) = *pending_connection {
+ if let Some(from_block) = (*blocks).iter().find(|b| b.id == from_id) {
+ if can_connect(from_block, b, &connections, &blocks) {
+ PORT_VALID
+ } else {
+ PORT_INVALID
+ }
+ } else {
+ PORT_INACTIVE
+ }
+ } else {
+ PORT_INACTIVE
+ };
+
+ let port_style = match port_status {
+ PORT_VALID => "tp__source-editor__port--valid",
+ PORT_INVALID => "tp__source-editor__port--invalid",
+ _ => "",
+ };
+
+ html! {
+
+ }
+ }) }
+