@@ -2520,7 +2520,8 @@ func (m *GenerateOrRecoverSystemKeysLoading) Update(msg tea.Msg) (tea.Model, tea
2520
2520
2521
2521
if state .generateKeys {
2522
2522
state .weave .PushPreviousResponse (styles .RenderPreviousResponse (styles .NoSeparator , "System keys have been successfully generated." , []string {}, "" ))
2523
- return NewSystemKeysMnemonicDisplayInput (weavecontext .SetCurrentState (m .Ctx , state )), nil
2523
+ model := NewSystemKeysMnemonicDisplayInput (weavecontext .SetCurrentState (m .Ctx , state ))
2524
+ return model , model .Init ()
2524
2525
} else {
2525
2526
state .weave .PushPreviousResponse (styles .RenderPreviousResponse (styles .NoSeparator , "System keys have been successfully recovered." , []string {}, "" ))
2526
2527
model , err := NewFundGasStationConfirmationInput (weavecontext .SetCurrentState (m .Ctx , state ))
@@ -2540,13 +2541,49 @@ func (m *GenerateOrRecoverSystemKeysLoading) View() string {
2540
2541
2541
2542
type SystemKeysMnemonicDisplayInput struct {
2542
2543
ui.TextInput
2544
+ //ui.Clickable
2543
2545
weavecontext.BaseModel
2544
2546
question string
2545
2547
}
2546
2548
2549
+ // NewSystemKeysMnemonicDisplayInput
2550
+ // TODO: Switch to the comment version if we manage to fix the height content overflow issue
2547
2551
func NewSystemKeysMnemonicDisplayInput (ctx context.Context ) * SystemKeysMnemonicDisplayInput {
2552
+ //state := weavecontext.GetCurrentState[LaunchState](ctx)
2548
2553
model := & SystemKeysMnemonicDisplayInput {
2549
2554
TextInput : ui .NewTextInput (true ),
2555
+ //Clickable: *ui.NewClickable([]*ui.ClickableItem{
2556
+ // ui.NewClickableItem(map[bool]string{
2557
+ // true: "Copied! Click to copy again",
2558
+ // false: "Click here to copy",
2559
+ // }, func() error {
2560
+ // return io.CopyToClipboard(state.systemKeyOperatorMnemonic)
2561
+ // }),
2562
+ // ui.NewClickableItem(map[bool]string{
2563
+ // true: "Copied! Click to copy again",
2564
+ // false: "Click here to copy",
2565
+ // }, func() error {
2566
+ // return io.CopyToClipboard(state.systemKeyBridgeExecutorMnemonic)
2567
+ // }),
2568
+ // ui.NewClickableItem(map[bool]string{
2569
+ // true: "Copied! Click to copy again",
2570
+ // false: "Click here to copy",
2571
+ // }, func() error {
2572
+ // return io.CopyToClipboard(state.systemKeyOutputSubmitterMnemonic)
2573
+ // }),
2574
+ // ui.NewClickableItem(map[bool]string{
2575
+ // true: "Copied! Click to copy again",
2576
+ // false: "Click here to copy",
2577
+ // }, func() error {
2578
+ // return io.CopyToClipboard(state.systemKeyBatchSubmitterMnemonic)
2579
+ // }),
2580
+ // ui.NewClickableItem(map[bool]string{
2581
+ // true: "Copied! Click to copy again",
2582
+ // false: "Click here to copy",
2583
+ // }, func() error {
2584
+ // return io.CopyToClipboard(state.systemKeyChallengerMnemonic)
2585
+ // }),
2586
+ //}...),
2550
2587
BaseModel : weavecontext.BaseModel {Ctx : ctx , CannotBack : true },
2551
2588
question : "Type `continue` to proceed after you have securely stored the mnemonic." ,
2552
2589
}
@@ -2560,6 +2597,7 @@ func (m *SystemKeysMnemonicDisplayInput) GetQuestion() string {
2560
2597
}
2561
2598
2562
2599
func (m * SystemKeysMnemonicDisplayInput ) Init () tea.Cmd {
2600
+ //return m.Clickable.Init()
2563
2601
return nil
2564
2602
}
2565
2603
@@ -2568,13 +2606,19 @@ func (m *SystemKeysMnemonicDisplayInput) Update(msg tea.Msg) (tea.Model, tea.Cmd
2568
2606
return model , cmd
2569
2607
}
2570
2608
2609
+ //err := m.Clickable.ClickableUpdate(msg)
2610
+ //if err != nil {
2611
+ // return m, m.HandlePanic(err)
2612
+ //}
2613
+
2571
2614
input , cmd , done := m .TextInput .Update (msg )
2572
2615
if done {
2573
2616
_ = weavecontext.PushPageAndGetState [LaunchState ](m )
2574
2617
model , err := NewFundGasStationConfirmationInput (m .Ctx )
2575
2618
if err != nil {
2576
2619
return m , m .HandlePanic (err )
2577
2620
}
2621
+ //return model, m.Clickable.PostUpdate()
2578
2622
return model , nil
2579
2623
}
2580
2624
m .TextInput = input
@@ -2585,16 +2629,31 @@ func (m *SystemKeysMnemonicDisplayInput) View() string {
2585
2629
state := weavecontext.GetCurrentState [LaunchState ](m .Ctx )
2586
2630
2587
2631
var mnemonicText string
2588
- mnemonicText += styles .RenderMnemonic ("Operator" , state .systemKeyOperatorAddress , state .systemKeyOperatorMnemonic )
2589
- mnemonicText += styles .RenderMnemonic ("Bridge Executor" , state .systemKeyBridgeExecutorAddress , state .systemKeyBridgeExecutorMnemonic )
2590
- mnemonicText += styles .RenderMnemonic ("Output Submitter" , state .systemKeyOutputSubmitterAddress , state .systemKeyOutputSubmitterMnemonic )
2591
- mnemonicText += styles .RenderMnemonic ("Batch Submitter" , state .systemKeyBatchSubmitterAddress , state .systemKeyBatchSubmitterMnemonic )
2592
- mnemonicText += styles .RenderMnemonic ("Challenger" , state .systemKeyChallengerAddress , state .systemKeyChallengerMnemonic )
2593
-
2594
- return m .WrapView (state .weave .Render () + "\n " +
2632
+ //mnemonicText += styles.RenderMnemonic("Operator", state.systemKeyOperatorAddress, state.systemKeyOperatorMnemonic, m.Clickable.ClickableView(0))
2633
+ //mnemonicText += styles.RenderMnemonic("Bridge Executor", state.systemKeyBridgeExecutorAddress, state.systemKeyBridgeExecutorMnemonic, m.Clickable.ClickableView(1))
2634
+ //mnemonicText += styles.RenderMnemonic("Output Submitter", state.systemKeyOutputSubmitterAddress, state.systemKeyOutputSubmitterMnemonic, m.Clickable.ClickableView(2))
2635
+ //mnemonicText += styles.RenderMnemonic("Batch Submitter", state.systemKeyBatchSubmitterAddress, state.systemKeyBatchSubmitterMnemonic, m.Clickable.ClickableView(3))
2636
+ //mnemonicText += styles.RenderMnemonic("Challenger", state.systemKeyChallengerAddress, state.systemKeyChallengerMnemonic, m.Clickable.ClickableView(4))
2637
+ mnemonicText += styles .RenderMnemonic ("Operator" , state .systemKeyOperatorAddress , state .systemKeyOperatorMnemonic , "" )
2638
+ mnemonicText += styles .RenderMnemonic ("Bridge Executor" , state .systemKeyBridgeExecutorAddress , state .systemKeyBridgeExecutorMnemonic , "" )
2639
+ mnemonicText += styles .RenderMnemonic ("Output Submitter" , state .systemKeyOutputSubmitterAddress , state .systemKeyOutputSubmitterMnemonic , "" )
2640
+ mnemonicText += styles .RenderMnemonic ("Batch Submitter" , state .systemKeyBatchSubmitterAddress , state .systemKeyBatchSubmitterMnemonic , "" )
2641
+ mnemonicText += styles .RenderMnemonic ("Challenger" , state .systemKeyChallengerAddress , state .systemKeyChallengerMnemonic , "" )
2642
+
2643
+ userHome , err := os .UserHomeDir ()
2644
+ if err != nil {
2645
+ m .HandlePanic (err )
2646
+ }
2647
+ configFilePath := filepath .Join (userHome , common .WeaveDataDirectory , LaunchConfigFilename )
2648
+ viewText := m .WrapView (state .weave .Render () + "\n " +
2595
2649
styles .BoldUnderlineText ("Important" , styles .Yellow ) + "\n " +
2596
- styles .Text ("Write down these mnemonic phrases and store them in a safe place. \n It is the only way to recover your system keys." , styles .Yellow ) + "\n \n " +
2650
+ styles .Text (fmt . Sprintf ( "Write down these mnemonic phrases and store them in a safe place. \n It is the only way to recover your system keys.\n \n Note that before launching, these mnemonic phrases along with other configuration details will be stored \n in %s. You can revisit them anytime." , configFilePath ) , styles .Yellow ) + "\n \n " +
2597
2651
mnemonicText + styles .RenderPrompt (m .GetQuestion (), []string {"`continue`" }, styles .Question ) + m .TextInput .View ())
2652
+ //err = m.Clickable.ClickableUpdatePositions(viewText)
2653
+ if err != nil {
2654
+ m .HandlePanic (err )
2655
+ }
2656
+ return viewText
2598
2657
}
2599
2658
2600
2659
type FundGasStationConfirmationInput struct {
0 commit comments