Help on every panel, task filter, unblock key, mouse zones, safe add-only rebuild
This commit is contained in:
20
tui/work.go
20
tui/work.go
@@ -46,6 +46,7 @@ type workModel struct {
|
||||
scroll int
|
||||
readAt time.Time
|
||||
|
||||
showHelp bool
|
||||
width, height int
|
||||
}
|
||||
|
||||
@@ -122,7 +123,14 @@ func (m workModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return m, tea.Batch(m.load(), tickEvery(5*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":
|
||||
@@ -188,6 +196,18 @@ func (m workModel) View() string {
|
||||
fmt.Sprintf("This workspace needs 80 × 24.\nThis panel is %d × %d.", m.width, m.height))
|
||||
}
|
||||
|
||||
if m.showHelp {
|
||||
return helpOverlay("the work", [][2]string{
|
||||
{"[ ] h l", "switch between runs, change and facts"},
|
||||
{"↑ ↓ j k", "scroll"},
|
||||
{"g / G", "top / bottom"},
|
||||
{"r", "read again"},
|
||||
{"R", "rebuild every pane"},
|
||||
{"q", "leave"},
|
||||
{"?", "this list"},
|
||||
}, m.width, m.height)
|
||||
}
|
||||
|
||||
head := titleStyle.Render("Work") + mutedStyle2().Render(" · ")
|
||||
if m.task.Identifier != "" {
|
||||
head += lipgloss.NewStyle().Foreground(lipgloss.Color(active.Text)).Render(m.task.Identifier)
|
||||
|
||||
Reference in New Issue
Block a user