Commit 5f436dd2
5f436dd26080Merged
Scott Nixon <[email protected]> ยท 9 months ago ยท 5 files ยท ~5 modified
Description
Add responsive 3-column document layout for wide screens
At โฅ1800px, documents mode shows Terminal + PRD + Spec as three columns instead of a tabbed right panel. Narrow widths keep the existing tabbed UI. Fix overflow issues with min-height:0 on grid/flex children.
Details
- Commit
- 5f436dd26080
- Parent
- 2ba3277f5eb5
crates/attractor-web/src/components/document_viewer.rsmodifiedView file
@@ -1,9 +1,8 @@
11
use leptos::prelude::*;22
3+
#[allow(unused_imports)]34
use crate::components::markdown_render::render_markdown;45
5-
#[cfg(feature = "hydrate")]6-
use gloo_net::eventsource::futures::EventSource;76
#[cfg(feature = "hydrate")]87
use serde::Deserialize;98
@@ -16,15 +15,19 @@
1615
content: Option<String>,1716
}1817
19-
/// Active tab in the document viewer18+
/// Active tab in the document viewer (used in narrow/tabbed mode)2019
#[derive(Clone, Copy, PartialEq)]2120
enum DocTab {2221
Prd,2322
Spec,2423
}2524
26-
/// Tabbed document viewer that subscribes to SSE at `/api/documents/stream`25+
/// Document viewer that subscribes to SSE at `/api/documents/stream`2726
/// for live updates as Claude Code writes PRD/Spec files.27+
///28+
/// At narrow widths, PRD and Spec are shown as tabs in a single panel.29+
/// At wide widths (fullscreen), each gets its own column โ the parent30+
/// layout switches to 3-column mode via CSS.2831
#[component]2932
pub fn DocumentViewer<FP, FS>(3033
on_prd_change: FP,@@ -46,9 +49,8 @@
4649
use futures::StreamExt as _;4750
4851
let url = "/api/documents/stream";49-
match EventSource::new(url) {52+
match gloo_net::eventsource::futures::EventSource::new(url) {5053
Ok(mut es) => {51-
// Subscribe to the "document_update" event type5254
let mut stream = es.subscribe("document_update").unwrap();5355
5456
while let Some(Ok((_, msg))) = stream.next().await {@@ -67,12 +69,6 @@
6769
"spec" => {6870
set_spec_content.set(content);6971
on_spec_change(has_content);70-
// Auto-switch to spec tab when it appears71-
if has_content72-
&& active_tab.get_untracked() == DocTab::Prd73-
{74-
set_active_tab.set(DocTab::Spec);75-
}7672
}7773
_ => {}7874
}@@ -94,7 +90,8 @@
9490
let spec_html = move || render_markdown(&spec_content.get());9591
9692
view! {97-
<div class="document-viewer">93+
// Tabbed view for narrow widths โ hidden at wide breakpoint94+
<div class="document-viewer doc-tabbed">9895
<div class="doc-tabs">9996
<button10097
class=move || if active_tab.get() == DocTab::Prd { "doc-tab active" } else { "doc-tab" }@@ -145,5 +142,49 @@
145142
}}146143
</div>147144
</div>145+
146+
// PRD column โ visible only at wide breakpoint147+
<div class="doc-column doc-column-prd">148+
<div class="doc-column-header">"PRD"</div>149+
<div class="doc-content">150+
{move || {151+
let html = prd_html();152+
if html.is_empty() {153+
view! {154+
<div class="doc-placeholder">155+
<p>"No PRD yet."</p>156+
<code>"\"Create a PRD for ...\""</code>157+
</div>158+
}.into_any()159+
} else {160+
view! {161+
<div class="markdown-rendered" inner_html=html></div>162+
}.into_any()163+
}164+
}}165+
</div>166+
</div>167+
168+
// Spec column โ visible only at wide breakpoint169+
<div class="doc-column doc-column-spec">170+
<div class="doc-column-header">"Spec"</div>171+
<div class="doc-content">172+
{move || {173+
let html = spec_html();174+
if html.is_empty() {175+
view! {176+
<div class="doc-placeholder">177+
<p>"No Spec yet."</p>178+
<code>"\"Now create the technical spec\""</code>179+
</div>180+
}.into_any()181+
} else {182+
view! {183+
<div class="markdown-rendered" inner_html=html></div>184+
}.into_any()185+
}186+
}}187+
</div>188+
</div>148189
}149190
}crates/attractor-web/src/components/execution_panel.rsmodifiedView file
Loading diffโฆ
crates/attractor-web/src/components/layout.rsmodifiedView file
Loading diffโฆ
crates/attractor-web/src/components/mod.rsmodifiedView file
Loading diffโฆ
crates/attractor-web/style/main.scssmodifiedView file
Loading diffโฆ