@@ -294,7 +294,7 @@ func (m *MinGasPriceInput) View() string {
294
294
}
295
295
296
296
type EnableFeaturesCheckbox struct {
297
- utils.Selector [EnableFeaturesOption ]
297
+ utils.CheckBox [EnableFeaturesOption ]
298
298
state * RunL1NodeState
299
299
}
300
300
@@ -307,13 +307,8 @@ const (
307
307
308
308
func NewEnableFeaturesCheckbox (state * RunL1NodeState ) * EnableFeaturesCheckbox {
309
309
return & EnableFeaturesCheckbox {
310
- Selector : utils.Selector [EnableFeaturesOption ]{
311
- Options : []EnableFeaturesOption {
312
- LCD ,
313
- gRPC ,
314
- },
315
- },
316
- state : state ,
310
+ CheckBox : * utils .NewCheckBox ([]EnableFeaturesOption {LCD , gRPC }),
311
+ state : state ,
317
312
}
318
313
}
319
314
@@ -322,17 +317,16 @@ func (m *EnableFeaturesCheckbox) Init() tea.Cmd {
322
317
}
323
318
324
319
func (m * EnableFeaturesCheckbox ) Update (msg tea.Msg ) (tea.Model , tea.Cmd ) {
325
- return m , nil
320
+ cb , cmd , done := m .Select (msg )
321
+ if done {
322
+ fmt .Println ("yo" )
323
+ }
324
+ m .CheckBox = * cb
325
+ return m , cmd
326
326
}
327
327
328
328
func (m * EnableFeaturesCheckbox ) View () string {
329
329
view := "? Would you like to enable the following options?\n "
330
- for i , option := range m .Options {
331
- if i == m .Cursor {
332
- view += "(■) " + string (option ) + "\n "
333
- } else {
334
- view += "( ) " + string (option ) + "\n "
335
- }
336
- }
330
+ view += m .CheckBox .View ()
337
331
return view + "\n Use arrow-keys. Space to select. Return to submit, or q to quit."
338
332
}
0 commit comments