diff options
| author | ewy <ewy0@protonmail.com> | 2026-04-29 00:47:34 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-04-29 00:47:34 +0200 |
| commit | 630d77e1962b43ee95e88a664f5e8b8993213060 (patch) | |
| tree | 8849c2a87443cd231786aed53b76dc7e4ea11aed /menu/state.go | |
| parent | 8efcf029576ad82908b4ae80b2c92022dfb857d2 (diff) | |
big stuff
* send empty screen after tui confirmation
* add scroll view / viewport
* auto enable scroll view on short terminals
* add motd tips
* add subdirs as categories
* add inline toggle hotkey (i)
Diffstat (limited to 'menu/state.go')
| -rw-r--r-- | menu/state.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/menu/state.go b/menu/state.go new file mode 100644 index 0000000..16702a2 --- /dev/null +++ b/menu/state.go @@ -0,0 +1,29 @@ +package menu + +import ( + "github.com/charmbracelet/lipgloss" + "pik/menu/style" +) + +var ( + StateStyle = style.New(func() lipgloss.Style { + return lipgloss.NewStyle().MarginBottom(1) + }) + MotdStyle = style.New(func() lipgloss.Style { + return lipgloss.NewStyle().Faint(true).PaddingLeft(1) + }) +) + +func (m *Model) State() string { + st := m.HydratedState + sources := make([]string, 0, len(st.Sources)) + for i, hs := range st.HydratedSources { + src := m.Source(hs) + if i != len(st.HydratedSources)-1 { + src += "\n" + } + sources = append(sources, src) + } + + return StateStyle.Render(lipgloss.JoinVertical(lipgloss.Top, sources...), MotdStyle.Render("\n \U000F08B7 "+m.Motd)) +} |
