Help on every panel, task filter, unblock key, mouse zones, safe add-only rebuild
This commit is contained in:
@@ -49,6 +49,7 @@ type projectModel struct {
|
||||
tab int
|
||||
scroll int
|
||||
|
||||
showHelp bool
|
||||
width, height int
|
||||
}
|
||||
|
||||
@@ -140,7 +141,14 @@ func (m projectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return m, tea.Batch(m.load(), tickEvery(10*time.Second))
|
||||
|
||||
case tea.KeyMsg:
|
||||
if m.showHelp {
|
||||
m.showHelp = false
|
||||
return m, nil
|
||||
}
|
||||
switch msg.String() {
|
||||
case "?":
|
||||
m.showHelp = true
|
||||
return m, nil
|
||||
case "q", "ctrl+c":
|
||||
return m, tea.Quit
|
||||
case "r":
|
||||
@@ -194,6 +202,17 @@ func (m projectModel) View() string {
|
||||
fmt.Sprintf("This workspace needs 80 × 24.\nThis panel is %d × %d.", m.width, m.height))
|
||||
}
|
||||
|
||||
if m.showHelp {
|
||||
return helpOverlay("the project", [][2]string{
|
||||
{"[ ] h l", "facts, costs, settings"},
|
||||
{"↑ ↓ j k", "scroll"},
|
||||
{"r", "read again"},
|
||||
{"R", "rebuild every pane"},
|
||||
{"q", "leave"},
|
||||
{"?", "this list"},
|
||||
}, m.width, m.height)
|
||||
}
|
||||
|
||||
head := titleStyle.Render("Project") + mutedStyle2().Render(" · ")
|
||||
if m.project.Name != "" {
|
||||
head += lipgloss.NewStyle().Foreground(lipgloss.Color(active.Text)).Render(m.project.Name)
|
||||
|
||||
Reference in New Issue
Block a user