-
Notifications
You must be signed in to change notification settings - Fork 164
Expand file tree
/
Copy pathstep-native-cc.go
More file actions
60 lines (50 loc) · 1.65 KB
/
step-native-cc.go
File metadata and controls
60 lines (50 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package config
import (
cfgtypes "github.com/rocket-pool/smartnode/shared/types/config"
)
func createNativeCcStep(wiz *wizard, currentStep int, totalSteps int) *choiceWizardStep {
// Create the button names and descriptions from the config
clients := wiz.md.Config.Native.ConsensusClient.Options
clientNames := []string{}
clientDescriptions := []string{}
for _, client := range clients {
clientNames = append(clientNames, client.Name)
clientDescriptions = append(clientDescriptions, getAugmentedCcDescription(client.Value.(cfgtypes.ConsensusClient), client.Description))
}
helperText := "Please select the Consensus client you are / will be using.\n\nIf you're still deciding on one, highlight each one below to see a brief description of it, or go to https://docs.rocketpool.net/node-staking/eth-clients#eth2-clients to learn more about them."
show := func(modal *choiceModalLayout) {
wiz.md.setPage(modal.page)
modal.focus(0) // Catch-all for safety
if !wiz.md.isNew {
for i, option := range wiz.md.Config.Native.ConsensusClient.Options {
if option.Value == wiz.md.Config.Native.ConsensusClient.Value {
modal.focus(i)
break
}
}
}
}
done := func(buttonIndex int, buttonLabel string) {
selectedClient := clients[buttonIndex].Value.(cfgtypes.ConsensusClient)
wiz.md.Config.Native.ConsensusClient.Value = selectedClient
wiz.nativeCcUrlModal.show()
}
back := func() {
wiz.nativeEcModal.show()
}
return newChoiceStep(
wiz,
currentStep,
totalSteps,
helperText,
clientNames,
clientDescriptions,
100,
"Consensus Client > Selection",
DirectionalModalVertical,
show,
done,
back,
"step-native-cc",
)
}