fix close modal
This commit is contained in:
@@ -93,22 +93,22 @@ func (c *ConfirmModal) Update(msg tea.Msg) (tea.Cmd, bool) {
|
||||
|
||||
// Check yes keys
|
||||
if slices.Contains(c.yesKeys, s) {
|
||||
c.Deactivate()
|
||||
return func() tea.Msg {
|
||||
return ModalCompletedMsg{
|
||||
ModalID: c.ID(),
|
||||
Value: ConfirmResult{Confirmed: true},
|
||||
}
|
||||
}, true
|
||||
}
|
||||
c.Deactivate()
|
||||
return func() tea.Msg {
|
||||
return ModalCompletedMsg{
|
||||
ModalID: c.ID(),
|
||||
Value: ConfirmResult{Confirmed: true},
|
||||
}
|
||||
}, true
|
||||
}
|
||||
|
||||
// Check no/cancel keys
|
||||
if slices.Contains(c.noKeys, s) {
|
||||
c.Deactivate()
|
||||
return func() tea.Msg {
|
||||
return ModalCancelledMsg{ModalID: c.ID()}
|
||||
}, true
|
||||
}
|
||||
c.Deactivate()
|
||||
return func() tea.Msg {
|
||||
return ModalCancelledMsg{ModalID: c.ID()}
|
||||
}, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, true
|
||||
|
||||
@@ -163,6 +163,15 @@ func (m *Manager) RenderWithMainView(mainView string) string {
|
||||
// RegisterCommonModals registers the standard set of modals used across views.
|
||||
// This helper reduces duplication between dashboard and kanban views.
|
||||
func RegisterCommonModals(m *Manager) {
|
||||
|
||||
// Exit Confirm Modal
|
||||
m.RegisterModal(NewConfirmModal(ConfirmConfig{
|
||||
ID: ModalConfirmExit,
|
||||
Message: "Close the task and interface?",
|
||||
YesKeys: []string{"y", "Y"},
|
||||
NoKeys: []string{"n", "N", "esc"},
|
||||
}))
|
||||
|
||||
// Edit Title Modal
|
||||
m.RegisterModal(NewTextInputModal(TextInputConfig{
|
||||
ID: ModalEditTitle,
|
||||
|
||||
@@ -50,6 +50,7 @@ type ModalCancelledMsg struct {
|
||||
|
||||
// Modal IDs used across the application
|
||||
const (
|
||||
ModalConfirmExit = "confirm-exit"
|
||||
ModalEditTitle = "edit-title"
|
||||
ModalCreateIssue = "create-issue"
|
||||
ModalEditAssignee = "edit-assignee"
|
||||
|
||||
Reference in New Issue
Block a user