renderHeader renders the header with branding, state, iteration, and elapsed time.
()
| 156 | |
| 157 | // renderHeader renders the header with branding, state, iteration, and elapsed time. |
| 158 | func (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. |
| 197 | func (a *App) renderTabBar() string { |
no test coverage detected