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

Method renderCleanResult

internal/tui/picker.go:950–999  ·  view source on GitHub ↗

renderCleanResult renders the clean result dialog.

(modalWidth, modalHeight int)

Source from the content-addressed store, hash-verified

948
949// renderCleanResult renders the clean result dialog.
950func (p *PRDPicker) renderCleanResult(modalWidth, modalHeight int) string {
951 var content strings.Builder
952
953 if p.cleanResult.Success {
954 titleStyle := lipgloss.NewStyle().
955 Bold(true).
956 Foreground(SuccessColor).
957 Padding(0, 1)
958 content.WriteString(titleStyle.Render("Clean Successful"))
959 } else {
960 titleStyle := lipgloss.NewStyle().
961 Bold(true).
962 Foreground(ErrorColor).
963 Padding(0, 1)
964 content.WriteString(titleStyle.Render("Clean Failed"))
965 }
966 content.WriteString("\n")
967 content.WriteString(DividerStyle.Render(strings.Repeat("─", modalWidth-4)))
968 content.WriteString("\n\n")
969
970 msgStyle := lipgloss.NewStyle().
971 Foreground(TextColor).
972 Padding(0, 1)
973 content.WriteString(msgStyle.Render(p.cleanResult.Message))
974 content.WriteString("\n")
975
976 // Footer
977 content.WriteString("\n")
978 content.WriteString(DividerStyle.Render(strings.Repeat("─", modalWidth-4)))
979 content.WriteString("\n")
980 footerStyle := lipgloss.NewStyle().
981 Foreground(MutedColor).
982 Padding(0, 1)
983 content.WriteString(footerStyle.Render("Press any key to continue"))
984
985 // Modal box style
986 borderColor := SuccessColor
987 if !p.cleanResult.Success {
988 borderColor = ErrorColor
989 }
990 modalStyle := lipgloss.NewStyle().
991 Border(lipgloss.RoundedBorder()).
992 BorderForeground(borderColor).
993 Padding(1, 2).
994 Width(modalWidth).
995 Height(modalHeight)
996
997 modal := modalStyle.Render(content.String())
998 return p.centerModal(modal)
999}
1000
1001// centerModal centers the modal on the screen.
1002func (p *PRDPicker) centerModal(modal string) string {

Callers 1

RenderMethod · 0.95

Calls 3

centerModalMethod · 0.95
RenderMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected