createBaseModal creates a base modal with common configuration.
(title, message string, textColor tcell.Color, onClose func())
| 74 | |
| 75 | // createBaseModal creates a base modal with common configuration. |
| 76 | func createBaseModal(title, message string, textColor tcell.Color, onClose func()) *tview.Modal { |
| 77 | modal := tview.NewModal() |
| 78 | modal.SetText(message) |
| 79 | // modal.SetBackgroundColor(theme.Colors.Background) |
| 80 | modal.SetTextColor(textColor) |
| 81 | modal.SetBorderColor(theme.Colors.Border) |
| 82 | modal.SetTitle(title) |
| 83 | modal.SetTitleColor(theme.Colors.Title) |
| 84 | |
| 85 | // Add close button |
| 86 | modal.AddButtons([]string{"OK"}) |
| 87 | modal.SetDoneFunc(func(buttonIndex int, buttonLabel string) { |
| 88 | if onClose != nil { |
| 89 | onClose() |
| 90 | } |
| 91 | }) |
| 92 | |
| 93 | return modal |
| 94 | } |
| 95 | |
| 96 | // CreateInfoDialog creates an information dialog. |
| 97 | func CreateInfoDialog(title, message string, onClose func()) *tview.Modal { |
no test coverage detected