aboutsummaryrefslogtreecommitdiff
path: root/screens/root.go
diff options
context:
space:
mode:
authorPriyansh <[email protected]>2025-08-28 13:09:22 +0530
committerPriyansh <[email protected]>2025-08-28 13:09:22 +0530
commit9e82811a2a963be962fc3ffc426c137e01d56e2d (patch)
tree9cde1691f6e8dafb7204b7247dea12af0aa22bf6 /screens/root.go
parent18b897a36805d1acb6e2352ca536c1eee9249fe3 (diff)
downloadnectar-main.tar.xz
nectar-main.zip
Restructure codebase with proper organization, fix file picker navigation, and add utils packageHEADmain
Diffstat (limited to 'screens/root.go')
-rw-r--r--screens/root.go28
1 files changed, 20 insertions, 8 deletions
diff --git a/screens/root.go b/screens/root.go
index 9774872..590c4db 100644
--- a/screens/root.go
+++ b/screens/root.go
@@ -1,38 +1,50 @@
package screens
import (
- "nectar/components"
+ "nectar/components/root"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
)
-type rootScreen struct{}
+type rootScreen struct {
+ mainArea root.MainAreaModel
+}
func _root() tea.Model {
- return &rootScreen{}
+ return &rootScreen{
+ mainArea: root.NewMainArea(),
+ }
}
func (r *rootScreen) Init() tea.Cmd {
- return nil
+ return r.mainArea.Init()
}
func (r *rootScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
+ case tea.WindowSizeMsg:
+ globals.Width, globals.Height = msg.Width, msg.Height
case tea.KeyMsg:
switch msg.String() {
case "ctrl+c", "q":
return r, tea.Quit
- case "a":
- return r, switchScreen(_aux())
}
}
- return r, nil
+
+ var cmd tea.Cmd
+ r.mainArea, cmd = r.mainArea.Update(msg)
+ return r, cmd
}
func (r *rootScreen) View() string {
return lipgloss.JoinVertical(
lipgloss.Top,
- components.RootStatusBar(&globals),
+ lipgloss.JoinHorizontal(
+ lipgloss.Left,
+ root.Sidebar(&globals),
+ root.MainArea(&globals, r.mainArea),
+ ),
+ root.StatusBar(&globals),
)
}