aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--screens/root.go10
-rw-r--r--screens/screens.go15
-rw-r--r--screens/types.go8
3 files changed, 14 insertions, 19 deletions
diff --git a/screens/root.go b/screens/root.go
index fee061d..9774872 100644
--- a/screens/root.go
+++ b/screens/root.go
@@ -1,9 +1,10 @@
package screens
import (
- "fmt"
+ "nectar/components"
tea "github.com/charmbracelet/bubbletea"
+ "github.com/charmbracelet/lipgloss"
)
type rootScreen struct{}
@@ -30,7 +31,8 @@ func (r *rootScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
func (r *rootScreen) View() string {
- return fmt.Sprintf(`Nectar - Version: %s - Build Date: %s
-Press 'a' to go to the auxiliary screen. Press 'q' to quit.
-`, globals.version, globals.buildDate)
+ return lipgloss.JoinVertical(
+ lipgloss.Top,
+ components.RootStatusBar(&globals),
+ )
}
diff --git a/screens/screens.go b/screens/screens.go
index 5e087b8..3456693 100644
--- a/screens/screens.go
+++ b/screens/screens.go
@@ -2,6 +2,7 @@ package screens
import (
"nectar/build"
+ "nectar/types"
"os"
tea "github.com/charmbracelet/bubbletea"
@@ -16,7 +17,7 @@ type ScreenManager struct {
currentScreen tea.Model
}
-var globals Globals
+var globals types.Globals
func (sm *ScreenManager) Init() tea.Cmd {
return sm.currentScreen.Init()
@@ -25,7 +26,7 @@ func (sm *ScreenManager) Init() tea.Cmd {
func (sm *ScreenManager) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch m := msg.(type) {
case tea.WindowSizeMsg:
- globals.width, globals.height = m.Width, m.Height
+ globals.Width, globals.Height = m.Width, m.Height
return sm, nil
case SwitchMsg:
sm.currentScreen = m.Screen
@@ -54,11 +55,11 @@ func Start() tea.Model {
height = 24
}
- globals = Globals{
- width: width,
- height: height,
- buildDate: build.Date,
- version: build.Version,
+ globals = types.Globals{
+ Width: width,
+ Height: height,
+ BuildDate: build.Date,
+ Version: build.Version,
}
return &ScreenManager{currentScreen: _root()}
diff --git a/screens/types.go b/screens/types.go
deleted file mode 100644
index 99541c4..0000000
--- a/screens/types.go
+++ /dev/null
@@ -1,8 +0,0 @@
-package screens
-
-type Globals struct {
- width int
- height int
- buildDate string
- version string
-}