@@ -2,6 +2,7 @@ package weaveinit
2
2
3
3
import (
4
4
"fmt"
5
+ "github.com/initia-labs/weave/styles"
5
6
"os"
6
7
"path/filepath"
7
8
@@ -12,7 +13,8 @@ import (
12
13
13
14
type RunL1NodeNetworkSelect struct {
14
15
utils.Selector [L1NodeNetworkOption ]
15
- state * RunL1NodeState
16
+ state * RunL1NodeState
17
+ question string
16
18
}
17
19
18
20
type L1NodeNetworkOption string
@@ -32,18 +34,25 @@ func NewRunL1NodeNetworkSelect(state *RunL1NodeState) *RunL1NodeNetworkSelect {
32
34
Local ,
33
35
},
34
36
},
35
- state : state ,
37
+ state : state ,
38
+ question : "Which network will your node participate in?" ,
36
39
}
37
40
}
38
41
42
+ func (m * RunL1NodeNetworkSelect ) GetQuestion () string {
43
+ return m .question
44
+ }
45
+
39
46
func (m * RunL1NodeNetworkSelect ) Init () tea.Cmd {
40
47
return nil
41
48
}
42
49
43
50
func (m * RunL1NodeNetworkSelect ) Update (msg tea.Msg ) (tea.Model , tea.Cmd ) {
44
51
selected , cmd := m .Select (msg )
45
52
if selected != nil {
46
- m .state .network = string (* selected )
53
+ selectedString := string (* selected )
54
+ m .state .network = selectedString
55
+ m .state .weave .PreviousResponse += styles .RenderPreviousResponse (styles .ArrowSeparator , m .GetQuestion (), []string {}, selectedString )
47
56
switch * selected {
48
57
case Mainnet , Testnet :
49
58
return NewExistingAppChecker (m .state ), utils .DoTick ()
@@ -57,7 +66,11 @@ func (m *RunL1NodeNetworkSelect) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
57
66
}
58
67
59
68
func (m * RunL1NodeNetworkSelect ) View () string {
60
- view := "? Which network will your node participate in?\n "
69
+ view := m .state .weave .PreviousResponse + styles .RenderPrompt (
70
+ "Which network will your node participate in?\n " ,
71
+ []string {},
72
+ styles .Question ,
73
+ )
61
74
for i , option := range m .Options {
62
75
if i == m .Cursor {
63
76
view += "(■) " + string (option ) + "\n "
@@ -95,7 +108,7 @@ func (m *RunL1NodeVersionInput) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
95
108
}
96
109
97
110
func (m * RunL1NodeVersionInput ) View () string {
98
- return m .TextInput .View ("Please specify the initiad version" )
111
+ return m .state . weave . PreviousResponse + m . TextInput .View ("Please specify the initiad version" )
99
112
}
100
113
101
114
type RunL1NodeChainIdInput struct {
0 commit comments