diff options
| author | Priyansh <[email protected]> | 2025-08-28 13:09:22 +0530 |
|---|---|---|
| committer | Priyansh <[email protected]> | 2025-08-28 13:09:22 +0530 |
| commit | 9e82811a2a963be962fc3ffc426c137e01d56e2d (patch) | |
| tree | 9cde1691f6e8dafb7204b7247dea12af0aa22bf6 /screens | |
| parent | 18b897a36805d1acb6e2352ca536c1eee9249fe3 (diff) | |
| download | nectar-9e82811a2a963be962fc3ffc426c137e01d56e2d.tar.xz nectar-9e82811a2a963be962fc3ffc426c137e01d56e2d.zip | |
Restructure codebase with proper organization, fix file picker navigation, and add utils packageHEADmain
Diffstat (limited to 'screens')
| -rw-r--r-- | screens/root.go | 28 |
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), ) } |
