TUI: add quit confirmation

This commit is contained in:
Moira Daniella A Sebastian
2026-03-20 13:55:00 +01:00
parent 6a91abc13f
commit 6d72c9195b
10 changed files with 151 additions and 4 deletions

View File

@@ -211,6 +211,7 @@ func NewIssueListFromIssues(app *app.App, issues []*models.Issue, width, height
l.SetShowHelp(false)
l.SetShowStatusBar(false)
l.SetFilteringEnabled(true)
l.DisableQuitKeybindings()
l.FilterInput.PromptStyle = styles.FilterPromptStyle
l.FilterInput.Cursor.Style = styles.FilterStyle
l.FilterInput.TextStyle = styles.FilterInputStyle

View File

@@ -68,6 +68,22 @@ func RenderCreateIssue(width, height int, inputView string) string {
return lipgloss.Place(width, height, lipgloss.Center, lipgloss.Center, createBox)
}
func RenderConfirmQuit(width, height int) string {
if width < 5 || height < 5 {
return ""
}
confirmContent := lipgloss.JoinVertical(lipgloss.Left,
styles.LabelStyle.Render("Sure you want to quit?"),
lipgloss.NewStyle().Foreground(styles.FaintText).Render("y = quit n/Esc = cancel"),
)
confirmBoxWidth := modalBoxWidth(40, width)
confirmBox := styles.ContainerStyle.
Width(confirmBoxWidth).
BorderForeground(styles.PrimaryBorder).
Render(confirmContent)
return lipgloss.Place(width, height, lipgloss.Center, lipgloss.Center, confirmBox)
}
func RenderConfirmDelete(width, height int, issueID string) string {
if width < 5 || height < 5 {
return ""
@@ -157,6 +173,7 @@ func RenderChooseType(width, height int, issueID string) string {
// no modal is active.
func RenderModals(
width, height int,
confirmingQuit bool,
editingTitle bool, titleInputView string,
editingDescription bool, descriptionInputView string,
creatingIssue bool, createTitleInputView string,
@@ -167,6 +184,9 @@ func RenderModals(
editingAssignee bool, assigneeInputView string,
mainView string,
) string {
if confirmingQuit {
return RenderConfirmQuit(width, height)
}
if editingTitle {
return RenderEditTitle(width, height, titleInputView)
}