From 8cd0003f8cc77ef64eb17b9e923a6194a904ea90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl-Einar=20Bergstr=C3=B8m?= Date: Tue, 13 Oct 2026 12:24:10 +0200 Subject: [PATCH] feat: the key picker's tabs go under its heading, with help text The share popup is titled for what's shared; above the search, "Pick a secret to encrypt with" says the recipient needs read access to it, with Go to's tabs under it. Co-Authored-By: Claude Opus 5.5 (1M context) --- internal/ui/app/searchview.go | 37 +++++++++++++++++++++-------------- internal/ui/app/sharefiles.go | 6 ++++-- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/internal/ui/app/searchview.go b/internal/ui/app/searchview.go index 790542e..ff07ab0 100644 --- a/internal/ui/app/searchview.go +++ b/internal/ui/app/searchview.go @@ -750,12 +750,13 @@ func (m Model) searchViewBox() string { lists = panes.BoxCounted(m.st, title(resultsTitle, true), "", counter(v.res, len(v.shown)), right, resW, listH, focused) } + ts := panes.TitleStyle(m.st, focused) var body []string if v.pick != nil { for _, l := range v.pickLines { body = append(body, " "+l) } - body = append(body, "") + body = append(body, "", " "+m.goToTabs(ts)) } body = append(body, " "+v.input.View(), "") for _, l := range strings.Split(lists, "\n") { @@ -785,21 +786,11 @@ func (m Model) searchViewBox() string { } foot = footer(append(hints, hint(km.GoFilter, "filter"), hint(km.GoStar, "star"), hint(km.GoSelect, v.selectLabel()), hint(km.GoClose, "close"))...) } - // Tabs in the title, the current one underlined, like the panes. - ts := panes.TitleStyle(m.st, focused) - head := ts.Render(goToTitle + " ") + // Tabs in the title, the current one underlined, like the panes; a + // picker has its own title, and the tabs over the input. + head := ts.Render(goToTitle+" ") + m.goToTabs(ts) if v.pick != nil { - head = ts.Render(v.pickTitle + " ") - } - for i, name := range tabNames { - if i > 0 { - head += ts.Render(" - ") - } - if i == v.tab { - head += ts.Underline(true).Render(name) - } else { - head += m.st.Muted.Render(name) - } + head = ts.Render(v.pickTitle) } return panes.Box(m.st, head, foot, body, w, len(body)+2, focused) } @@ -821,3 +812,19 @@ func pickable(o option) (ref.Ref, bool) { } return r, true } + +// goToTabs draws Go to's tabs, the current one underlined. +func (m Model) goToTabs(ts lipgloss.Style) string { + var out string + for i, name := range tabNames { + if i > 0 { + out += ts.Render(" - ") + } + if i == m.search.tab { + out += ts.Underline(true).Render(name) + } else { + out += m.st.Muted.Render(name) + } + } + return out +} diff --git a/internal/ui/app/sharefiles.go b/internal/ui/app/sharefiles.go index 13d3f3b..10e6212 100644 --- a/internal/ui/app/sharefiles.go +++ b/internal/ui/app/sharefiles.go @@ -15,6 +15,7 @@ import ( "git.kebcloud.no/keb/lazysecrets/internal/provider" "git.kebcloud.no/keb/lazysecrets/internal/ref" "git.kebcloud.no/keb/lazysecrets/internal/share" + "git.kebcloud.no/keb/lazysecrets/internal/ui/panes" ) // Sharing env files as an encrypted lazysecrets://share link (package @@ -146,8 +147,9 @@ func (m *Model) pickShareKey(s sharing) tea.Cmd { } m.search.pickTitle = shareTitle(s) m.search.pickLines = append(m.sharedFiles(s), "", - "Pick the secret to encrypt them with: whoever can read it can open the link.", - m.st.Muted.Render("Its value isn't shown or put in the link. share.key sets a default.")) + panes.TitleStyle(m.st, true).Render("Pick a secret to encrypt with"), + m.st.Muted.Render("The recipient needs read access to it to decrypt the files. Its value isn't"), + m.st.Muted.Render("shown or put in the link. share.key sets one for a repo, or for all.")) m.fillSearch(false) return tea.Batch(cmd, m.searchLoads()) }