()
| 111 | } |
| 112 | |
| 113 | func (m Remove) View() string { |
| 114 | titleLine := Styles.TitleRule(m.width, m.app.Settings.Host, "remove") |
| 115 | |
| 116 | var contentView string |
| 117 | if m.removing { |
| 118 | contentView = m.progress.View() |
| 119 | } else { |
| 120 | var errorLine string |
| 121 | if m.err != nil { |
| 122 | errorLine = lipgloss.NewStyle().Foreground(Colors.Error).Width(m.width).Align(lipgloss.Center).Render(docker.ErrorMessage(m.err)) |
| 123 | } |
| 124 | contentView = lipgloss.JoinVertical(lipgloss.Center, errorLine, "", m.confirmation.View()) |
| 125 | } |
| 126 | |
| 127 | var helpLine string |
| 128 | if !m.removing { |
| 129 | helpLine = Styles.CenteredLine(m.width, m.help.View()) |
| 130 | } |
| 131 | |
| 132 | titleHeight := 2 // title + blank line |
| 133 | helpHeight := lipgloss.Height(helpLine) |
| 134 | middleHeight := m.height - titleHeight - helpHeight |
| 135 | |
| 136 | centeredContent := lipgloss.Place( |
| 137 | m.width, |
| 138 | middleHeight, |
| 139 | lipgloss.Center, |
| 140 | lipgloss.Center, |
| 141 | contentView, |
| 142 | ) |
| 143 | |
| 144 | return titleLine + "\n\n" + centeredContent + helpLine |
| 145 | } |
| 146 | |
| 147 | // Private |
| 148 |
nothing calls this directly
no test coverage detected