MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / createBaseModal

Function createBaseModal

internal/ui/components/dialogs_creators.go:76–94  ·  view source on GitHub ↗

createBaseModal creates a base modal with common configuration.

(title, message string, textColor tcell.Color, onClose func())

Source from the content-addressed store, hash-verified

74
75// createBaseModal creates a base modal with common configuration.
76func 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.
97func CreateInfoDialog(title, message string, onClose func()) *tview.Modal {

Callers 2

CreateInfoDialogFunction · 0.85
CreateErrorDialogFunction · 0.85

Calls 5

SetTextColorMethod · 0.80
AddButtonsMethod · 0.80
SetDoneFuncMethod · 0.80
SetTitleMethod · 0.65
SetTextMethod · 0.45

Tested by

no test coverage detected