Render renders the completion screen with confetti background.
()
| 170 | |
| 171 | // Render renders the completion screen with confetti background. |
| 172 | func (c *CompletionScreen) Render() string { |
| 173 | modalWidth := min(70, c.width-6) |
| 174 | if modalWidth < 30 { |
| 175 | modalWidth = 30 |
| 176 | } |
| 177 | |
| 178 | // Inner content width (inside padding and border) |
| 179 | innerWidth := modalWidth - 6 // 2 padding each side + 2 border |
| 180 | |
| 181 | var content strings.Builder |
| 182 | |
| 183 | // Header |
| 184 | headerStyle := lipgloss.NewStyle(). |
| 185 | Bold(true). |
| 186 | Foreground(SuccessColor) |
| 187 | content.WriteString(headerStyle.Render("🎉 PRD Complete!")) |
| 188 | content.WriteString("\n") |
| 189 | |
| 190 | // Subtitle |
| 191 | subtitleStyle := lipgloss.NewStyle().Foreground(TextColor) |
| 192 | prdTitle := formatPRDTitle(c.prdName) |
| 193 | content.WriteString(subtitleStyle.Render(fmt.Sprintf("%s — %d/%d stories", prdTitle, c.completed, c.total))) |
| 194 | content.WriteString("\n") |
| 195 | content.WriteString(DividerStyle.Render(strings.Repeat("─", innerWidth))) |
| 196 | content.WriteString("\n") |
| 197 | |
| 198 | // Total duration |
| 199 | if c.totalDuration > 0 { |
| 200 | content.WriteString("\n") |
| 201 | durationStyle := lipgloss.NewStyle().Foreground(SuccessColor) |
| 202 | content.WriteString(durationStyle.Render(fmt.Sprintf("Completed in %s", formatDuration(c.totalDuration)))) |
| 203 | content.WriteString("\n") |
| 204 | } |
| 205 | |
| 206 | // Per-story timings |
| 207 | if len(c.storyTimings) > 0 { |
| 208 | content.WriteString("\n") |
| 209 | content.WriteString(c.renderStoryTimings(innerWidth)) |
| 210 | } |
| 211 | |
| 212 | // Branch and commit info (combined to single line) |
| 213 | content.WriteString("\n") |
| 214 | if c.branch != "" { |
| 215 | infoStyle := lipgloss.NewStyle().Foreground(TextColor) |
| 216 | commitLabel := "commit" |
| 217 | if c.commitCount != 1 { |
| 218 | commitLabel = "commits" |
| 219 | } |
| 220 | content.WriteString(infoStyle.Render(fmt.Sprintf("Branch: %s • %d %s", c.branch, c.commitCount, commitLabel))) |
| 221 | content.WriteString("\n") |
| 222 | } |
| 223 | |
| 224 | // Auto-actions progress or hint |
| 225 | if c.pushState != AutoActionIdle || c.prState != AutoActionIdle { |
| 226 | content.WriteString(c.renderAutoActions(innerWidth)) |
| 227 | } else if !c.hasAutoActions { |
| 228 | hintStyle := lipgloss.NewStyle().Foreground(MutedColor) |
| 229 | content.WriteString(hintStyle.Render("Configure auto-push and PR in settings (,)")) |