|
|
@@ -11,6 +11,7 @@ import (
|
|
|
"fmt"
|
|
|
"strings"
|
|
|
|
|
|
+ "github.com/charmbracelet/bubbles/textinput"
|
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
|
"github.com/charmbracelet/lipgloss"
|
|
|
)
|
|
|
@@ -130,6 +131,51 @@ func (m Model) View() string {
|
|
|
return output
|
|
|
}
|
|
|
|
|
|
+type issueCreate struct {
|
|
|
+ focusedField int
|
|
|
+ inputs []textinput.Model
|
|
|
+ issue Issue
|
|
|
+}
|
|
|
+
|
|
|
+func (c issueCreate) init(i Issue) issueCreate {
|
|
|
+ c.issue = i
|
|
|
+ title := textinput.Model{Placeholder: "title", CharLimit: 64, Width: 45}
|
|
|
+ status := textinput.Model{Placeholder: "status", CharLimit: 64, Width: 45}
|
|
|
+ tags := textinput.Model{Placeholder: "tags", CharLimit: 64, Width: 45}
|
|
|
+ blockers := textinput.Model{Placeholder: "blockers", CharLimit: 64, Width: 45}
|
|
|
+ c.inputs = append(c.inputs, title, status, tags, blockers)
|
|
|
+ return c
|
|
|
+}
|
|
|
+
|
|
|
+func (c issueCreate) update(msg tea.Msg) (issueCreate, tea.Cmd) {
|
|
|
+ switch T := msg.(type) {
|
|
|
+ case issueCreate:
|
|
|
+ c.issue = T.issue
|
|
|
+ c.focusedField = T.focusedField
|
|
|
+ c.inputs = T.inputs
|
|
|
+
|
|
|
+ return c, nil
|
|
|
+ case tea.KeyMsg:
|
|
|
+ switch T.String() {
|
|
|
+ case "tab":
|
|
|
+ if c.focusedField < len(c.inputs)-1 {
|
|
|
+ c.focusedField++
|
|
|
+ } else {
|
|
|
+ c.focusedField = 0
|
|
|
+ }
|
|
|
+ return c, nil
|
|
|
+ default:
|
|
|
+ inputModel, inputCmd := c.inputs[c.focusedField].Update(msg)
|
|
|
+ c.inputs[c.focusedField] = inputModel
|
|
|
+ return c, inputCmd
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return c, nil
|
|
|
+}
|
|
|
+
|
|
|
+func (c issueCreate) view() tea.Msg { return "testing" }
|
|
|
+
|
|
|
// Handles load logic
|
|
|
func (m Model) load() tea.Msg {
|
|
|
if IsIssue(m.Path) {
|
|
|
@@ -152,7 +198,7 @@ func (m Model) load() tea.Msg {
|
|
|
return collection
|
|
|
}
|
|
|
|
|
|
- return nil
|
|
|
+ return issueCreate{issue: Issue{Path: m.Path}}
|
|
|
}
|
|
|
|
|
|
// Handles all view logic for Issue structs
|