aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriyansh <[email protected]>2025-08-27 15:36:45 +0530
committerPriyansh <[email protected]>2025-08-27 15:36:45 +0530
commite376ebde51ed420fda418ac06d41f4fba35ef398 (patch)
tree680ab17f8c49ca0f255cc56de15a6a57759299fe
parentc0599c3ba14ebebc777025418b39038238782740 (diff)
downloadnectar-e376ebde51ed420fda418ac06d41f4fba35ef398.tar.xz
nectar-e376ebde51ed420fda418ac06d41f4fba35ef398.zip
Add components package with status bar
-rw-r--r--components/statusbar.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/components/statusbar.go b/components/statusbar.go
new file mode 100644
index 0000000..34975b0
--- /dev/null
+++ b/components/statusbar.go
@@ -0,0 +1,39 @@
+package components
+
+import (
+ "nectar/styles"
+ "nectar/types"
+
+ "github.com/charmbracelet/lipgloss"
+)
+
+func RootStatusBar(globals *types.Globals) string {
+ w := lipgloss.Width
+
+ helpText := lipgloss.JoinHorizontal(
+ lipgloss.Top,
+ styles.PaddedHorizontal.Render("↑/k: up"),
+ styles.PaddedHorizontal.Render("↓/j: down"),
+ styles.PaddedHorizontal.Render("↵: select"),
+ styles.PaddedHorizontal.Render("^n: new connection"),
+ styles.PaddedHorizontal.Render("^↵: connect"),
+ styles.PaddedHorizontal.Render("^d: delete"),
+ styles.PaddedHorizontal.Render("^c: quit"),
+ )
+
+ versionText := lipgloss.JoinHorizontal(
+ lipgloss.Top,
+ styles.PaddedHorizontal.Render("Nectar "+globals.Version+" ("+globals.BuildDate+")"),
+ )
+
+ separator := styles.BaseStyle.Width(globals.Width - w(helpText) - w(versionText)).Render("")
+
+ return styles.StatusBar.Render(
+ lipgloss.JoinHorizontal(
+ lipgloss.Top,
+ helpText,
+ separator,
+ versionText,
+ ),
+ )
+}