Skip to content

Commit b2b19a3

Browse files
committed
feat: terminal state
1 parent 1313d45 commit b2b19a3

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

models/initia/run_l1_node.go

+25-1
Original file line numberDiff line numberDiff line change
@@ -959,8 +959,9 @@ func (m *SyncMethodSelect) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
959959
m.state.syncMethod = string(*selected)
960960
switch *selected {
961961
case NoSync:
962+
m.state.weave.PushPreviousResponse(styles.RenderPreviousResponse(styles.ArrowSeparator, m.GetQuestion(), []string{""}, string(*selected)))
962963
// TODO: What if there's existing /data. Should we also prune it here?
963-
return m, tea.Quit
964+
return NewTerminalState(m.state), cmd
964965
case Snapshot, StateSync:
965966
m.state.weave.PushPreviousResponse(styles.RenderPreviousResponse(styles.ArrowSeparator, m.GetQuestion(), []string{""}, string(*selected)))
966967
model := NewExistingDataChecker(m.state)
@@ -1390,3 +1391,26 @@ func setupStateSync(state *RunL1NodeState) tea.Cmd {
13901391
return utils.EndLoading{}
13911392
}
13921393
}
1394+
1395+
type TerminalState struct {
1396+
state *RunL1NodeState
1397+
}
1398+
1399+
func NewTerminalState(state *RunL1NodeState) *TerminalState {
1400+
return &TerminalState{
1401+
state: state,
1402+
}
1403+
}
1404+
1405+
func (m *TerminalState) Init() tea.Cmd {
1406+
return nil
1407+
}
1408+
1409+
func (m *TerminalState) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
1410+
return m, tea.Quit
1411+
}
1412+
1413+
func (m *TerminalState) View() string {
1414+
// TODO: revisit congraturation text
1415+
return m.state.weave.Render() + "🪢🪢🪢 " + styles.FadeText("Success") + " 🪢🪢🪢\n"
1416+
}

0 commit comments

Comments
 (0)