(form *tview.Form, frame *tview.Frame, app *tview.Application)
| 20 | } |
| 21 | |
| 22 | func (i *Peer2ProfitConfig) ConfigureForm(form *tview.Form, frame *tview.Frame, app *tview.Application) { |
| 23 | email := "" |
| 24 | isError := false |
| 25 | showingError := false |
| 26 | form.AddInputField("Email", i.Email, 50, nil, func(text string) { |
| 27 | email = text |
| 28 | }) |
| 29 | form.AddButton("Save", func() { |
| 30 | isError = stringIsEmpty(email) |
| 31 | if isError { |
| 32 | if !showingError { |
| 33 | form.AddTextView("Error", "All fields are required", 0, 1, true, true) |
| 34 | showingError = true |
| 35 | } |
| 36 | return |
| 37 | } |
| 38 | i.Email = email |
| 39 | i.Configured = true |
| 40 | returnToMenu(frame, app) |
| 41 | }) |
| 42 | form.AddButton("Cancel", func() { |
| 43 | returnToMenu(frame, app) |
| 44 | }) |
| 45 | form.AddButton("Register", func() { |
| 46 | modal := tview.NewModal(). |
| 47 | SetText("Register on Peer2Profit\n" + PEER2PROFIT_REFERRAL_LINK). |
| 48 | AddButtons([]string{"Open", "Cancel"}). |
| 49 | SetDoneFunc(func(buttonIndex int, buttonLabel string) { |
| 50 | if buttonLabel == "Open" { |
| 51 | webbrowser.Open(PEER2PROFIT_REFERRAL_LINK) |
| 52 | } |
| 53 | app.SetRoot(form, true) |
| 54 | }) |
| 55 | app.SetRoot(modal, true) |
| 56 | }) |
| 57 | } |
| 58 | |
| 59 | func (i *Peer2ProfitConfig) ConfigureDocker(kind DockerConfigKind, form *tview.Form) (string, error) { |
| 60 | switch kind { |
nothing calls this directly
no test coverage detected