Skip to content

Commit 1c29b1e

Browse files
committed
feat(ui): dynamic display of commit type
dynamic display of commit type Signed-off-by: mritd <[email protected]>
1 parent 7b17125 commit 1c29b1e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ui.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
tea "github.com/charmbracelet/bubbletea"
55
"github.com/mattn/go-runewidth"
6+
"strings"
67
)
78

89
const (
@@ -65,6 +66,8 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
6566

6667
// some special views need to determine the state of the data to update
6768
switch m.viewIndex {
69+
case INPUTS:
70+
return m, m.inputs
6871
case SPINNER:
6972
return m, m.commit
7073
case RESULT:
@@ -83,6 +86,10 @@ func (m model) View() string {
8386
return m.views[m.viewIndex].View()
8487
}
8588

89+
func (m model) inputs() tea.Msg {
90+
return strings.ToUpper(m.views[SELECTOR].(selectorModel).choice)
91+
}
92+
8693
func (m model) commit() tea.Msg {
8794
sob, err := createSOB()
8895
if err != nil {

ui_inputs.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ func (m inputsModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
112112

113113
return m, tea.Batch(cmds...)
114114
}
115+
case string:
116+
m.title = "✔ Commit Type: " + msg
117+
return m, nil
115118
}
116119

117120
// Handle character input and blinking
@@ -148,7 +151,7 @@ func (m inputsModel) View() string {
148151
}
149152
_, _ = fmt.Fprint(&b, inputsButtonBlockStyle.Render(button))
150153

151-
title := inputsTitleBarStyle.Render(inputsTitleStyle.Render("Input Other Messages"))
154+
title := inputsTitleBarStyle.Render(inputsTitleStyle.Render(m.title))
152155
inputs := inputsBlockStyle.Render(b.String())
153156

154157
return lipgloss.JoinVertical(lipgloss.Left, title, inputs)

0 commit comments

Comments
 (0)