Files
pipelines/internal/tui/context_footer.go
T
alan c42a19f7d3 Improve workflow UI, retain stage diffs, and add portable pipeline transfers
Make OpenCode authoring responsive and expand the managed skill references. Add conflict-aware import/export, real-provider reference workflows, and tracked V2 generation for reliable budget accounting.
2026-10-10 20:55:42 +01:00

107 lines
3.7 KiB
Go

package tui
import (
"strings"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/x/ansi"
)
// Modal controls replace, rather than inherit, the obscured page's shortcuts.
func (m Model) activeFooter() string {
text := ""
switch {
case m.editorChecking:
text = "Refreshing published state · draft retained"
case m.actionConfirm != nil || m.mutationCommand != nil:
text = "y confirm · n/Esc cancel · j/k read"
case m.draftDeletingPath != "":
text = "y delete · n/Esc keep · j/k read"
case m.statusOpen:
text = "j/k scroll · r refresh · Esc back"
case m.editorOpen:
text = "Type to filter · ↑/↓ choose · Enter open · Esc cancel"
case m.confirmOpen && m.templateConfirm:
text = "Enter create pipeline · edit name · Esc keep draft"
if m.pendingDraft != nil && m.pendingDraft.path == "" {
text = "Enter create pipeline · edit name · Esc back"
}
case m.confirmOpen && m.pendingDraft != nil && strings.TrimSpace(m.pendingDraft.name) == "":
text = "Enter save name · Esc keep draft"
case m.confirmOpen:
text = "s " + m.publicationAction() + " · e edit · Esc keep draft"
case m.versionsOpen:
text = "↑/↓ choose · Enter view version · Esc back"
case m.paletteOpen && m.searchOpen:
text = "Type to search · ↑/↓ choose · Enter open · Esc cancel"
case m.paletteOpen:
text = "Type a command · ↑/↓ choose · Enter execute · Esc cancel"
case m.logOpen:
text = "j/k line · ←/→ pan · Esc back"
case m.runPicker:
text = "Type to filter · ↑/↓ choose · Enter select · Esc cancel"
case m.runForm != 0:
text = "Ctrl+S run · Enter newline · Esc cancel"
case m.templateOpen && len(m.templates) == 0:
text = ": commands · Esc back"
case m.templateOpen:
text = "s create pipeline · Tab graph · n/p template · j/k read · Esc back"
if m.templateGraphFocus {
text = "s create pipeline · Tab description · n/p template · hjkl pan · Esc back"
}
case m.runSearchOpen:
text = "Type to filter · Enter results · Esc clear"
}
if text == "" {
return ""
}
if m.width < 65 {
switch {
case m.editorChecking:
text = "Refreshing · draft retained"
case m.actionConfirm != nil || m.mutationCommand != nil:
text = "Esc cancel · y confirm · j/k read"
case m.draftDeletingPath != "":
text = "Esc keep · y delete · j/k read"
case m.statusOpen:
text = "Esc back · r refresh · j/k read"
case m.editorOpen || m.runPicker:
text = "Esc back · Enter open · ↑↓ select"
case m.confirmOpen && m.templateConfirm:
text = "Esc keep · Enter create pipeline"
if m.pendingDraft != nil && m.pendingDraft.path == "" {
text = "Esc back · Enter create pipeline"
}
case m.confirmOpen && m.pendingDraft != nil && strings.TrimSpace(m.pendingDraft.name) == "":
text = "Esc keep · Enter save name"
case m.confirmOpen:
text = "Esc keep · s " + m.publicationAction()
case m.versionsOpen:
text = "Esc back · Enter view · ↑↓ select"
case m.paletteOpen && m.searchOpen:
text = "Esc back · Enter open · ↑↓ select"
case m.paletteOpen:
text = "Esc back · Enter run · ↑↓ select"
case m.logOpen:
text = "Esc back · j/k read · ←→ pan"
case m.runForm != 0:
text = "Esc cancel · Ctrl+S run"
case m.templateOpen:
text = "Esc · s create · Tab graph · n/p"
if m.templateGraphFocus {
text = "Esc · Tab description · hjkl pan · n/p"
}
case m.runSearchOpen:
text = "Esc clear · Enter results"
}
}
return lipgloss.NewStyle().Foreground(themeMuted).Render(ansi.Truncate(text, max(1, m.width), "…"))
}
func (m Model) publicationAction() string {
if m.pendingDraft != nil && !m.pendingDraft.createOnly && m.pendingDraft.baseVersion > 0 {
return "update pipeline"
}
return "create pipeline"
}