From 630d77e1962b43ee95e88a664f5e8b8993213060 Mon Sep 17 00:00:00 2001 From: ewy Date: Wed, 29 Apr 2026 00:47:34 +0200 Subject: 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) --- menu/state.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 menu/state.go (limited to 'menu/state.go') 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)) +} -- cgit v1.3.1