@@ -3,11 +3,21 @@ package tui
33import (
44 "github.com/charmbracelet/bubbles/help"
55 "github.com/charmbracelet/bubbles/key"
6+ "github.com/charmbracelet/bubbles/textinput"
67 "github.com/charmbracelet/bubbles/viewport"
78 tea "github.com/charmbracelet/bubbletea"
89 "github.com/gitxtui/gitx/internal/git"
910)
1011
12+ // appMode defines the different operational modes of the TUI.
13+ type appMode int
14+
15+ const (
16+ modeNormal appMode = iota
17+ modeInput
18+ modeConfirm
19+ )
20+
1121// Model represents the state of the TUI.
1222type Model struct {
1323 width int
@@ -26,6 +36,13 @@ type Model struct {
2636 git * git.GitCommands
2737 repoName string
2838 branchName string
39+ // New fields for pop-ups
40+ mode appMode
41+ promptTitle string
42+ confirmMessage string
43+ textInput textinput.Model
44+ inputCallback func (string ) tea.Cmd
45+ confirmCallback func (bool ) tea.Cmd
2946}
3047
3148// initialModel creates the initial state of the application.
@@ -35,7 +52,6 @@ func initialModel() Model {
3552 repoName , branchName , _ := gc .GetRepoInfo ()
3653 initialContent := initialContentLoading
3754
38- // Create a slice to hold all UI panels.
3955 panels := make ([]panel , totalPanels )
4056 for i := range panels {
4157 vp := viewport .New (0 , 0 )
@@ -46,6 +62,11 @@ func initialModel() Model {
4662 }
4763 }
4864
65+ ti := textinput .New ()
66+ ti .Focus ()
67+ ti .CharLimit = 256
68+ ti .Width = 50
69+
4970 return Model {
5071 theme : Themes [themeNames [0 ]],
5172 themeNames : themeNames ,
@@ -59,6 +80,8 @@ func initialModel() Model {
5980 repoName : repoName ,
6081 branchName : branchName ,
6182 panels : panels ,
83+ mode : modeNormal ,
84+ textInput : ti ,
6285 }
6386}
6487
0 commit comments