feat: wire Injection Viewer + KG into BrainBar UI#163
Conversation
…inks - Updated tool count from 7 to 11 (added brain_ack, brain_expand, brain_tags, brain_update) - Added BrainBar section showcasing native macOS companion app: Cmd+K search, dashboard, knowledge graph viewer, injection viewer - Updated footer with Golems ecosystem links (cmuxLayer, VoiceLayer) - Added responsive breakpoint for BrainBar grid Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…over tabs Adds a 3-tab segmented control (Dashboard / Injections / Graph) to StatusPopoverView so users can actually access the InjectionFeedView and KGCanvasView that were merged in PRs #158 and #159 but had no navigation entry point. - PopoverTab enum drives labels, sizes, and tab state - Tabs without dependencies (injectionStore/database) are auto-disabled - Popover resizes per tab via onPreferredSizeChange callback - 13 new tests in PopoverTabTests covering enum, segmented control, tab switching, and backward compatibility Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughIntroduces a tabbed popover UI to BrainBar with three tabs (dashboard, injections, graph), each with distinct content and sizing. Implements dynamic popover resizing based on selected tab, adds optional Changes
Sequence DiagramsequenceDiagram
participant User
participant SegmentedControl as UI: Segmented<br/>Control
participant StatusPV as StatusPopoverView
participant ContentBuilder as Content Builders
participant BrainBarApp
User->>SegmentedControl: Select tab (e.g., Injections)
SegmentedControl->>StatusPV: tabChanged(_:)
activate StatusPV
alt Dependencies available
StatusPV->>ContentBuilder: makeInjectionContent()
ContentBuilder->>ContentBuilder: Create NSHostingController<br/>with PopoverInjectionTab
ContentBuilder-->>StatusPV: Return content view
else Dependencies missing
StatusPV->>ContentBuilder: makePlaceholder(_:)
ContentBuilder-->>StatusPV: Return unavailable message
end
StatusPV->>StatusPV: Remove old subviews<br/>Add new content to containerView
StatusPV->>StatusPV: Update preferredContentSize<br/>to PopoverTab.contentSize
StatusPV->>StatusPV: Call onPreferredSizeChange
deactivate StatusPV
StatusPV->>BrainBarApp: onPreferredSizeChange callback
BrainBarApp->>BrainBarApp: Update popover?.contentSize
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| func showTab(_ tab: PopoverTab) { | ||
| containerView.subviews.forEach { $0.removeFromSuperview() } | ||
| currentTab = tab |
There was a problem hiding this comment.
🟡 Medium Dashboard/StatusPopoverView.swift:98
When showTab(_:) is called programmatically, it updates currentTab and swaps the container content, but it never updates segmentedControl.selectedSegment. The segmented control continues to highlight the previous tab while displaying content for the new tab, leaving the UI in an inconsistent state. Consider setting segmentedControl.selectedSegment = tab.rawValue at the start of showTab(_:) to keep the control synchronized with the displayed content.
func showTab(_ tab: PopoverTab) {
+ segmentedControl.selectedSegment = tab.rawValue
containerView.subviews.forEach { $0.removeFromSuperview() }
currentTab = tab🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file brain-bar/Sources/BrainBar/Dashboard/StatusPopoverView.swift around lines 98-100:
When `showTab(_:)` is called programmatically, it updates `currentTab` and swaps the container content, but it never updates `segmentedControl.selectedSegment`. The segmented control continues to highlight the previous tab while displaying content for the new tab, leaving the UI in an inconsistent state. Consider setting `segmentedControl.selectedSegment = tab.rawValue` at the start of `showTab(_:)` to keep the control synchronized with the displayed content.
Evidence trail:
brain-bar/Sources/BrainBar/Dashboard/StatusPopoverView.swift lines 98-123 (showTab method does not update segmentedControl.selectedSegment), lines 127-144 (configureSegmentedControl sets initial segment), lines 145-148 (tabChanged action calls showTab). brain-bar/Tests/BrainBarTests/PopoverTabTests.swift lines 151, 154, 157, 177 (tests call showTab programmatically).
Summary
InjectionFeedView(PR Phase 4: BrainBar injection viewer #158) andKGCanvasView(PR feat: BrainBar Knowledge Graph viewer #159) into navigable tabs — previously these views existed but had zero entry pointsPopoverTabTestsFiles Changed
StatusPopoverView.swiftPopoverTabenum, segmented control, lazy SwiftUI hosting for injection/graph tabsBrainBarApp.swiftinjectionStore+sharedDatabaseto popover, wires resize callbackPopoverTabTests.swiftTest plan
swift test --package-path brain-bar— 225/225 passbuild-app.sh— builds and installs to/Applications/BrainBar.app@coderabbitai review
🤖 Generated with Claude Code
Note
Add tabbed Injection Viewer and Knowledge Graph to BrainBar popover UI
PopoverTabenum with three cases (dashboard,injections,graph), each defining a label and preferredNSPopovercontent size.StatusPopoverViewwith a segmented control for tab navigation; tabs are disabled when their dependencies (InjectionStore,BrainDatabase) are absent.onPreferredSizeChangecallback wired inBrainBarApp.swift.PopoverInjectionTab(wrapsInjectionFeedView, callsstore.start()on open) andPopoverGraphTab(rendersKGCanvasViewviaKGViewModel).📊 Macroscope summarized 100d3e4. 4 files reviewed, 3 issues evaluated, 0 issues filtered, 1 comment posted
🗂️ Filtered Issues
Summary by CodeRabbit
New Features
Tests