Fully Automated - 100% Backpressure - Pipeline runner ๐Ÿƒ for AI workflows. ๐Ÿš€

Commit 3ebc9c34

3ebc9c344bfeMerged

Scott Nixon <[email protected]> ยท 9 months ago ยท 1 file ยท ~1 modified

Description

[attractor-uuw] Refactor MainLayout into ProjectView component

  • Renamed MainLayout to ProjectView
  • Added Project prop to accept project context
  • Extracted project_id, folder, project_name, container_id from project
  • Updated Terminal to receive folder and container_id props
  • Updated DocumentViewer to receive project_id prop
  • Updated ApprovalBar to use dynamic project_id instead of hardcoded value
  • Updated header to display project name
  • Supports multiple simultaneous ProjectView instances with independent state

Details

Commit
3ebc9c344bfe
Parent
705cd1de995c

crates/attractor-web/src/components/layout.rsmodifiedView file

@@ -4,6 +4,7 @@
44 use crate::components::document_viewer::DocumentViewer;
55 use crate::components::execution_panel::ExecutionPanel;
66 use crate::components::terminal::Terminal;
7+use crate::server::projects::Project;
78
89 /// View mode for the right panel
910 #[derive(Clone, Copy, PartialEq)]
@@ -12,9 +13,19 @@
1213 Execution,
1314 }
1415
15-/// Single-page two-column layout: Terminal (left) + Document/Execution viewer (right)
16+/// Project-scoped two-column layout: Terminal (left) + Document/Execution viewer (right)
17+/// Accepts a Project prop and renders the terminal + document panels for that project.
18+/// Multiple instances can coexist simultaneously (one per open project).
1619 #[component]
17-pub fn MainLayout() -> impl IntoView {
20+pub fn ProjectView(
21+ #[prop(into)] project: Project,
22+) -> impl IntoView {
23+ // Extract project fields for use in component
24+ let project_id = project.id;
25+ let folder = project.folder_path.clone();
26+ let project_name = project.name.clone();
27+ let container_id = format!("terminal-{}", project_id);
28+
1829 let (panel, set_panel) = signal(RightPanel::Documents);
1930 let (session_id, set_session_id) = signal(Option::<String>::None);
2031 let (prd_exists, set_prd_exists) = signal(false);
@@ -34,13 +45,13 @@
3445 view! {
3546 <div class="app-layout">
3647 <header class="app-header">
37- <h1 class="app-title">"Attractor"</h1>
48+ <h1 class="app-title">{project_name.clone()}</h1>
3849 <div class="app-header-actions">
3950 {move || match panel.get() {
4051 RightPanel::Documents => {
4152 view! {
4253 <ApprovalBar
43- project_id=1
54+ project_id=project_id
4455 enabled=can_approve
4556 on_approve=on_approve
4657 />
@@ -62,13 +73,17 @@
6273 if panel.get() == RightPanel::Documents { format!("{base} documents-mode") } else { base.to_string() }
6374 }>
6475 <div class="panel-left">
65- <Terminal />
76+ <Terminal
77+ folder=folder.clone()
78+ container_id=container_id.clone()
79+ />
6680 </div>
6781
6882 {move || match panel.get() {
6983 RightPanel::Documents => {
7084 view! {
7185 <DocumentViewer
86+ project_id=project_id
7287 on_prd_change=move |exists| set_prd_exists.set(exists)
7388 on_spec_change=move |exists| set_spec_exists.set(exists)
7489 />