renderProgressBar renders a progress bar showing completion percentage.
(width int)
| 664 | |
| 665 | // renderProgressBar renders a progress bar showing completion percentage. |
| 666 | func (a *App) renderProgressBar(width int) string { |
| 667 | percentage := a.GetCompletionPercentage() |
| 668 | completedStories := 0 |
| 669 | totalStories := len(a.prd.UserStories) |
| 670 | for _, s := range a.prd.UserStories { |
| 671 | if s.Passes { |
| 672 | completedStories++ |
| 673 | } |
| 674 | } |
| 675 | |
| 676 | // Calculate bar width |
| 677 | barWidth := width - 15 // Space for percentage and count |
| 678 | if barWidth < 10 { |
| 679 | barWidth = 10 |
| 680 | } |
| 681 | |
| 682 | filledWidth := int(float64(barWidth) * percentage / 100.0) |
| 683 | emptyWidth := barWidth - filledWidth |
| 684 | |
| 685 | bar := progressBarFillStyle.Render(strings.Repeat("█", filledWidth)) + |
| 686 | progressBarEmptyStyle.Render(strings.Repeat("░", emptyWidth)) |
| 687 | |
| 688 | return fmt.Sprintf("%s %3.0f%% %d/%d", bar, percentage, completedStories, totalStories) |
| 689 | } |
| 690 | |
| 691 | // formatDuration formats a duration in a human-readable way. |
| 692 | func formatDuration(d time.Duration) string { |
no test coverage detected