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

Method renderProgressBar

internal/tui/dashboard.go:666–689  ·  view source on GitHub ↗

renderProgressBar renders a progress bar showing completion percentage.

(width int)

Source from the content-addressed store, hash-verified

664
665// renderProgressBar renders a progress bar showing completion percentage.
666func (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.
692func formatDuration(d time.Duration) string {

Callers 1

renderStoriesPanelMethod · 0.95

Calls 2

RenderMethod · 0.45

Tested by

no test coverage detected