85110381ef0c79d78cb70bc2904849243c1bdf46

Author
Toby Padilla <toby@charm.sh>
Committer
Ayman Bagabas <ayman.bagabas@gmail.com>
Date

Message

Simplify help, disable navigation options on config repo

Diff

  1diff --git a/internal/tui/bubbles/git/about/bubble.go b/internal/tui/bubbles/git/about/bubble.go
  2index 07fa8a8c1775e571f0266437e7152d90e1af767a..199f864cf515ef4069c7a9313ab37abdda22fcae 100644
  3--- a/internal/tui/bubbles/git/about/bubble.go
  4+++ b/internal/tui/bubbles/git/about/bubble.go
  5@@ -78,9 +78,7 @@ func (b *Bubble) View() string {
  6 }
  7 
  8 func (b *Bubble) Help() []types.HelpEntry {
  9-	return []types.HelpEntry{
 10-		{"f/b", "pgup/pgdown"},
 11-	}
 12+	return nil
 13 }
 14 
 15 func (b *Bubble) setupCmd() tea.Msg {
 16diff --git a/internal/tui/bubbles/git/bubble.go b/internal/tui/bubbles/git/bubble.go
 17index c6780f26ab56b0015159abb9bc8772fdab59da1c..aa27c2f6b9f6b604acfdf04e8826943a7d1f2e28 100644
 18--- a/internal/tui/bubbles/git/bubble.go
 19+++ b/internal/tui/bubbles/git/bubble.go
 20@@ -63,15 +63,17 @@ func (b *Bubble) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 21 	cmds := make([]tea.Cmd, 0)
 22 	switch msg := msg.(type) {
 23 	case tea.KeyMsg:
 24-		switch msg.String() {
 25-		case "A":
 26-			b.state = aboutPage
 27-		case "R":
 28-			b.state = refsPage
 29-		case "L":
 30-			b.state = logPage
 31-		case "T":
 32-			b.state = treePage
 33+		if b.repo.Name() != "config" {
 34+			switch msg.String() {
 35+			case "r", "R":
 36+				b.state = aboutPage
 37+			case "b", "B":
 38+				b.state = refsPage
 39+			case "c", "C":
 40+				b.state = logPage
 41+			case "f", "F":
 42+				b.state = treePage
 43+			}
 44 		}
 45 	case tea.WindowSizeMsg:
 46 		b.width = msg.Width
 47@@ -105,21 +107,12 @@ func (b *Bubble) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 48 
 49 func (b *Bubble) Help() []types.HelpEntry {
 50 	h := []types.HelpEntry{}
 51-	if b.state != treePage {
 52-		h = append(h, types.HelpEntry{"↑/↓", "navigate"})
 53-	}
 54 	h = append(h, b.boxes[b.state].(types.HelpableBubble).Help()...)
 55-	if b.state != aboutPage {
 56-		h = append(h, types.HelpEntry{"A", "about"})
 57-	}
 58-	if b.state != refsPage {
 59-		h = append(h, types.HelpEntry{"R", "refs"})
 60-	}
 61-	if b.state != logPage {
 62-		h = append(h, types.HelpEntry{"L", "log"})
 63-	}
 64-	if b.state != treePage {
 65-		h = append(h, types.HelpEntry{"T", "tree"})
 66+	if b.repo.Name() != "config" {
 67+		h = append(h, types.HelpEntry{"r", "readme"})
 68+		h = append(h, types.HelpEntry{"f", "files"})
 69+		h = append(h, types.HelpEntry{"c", "commits"})
 70+		h = append(h, types.HelpEntry{"b", "branches/tags"})
 71 	}
 72 	return h
 73 }
 74diff --git a/internal/tui/bubbles/git/log/bubble.go b/internal/tui/bubbles/git/log/bubble.go
 75index ccee7889ceb2c211982faf8815dccbd74f2c691a..7d075953a39b646884a0d071e00f4389bd6adbc6 100644
 76--- a/internal/tui/bubbles/git/log/bubble.go
 77+++ b/internal/tui/bubbles/git/log/bubble.go
 78@@ -140,16 +140,7 @@ func (b *Bubble) updateItems() tea.Cmd {
 79 }
 80 
 81 func (b *Bubble) Help() []types.HelpEntry {
 82-	switch b.state {
 83-	case logState:
 84-		return []types.HelpEntry{
 85-			{"enter", "select"},
 86-		}
 87-	default:
 88-		return []types.HelpEntry{
 89-			{"esc", "back"},
 90-		}
 91-	}
 92+	return nil
 93 }
 94 
 95 func (b *Bubble) GotoTop() {
 96diff --git a/internal/tui/bubbles/git/refs/bubble.go b/internal/tui/bubbles/git/refs/bubble.go
 97index 543410b4741d81b021ddf09b90b794eb0fa24460..211025847848251876d714aa8bb45abfb4bbc981 100644
 98--- a/internal/tui/bubbles/git/refs/bubble.go
 99+++ b/internal/tui/bubbles/git/refs/bubble.go
100@@ -110,9 +110,7 @@ func (b *Bubble) SetSize(width, height int) {
101 }
102 
103 func (b *Bubble) Help() []types.HelpEntry {
104-	return []types.HelpEntry{
105-		{"enter", "select"},
106-	}
107+	return nil
108 }
109 
110 func (b *Bubble) updateItems() tea.Cmd {
111diff --git a/internal/tui/bubbles/git/tree/bubble.go b/internal/tui/bubbles/git/tree/bubble.go
112index e69bb28d30bde231ec530e1abf68e8121f1553c6..9a60fb80a63338769da913e073412ae04dbc203b 100644
113--- a/internal/tui/bubbles/git/tree/bubble.go
114+++ b/internal/tui/bubbles/git/tree/bubble.go
115@@ -175,14 +175,7 @@ func (b *Bubble) SetSize(width, height int) {
116 }
117 
118 func (b *Bubble) Help() []types.HelpEntry {
119-	h := []types.HelpEntry{}
120-	switch b.state {
121-	case errorState:
122-		h = append(h, types.HelpEntry{"esc", "back"})
123-	default:
124-		h = append(h, types.HelpEntry{"←/↑/→/↓", "navigate"})
125-	}
126-	return h
127+	return nil
128 }
129 
130 func (b *Bubble) updateItems() tea.Cmd {