Files
tuio/internal/tui/steps.go
T
jbandClaude Opus 4.8 255b4cc299 feat: add back navigation, review step, and error retry to TUI
Implements three UX improvements (TODO #1–#3):

- Back navigation: Esc returns to the previous input step. The Model keeps
  a history stack of input steps (advance/goBack helpers); action/wait
  steps are excluded via isInputStep so back never re-enters a
  side-effecting step. Form values are preserved.
- Review step (StepReview): shows all collected config for confirmation
  before any file is written; Enter installs, Esc edits.
- Retry vs. fix: transient failures (image pull, container run) offer
  "r: tentar novamente" instead of quitting; validation failures route
  back to the relevant form to correct the value.

Adds nav_test.go for the history/navigation logic and updates
README/CLAUDE/docs (incl. docs/TODO.md tracking the remaining ideas).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 12:19:49 -03:00

48 lines
918 B
Go

package tui
type step int
const (
// Docker Validation
StepCheckDocker step = iota
StepDockerInstall
// Image Fetching
StepDockerLogin
StepDownloadImage
// IP Stuff
StepIPQuestion
StepWireguardConfig
StepGenerateWireguardFile
StepDownloadWireguard
StepRunWireguard
// Docker Config
StepAppConfig
StepServerConfig
StepDatabaseConfig
StepCertConfig
// Review
StepReview
// Finalizing
StepGenerateFile
StepRunDocker
StepDone
)
// isInputStep reports whether a step collects user input and therefore participates
// in back navigation. Action/wait steps (downloads, file generation, container runs)
// are excluded so that "back" never re-enters a side-effecting step.
func isInputStep(s step) bool {
switch s {
case StepDockerLogin, StepIPQuestion, StepWireguardConfig,
StepAppConfig, StepServerConfig, StepDatabaseConfig,
StepCertConfig, StepReview:
return true
}
return false
}