MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / renderDashboard

Method renderDashboard

internal/tui/dashboard.go:30–70  ·  view source on GitHub ↗

renderDashboard renders the full dashboard view.

()

Source from the content-addressed store, hash-verified

28
29// renderDashboard renders the full dashboard view.
30func (a *App) renderDashboard() string {
31 if a.width == 0 || a.height == 0 {
32 return "Loading..."
33 }
34
35 // Use stacked layout for narrow terminals
36 if a.isNarrowMode() {
37 return a.renderStackedDashboard()
38 }
39
40 header := a.renderHeader()
41
42 // Hide footer when terminal height < 12
43 fh := footerHeight
44 var footer string
45 if a.height < 12 {
46 fh = 0
47 footer = ""
48 } else {
49 footer = a.renderFooter()
50 }
51
52 // Calculate content area height
53 contentHeight := a.height - a.effectiveHeaderHeight() - fh - 2 // -2 for panel borders
54
55 // Render panels
56 storiesWidth := (a.width * storiesPanelPct / 100) - 2
57 detailsWidth := a.width - storiesWidth - 4 // -4 for borders and gap
58
59 storiesPanel := a.renderStoriesPanel(storiesWidth, contentHeight)
60 detailsPanel := a.renderDetailsPanel(detailsWidth, contentHeight)
61
62 // Join panels horizontally
63 content := lipgloss.JoinHorizontal(lipgloss.Top, storiesPanel, detailsPanel)
64
65 // Stack header, content, and footer
66 if footer == "" {
67 return lipgloss.JoinVertical(lipgloss.Left, header, content)
68 }
69 return lipgloss.JoinVertical(lipgloss.Left, header, content, footer)
70}
71
72// renderStackedDashboard renders the dashboard with stacked layout for narrow terminals.
73func (a *App) renderStackedDashboard() string {

Callers 4

ViewMethod · 0.95
renderPickerViewMethod · 0.95

Calls 7

isNarrowModeMethod · 0.95
renderHeaderMethod · 0.95
renderFooterMethod · 0.95
effectiveHeaderHeightMethod · 0.95
renderStoriesPanelMethod · 0.95
renderDetailsPanelMethod · 0.95