summaryrefslogtreecommitdiffhomepage
path: root/internal/tui/layout
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-05-06 14:22:37 -0500
committeradamdottv <[email protected]>2025-05-06 14:22:37 -0500
commitb638dafe5fb2b6fcdd6d9b64502a7808f3e81eb5 (patch)
tree6f6729fcc08a042812b642ef6acb8fc4d9db9b9b /internal/tui/layout
parente387b1f16c2a7630c7f2ea29b39d4f50b1760ad7 (diff)
downloadopencode-b638dafe5fb2b6fcdd6d9b64502a7808f3e81eb5.tar.gz
opencode-b638dafe5fb2b6fcdd6d9b64502a7808f3e81eb5.zip
feat: better logs page
Diffstat (limited to 'internal/tui/layout')
-rw-r--r--internal/tui/layout/container.go30
1 files changed, 29 insertions, 1 deletions
diff --git a/internal/tui/layout/container.go b/internal/tui/layout/container.go
index 83aef5879..75c0fe110 100644
--- a/internal/tui/layout/container.go
+++ b/internal/tui/layout/container.go
@@ -11,6 +11,8 @@ type Container interface {
tea.Model
Sizeable
Bindings
+ Focus() // Add focus method
+ Blur() // Add blur method
}
type container struct {
width int
@@ -29,6 +31,8 @@ type container struct {
borderBottom bool
borderLeft bool
borderStyle lipgloss.Border
+
+ focused bool // Track focus state
}
func (c *container) Init() tea.Cmd {
@@ -65,7 +69,13 @@ func (c *container) View() string {
width--
}
style = style.Border(c.borderStyle, c.borderTop, c.borderRight, c.borderBottom, c.borderLeft)
- style = style.BorderBackground(t.Background()).BorderForeground(t.BorderNormal())
+
+ // Use primary color for border if focused
+ if c.focused {
+ style = style.BorderBackground(t.Background()).BorderForeground(t.Primary())
+ } else {
+ style = style.BorderBackground(t.Background()).BorderForeground(t.BorderNormal())
+ }
}
style = style.
Width(width).
@@ -121,6 +131,24 @@ func (c *container) BindingKeys() []key.Binding {
return []key.Binding{}
}
+// Focus sets the container as focused
+func (c *container) Focus() {
+ c.focused = true
+ // Pass focus to content if it supports it
+ if focusable, ok := c.content.(interface{ Focus() }); ok {
+ focusable.Focus()
+ }
+}
+
+// Blur removes focus from the container
+func (c *container) Blur() {
+ c.focused = false
+ // Remove focus from content if it supports it
+ if blurable, ok := c.content.(interface{ Blur() }); ok {
+ blurable.Blur()
+ }
+}
+
type ContainerOption func(*container)
func NewContainer(content tea.Model, options ...ContainerOption) Container {