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

Method renderNarrowDiffHeader

internal/tui/dashboard.go:862–890  ·  view source on GitHub ↗

renderNarrowDiffHeader renders a condensed header for the diff view in narrow mode.

()

Source from the content-addressed store, hash-verified

860
861// renderNarrowDiffHeader renders a condensed header for the diff view in narrow mode.
862func (a *App) renderNarrowDiffHeader() string {
863 brand := headerStyle.Render("chief")
864
865 viewLabel := "[Diff]"
866 if a.diffViewer.storyID != "" {
867 viewLabel = fmt.Sprintf("[%s]", a.diffViewer.storyID)
868 }
869 viewIndicator := lipgloss.NewStyle().
870 Foreground(PrimaryColor).
871 Bold(true).
872 Render(viewLabel)
873
874 stateStyle := GetStateStyle(a.state)
875 state := stateStyle.Render(fmt.Sprintf("[%s]", a.state.String()))
876
877 leftPart := lipgloss.JoinHorizontal(lipgloss.Center, brand, " ", viewIndicator, " ", state)
878
879 var rightPart string
880 if len(a.diffViewer.lines) > 0 {
881 rightPart = SubtitleStyle.Render(fmt.Sprintf("%d lines", len(a.diffViewer.lines)))
882 }
883
884 spacing := strings.Repeat(" ", max(0, a.width-lipgloss.Width(leftPart)-lipgloss.Width(rightPart)-2))
885 headerLine := lipgloss.JoinHorizontal(lipgloss.Center, leftPart, spacing, rightPart)
886
887 border := DividerStyle.Render(strings.Repeat("─", a.width))
888
889 return lipgloss.JoinVertical(lipgloss.Left, headerLine, border)
890}
891
892// renderLogView renders the full-screen log view.
893func (a *App) renderLogView() string {

Callers 1

renderDiffViewMethod · 0.95

Calls 4

GetStateStyleFunction · 0.85
maxFunction · 0.85
RenderMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected