renderNarrowDiffHeader renders a condensed header for the diff view in narrow mode.
()
| 860 | |
| 861 | // renderNarrowDiffHeader renders a condensed header for the diff view in narrow mode. |
| 862 | func (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. |
| 893 | func (a *App) renderLogView() string { |
no test coverage detected