aboutsummaryrefslogtreecommitdiff
path: root/components/root/main.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 /components/root/main.go
parent18b897a36805d1acb6e2352ca536c1eee9249fe3 (diff)
downloadnectar-9e82811a2a963be962fc3ffc426c137e01d56e2d.tar.xz
nectar-9e82811a2a963be962fc3ffc426c137e01d56e2d.zip
Restructure codebase with proper organization, fix file picker navigation, and add utils packageHEADmain
Diffstat (limited to 'components/root/main.go')
-rw-r--r--components/root/main.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/components/root/main.go b/components/root/main.go
new file mode 100644
index 0000000..e88a647
--- /dev/null
+++ b/components/root/main.go
@@ -0,0 +1,41 @@
+package root
+
+import (
+ "nectar/types"
+
+ tea "github.com/charmbracelet/bubbletea"
+ "github.com/charmbracelet/lipgloss"
+)
+
+type MainAreaModel struct {
+ connectionForm ConnectionFormModel
+}
+
+func NewMainArea() MainAreaModel {
+ return MainAreaModel{
+ connectionForm: NewConnectionForm(),
+ }
+}
+
+func (m MainAreaModel) Init() tea.Cmd {
+ return m.connectionForm.Init()
+}
+
+func (m MainAreaModel) Update(msg tea.Msg) (MainAreaModel, tea.Cmd) {
+ var cmd tea.Cmd
+ formModel, cmd := m.connectionForm.Update(msg)
+ m.connectionForm = formModel.(ConnectionFormModel)
+ return m, cmd
+}
+
+func MainArea(globals *types.Globals, mainArea MainAreaModel) string {
+ formContent := mainArea.connectionForm.View()
+
+ return lipgloss.Place(
+ globals.Width-30,
+ globals.Height-1,
+ lipgloss.Center,
+ lipgloss.Center,
+ formContent,
+ )
+}