diff --git a/internal/tui/channel.go b/internal/tui/channel.go index f073723..8ac3546 100644 --- a/internal/tui/channel.go +++ b/internal/tui/channel.go @@ -327,12 +327,12 @@ func (m ChannelModel) getChannelParameters() string { // Update form placeholder values policyFeeRate = strconv.FormatInt(localNodePolicy.FeeRateMilliMsat, 10) - policyBaseRate = strconv.FormatInt(localNodePolicy.FeeBaseMsat / 1000, 10) + policyBaseRate = strconv.FormatInt(localNodePolicy.FeeBaseMsat/1000, 10) policyTimeLockDelta = strconv.FormatUint(uint64(localNodePolicy.TimeLockDelta), 10) localView := fmt.Sprintf("%s\n%s %v\n%s %v\n%s %v\n%s %v\n%s %v", m.styles.Keyword("Local"), m.styles.SubKeyword("Base"), - localNodePolicy.FeeBaseMsat / 1000, m.styles.SubKeyword("Rate"), localNodePolicy.FeeRateMilliMsat, + localNodePolicy.FeeBaseMsat/1000, m.styles.SubKeyword("Rate"), localNodePolicy.FeeRateMilliMsat, m.styles.SubKeyword("CLTV Delta"), localNodePolicy.TimeLockDelta, m.styles.SubKeyword("Max HTLC"), localNodePolicy.MaxHtlcMsat/1000, m.styles.SubKeyword("Min HTLC"), localNodePolicy.MinHtlcMsat/1000) @@ -508,19 +508,16 @@ func (m ChannelModel) View() string { htlcTableView, bottomView, helpView) - } else if m.state == ChannelStateWantForceClose { - v := strings.TrimSuffix(m.channelCloseForm.View(), "\n\n") - form := lipgloss.DefaultRenderer().NewStyle().Margin(1, 0).Render(v) - return lipgloss.JoinVertical(lipgloss.Left, form) - } else if m.state == ChannelStateWantClose { - v := strings.TrimSuffix(m.channelCloseForm.View(), "\n\n") - form := lipgloss.DefaultRenderer().NewStyle().Margin(1, 0).Render(v) - return lipgloss.JoinVertical(lipgloss.Left, form) + } else if m.state == ChannelStateWantForceClose || m.state == ChannelStateWantClose { + return m.getFormView(strings.TrimSuffix(m.channelCloseForm.View(), "\n\n")) } else if m.state == ChannelPolicyUpdate { - v := strings.TrimSuffix(m.channelPolicyForm.View(), "\n\n") - form := lipgloss.DefaultRenderer().NewStyle().Margin(1, 0).Render(v) - return lipgloss.JoinVertical(lipgloss.Left, form) + return m.getFormView(strings.TrimSuffix(m.channelPolicyForm.View(), "\n\n")) } return "" } + +func (m ChannelModel) getFormView(view string) string { + form := lipgloss.DefaultRenderer().NewStyle().Margin(1, 0).Render(view) + return lipgloss.JoinVertical(lipgloss.Left, form) +} diff --git a/internal/tui/dashboard.go b/internal/tui/dashboard.go index 7ec09d2..9e4ac2b 100644 --- a/internal/tui/dashboard.go +++ b/internal/tui/dashboard.go @@ -102,8 +102,7 @@ func (m DashboardModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch m.focused { case payments: - m.lists[m.focused], cmd = m.lists[m.focused].Update(msg) - cmds = append(cmds, cmd) + fallthrough case channels: m.lists[m.focused], cmd = m.lists[m.focused].Update(msg)