Skip to content

Commit

Permalink
Merge branch 'main' into feat/prefix-modal-message
Browse files Browse the repository at this point in the history
  • Loading branch information
tasosbit authored Jan 7, 2025
2 parents 9c1a6df + ec8d8bc commit 75c837e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/utils/explanations/explanations.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ var NodeNotFound = lipgloss.JoinHorizontal(lipgloss.Left,
style.Cyan.Render("Explanation"),
style.Bold(": "),
) +
"algorun could not find your node automatically. (ensure the node is running)\n\n" +
"algorun could not find your node automatically. Ensure the node is installed and running: If you have not installed algod yet, run \"nodekit bootstrap\". If your node is installed, start it with \"nodekit start\". \n\n" +
lipgloss.JoinHorizontal(lipgloss.Left,
"Provide ",
"Otherwise for custom installations, provide ",
style.Bold("--datadir"),
" or set the goal-compatible ",
style.Bold("ALGORAND_DATA"),
Expand Down
4 changes: 4 additions & 0 deletions internal/algod/participation/participation.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ func GenerateKeys(
return nil, err
}
if key.StatusCode() != 200 {
if key.JSON400 != nil {
return nil, errors.New(key.JSON400.Message)
}

status := key.Status()
if status != "" {
return nil, errors.New(status)
Expand Down
2 changes: 1 addition & 1 deletion ui/app/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func GenerateCmd(account string, rangeType participation.RangeType, duration int
Key: nil,
Address: "",
Active: false,
Err: &err,
Err: err,
Type: ExceptionModal,
}
}
Expand Down
4 changes: 2 additions & 2 deletions ui/app/modal.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ type ModalEvent struct {
// Prefix adds prefix message to info modal
Prefix string

// Err is a pointer to an error that represents an exceptional condition or failure state for the modal event.
Err *error
// Err is an error that represents an exceptional condition or failure state for the modal event.
Err error

// Type represents the specific category or variant of the modal event.
Type ModalType
Expand Down
13 changes: 13 additions & 0 deletions ui/modal/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ func (m ViewModel) HandleMessage(msg tea.Msg) (*ViewModel, tea.Cmd) {
m.SetShortLink(msg)
m.SetType(app.TransactionModal)
case *algod.StateModel:
// Clear the catchup modal
if msg.Status.State != algod.FastCatchupState && m.Type == app.ExceptionModal && m.title == "Fast Catchup" {
m.Open = false
m.SetType(app.InfoModal)
}

m.State = msg
m.transactionModal.State = msg
m.infoModal.State = msg
Expand Down Expand Up @@ -90,6 +96,13 @@ func (m ViewModel) HandleMessage(msg tea.Msg) (*ViewModel, tea.Cmd) {
}

case app.ModalEvent:
if msg.Type == app.ExceptionModal {
m.Open = true
m.exceptionModal.Message = msg.Err.Error()
m.generateModal.SetStep(generate.AddressStep)
m.SetType(app.ExceptionModal)
}

if msg.Type == app.InfoModal {
m.infoModal.Prefix = msg.Prefix
m.generateModal.SetStep(generate.AddressStep)
Expand Down

0 comments on commit 75c837e

Please sign in to comment.