()
| 238 | } |
| 239 | |
| 240 | func (m Dashboard) View() string { |
| 241 | titleLine := Styles.TitleRule(m.width, m.hostname) |
| 242 | |
| 243 | helpView := m.help.View() |
| 244 | helpLine := Styles.CenteredLine(m.width, helpView) |
| 245 | |
| 246 | headerView := m.header.View(m.width) |
| 247 | |
| 248 | if len(m.apps) == 0 { |
| 249 | emptyMsg := lipgloss.NewStyle().Foreground(Colors.Border).Render("There are no applications installed") |
| 250 | headerH := m.header.Height(m.width) |
| 251 | if headerH > 0 { |
| 252 | headerH += 2 |
| 253 | } |
| 254 | middleHeight := m.height - 1 - headerH - 1 // title + header + help |
| 255 | centeredContent := lipgloss.Place(m.width, middleHeight, lipgloss.Center, lipgloss.Center, emptyMsg) |
| 256 | if headerView != "" { |
| 257 | return titleLine + "\n\n" + headerView + "\n" + centeredContent + "\n" + helpLine |
| 258 | } |
| 259 | return titleLine + "\n" + centeredContent + "\n" + helpLine |
| 260 | } |
| 261 | |
| 262 | var parts []string |
| 263 | parts = append(parts, titleLine) |
| 264 | if headerView != "" { |
| 265 | parts = append(parts, "", headerView, "") |
| 266 | } |
| 267 | parts = append(parts, m.viewport.View()) |
| 268 | if m.toggling { |
| 269 | parts = append(parts, m.progress.View()) |
| 270 | } |
| 271 | parts = append(parts, helpLine) |
| 272 | content := strings.Join(parts, "\n") |
| 273 | |
| 274 | if m.overlay != nil { |
| 275 | return OverlayCenter(content, m.overlay.View(), m.width, m.height) |
| 276 | } |
| 277 | |
| 278 | return content |
| 279 | } |
| 280 | |
| 281 | // Private |
| 282 |
nothing calls this directly
no test coverage detected