// CORRECT - Using .when() with FluentBuilder
use gpui::prelude::FluentBuilder;
div().when(condition, |this| {
this.child(content)
})
// CORRECT - Using .children() with Option
.children(if condition { Some(element) } else { None })
// INCORRECT - Don't use .child(Option<...>)
.child(if condition { Some(element) } else { None }) // WRONG// CORRECT - InputState creation
let state = cx.new(|cx| InputState::new(window, cx));
// Use with Input component
Input::new(&state)
.placeholder("Search...")
.on_text_change(cx.listener(|this, text, window, cx| {
this.query = text.to_string();
}))Button::new("btn")
.label("Search")
.primary()
.when(loading, |this| this.disabled())
.on_click(cx.listener(|this, event, window, cx| {
// Handle click
}))// Open article modal
window.open_dialog(cx, |dialog, _, cx| {
dialog
.title(document.title)
.child(render_document_content(document))
.on_close(cx.listener(|this, _, window, cx| {
// Handle close
}))
})Issue: Missing FluentBuilder import, invalid conditional patterns
Fix:
- Add
use gpui::prelude::FluentBuilder; - Replace
.child(Option<...>)with.when()or.children() - Add proper InputState usage
Issue: "Add to Context" button rendering, result list styling Fix:
- Use Button::new() with proper styling
- Use .when() for conditional states
- Proper list rendering with .children()
Issue: Autocomplete dropdown rendering, keyboard navigation Fix:
- Use FluentBuilder patterns
- Proper conditional rendering
- Event handling for selection
Issue: Main view composition Fix:
- Ensure all sub-components compile
- Proper layout with div() and gap/padding methods
Feature: Port term chip UI from desktop
// Desktop has:
// - Term chips with KG indicator (📚)
// - AND/OR operator visualization
// - Click to remove functionality
//
// Need: GPUI equivalent with proper styling- Add KG icon (📚) next to KG terms in results
- Show term chips from parsed query
- Visual feedback for selections
- Already implemented in app.rs
- Should work once search results compile
- Test: Click "Add to Context" → navigates to Chat → appears in context
advanced_virtualization.rs- Advanced performance featurememory_optimizer.rs- Memory managementrender_optimizer.rs- Render performanceperformance_*.rs- Benchmarking code
kg_search_modal.rs- Separate KG search modalknowledge_graph.rs- Complex KG visualizationsearch_performance.rs- Performance metrics
After fixing Priority 1 files:
# Should compile successfully
cargo check -p terraphim_desktop_gpui --lib
# Run the app
cargo run --bin terraphim-gpuiExpected behavior:
- ✅ App launches without crashes
- ✅ Role selector shows dropdown with icons
- ✅ Can type in search input
- ✅ Autocomplete dropdown appears with suggestions
- ✅ Search executes and shows results
- ✅ "Add to Context" button appears on results
- ✅ Clicking "Add to Context" navigates to Chat
- ✅ Document appears in chat context
- ✅ Can chat with context
- 30 minutes: Fix
FluentBuilderimports in all search view files - 1 hour: Fix conditional rendering patterns (.when vs .child)
- 1 hour: Fix Input/Button component usage
- 30 minutes: Verify compilation
- 1 hour: Add term chips UI (port from desktop)
- 30 minutes: Test complete workflow
- 30 minutes: Polish and bug fixes
Total: ~4 hours for working demo