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) <noreply@anthropic.com>
This commit is contained in:
2 files changed
+26
-17
No files matched your search
@@ -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
|
||||
}
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user