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

Method renderHeader

internal/tui/dashboard.go:158–194  ·  view source on GitHub ↗

renderHeader renders the header with branding, state, iteration, and elapsed time.

()

Source from the content-addressed store, hash-verified

156
157// renderHeader renders the header with branding, state, iteration, and elapsed time.
158func (a *App) renderHeader() string {
159 // Branding
160 brand := headerStyle.Render("chief")
161
162 // State indicator - use the centralized style system
163 stateStyle := GetStateStyle(a.state)
164 state := stateStyle.Render(fmt.Sprintf("[%s]", a.state.String()))
165
166 // Iteration count (current/max)
167 iteration := SubtitleStyle.Render(fmt.Sprintf("Iteration: %d/%d", a.iteration, a.maxIter))
168
169 // Elapsed time
170 elapsed := a.GetElapsedTime()
171 elapsedStr := SubtitleStyle.Render(fmt.Sprintf("Time: %s", formatDuration(elapsed)))
172
173 // Combine elements
174 leftPart := lipgloss.JoinHorizontal(lipgloss.Center, brand, " ", state)
175 rightPart := lipgloss.JoinHorizontal(lipgloss.Center, iteration, " ", elapsedStr)
176
177 // Create the full header line with proper spacing
178 spacing := strings.Repeat(" ", max(0, a.width-lipgloss.Width(leftPart)-lipgloss.Width(rightPart)-2))
179 headerLine := lipgloss.JoinHorizontal(lipgloss.Center, leftPart, spacing, rightPart)
180
181 // Tab bar
182 tabBarLine := a.renderTabBar()
183
184 // Worktree info line (only shown when branch is set)
185 worktreeInfoLine := a.renderWorktreeInfoLine()
186
187 // Add a border below
188 border := DividerStyle.Render(strings.Repeat("─", a.width))
189
190 if worktreeInfoLine != "" {
191 return lipgloss.JoinVertical(lipgloss.Left, headerLine, tabBarLine, worktreeInfoLine, border)
192 }
193 return lipgloss.JoinVertical(lipgloss.Left, headerLine, tabBarLine, border)
194}
195
196// renderTabBar renders the PRD tab bar.
197func (a *App) renderTabBar() string {

Callers 1

renderDashboardMethod · 0.95

Calls 8

GetElapsedTimeMethod · 0.95
renderTabBarMethod · 0.95
GetStateStyleFunction · 0.85
formatDurationFunction · 0.85
maxFunction · 0.85
RenderMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected