Change summary
internal/tui/bubbles/git/about/bubble.go | 6 +++++-
internal/tui/bubbles/git/tree/bubble.go | 1 +
internal/tui/style/style.go | 12 ++++++++++++
3 files changed, 18 insertions(+), 1 deletion(-)
Detailed changes
@@ -88,7 +88,11 @@ func (b *Bubble) Help() []types.HelpEntry {
func (b *Bubble) glamourize() (string, error) {
w := b.width - b.widthMargin - b.styles.RepoBody.GetHorizontalFrameSize()
- return types.Glamourize(w, b.repo.GetReadme())
+ rm := b.repo.GetReadme()
+ if rm == "" {
+ return b.styles.AboutNoReadme.Render("No readme found."), nil
+ }
+ return types.Glamourize(w, rm)
}
func (b *Bubble) setupCmd() tea.Msg {
@@ -142,6 +142,7 @@ func NewBubble(repo types.Repo, styles *style.Styles, width, widthMargin, height
l.DisableQuitKeybindings()
l.KeyMap.NextPage = types.NextPage
l.KeyMap.PrevPage = types.PrevPage
+ l.Styles.NoItems = styles.TreeNoItems
b := &Bubble{
fileViewport: &vp.ViewportBubble{
Viewport: &viewport.Model{},
@@ -40,6 +40,8 @@ type Styles struct {
ErrorTitle lipgloss.Style
ErrorBody lipgloss.Style
+ AboutNoReadme lipgloss.Style
+
LogItemSelector lipgloss.Style
LogItemActive lipgloss.Style
LogItemInactive lipgloss.Style
@@ -67,6 +69,8 @@ type Styles struct {
TreeFileMode lipgloss.Style
TreeFileSize lipgloss.Style
TreeFileContent lipgloss.Style
+ TreePaginator lipgloss.Style
+ TreeNoItems lipgloss.Style
Spinner lipgloss.Style
}
@@ -193,6 +197,10 @@ func DefaultStyles() *Styles {
MarginLeft(2).
Width(52) // for now
+ s.AboutNoReadme = lipgloss.NewStyle().
+ MarginLeft(1).
+ Foreground(lipgloss.Color("#626262"))
+
s.LogItemInactive = lipgloss.NewStyle().
MarginLeft(1)
@@ -262,6 +270,10 @@ func DefaultStyles() *Styles {
s.TreeFileContent = lipgloss.NewStyle()
+ s.TreePaginator = s.LogPaginator.Copy()
+
+ s.TreeNoItems = s.AboutNoReadme.Copy()
+
s.Spinner = lipgloss.NewStyle().
MarginLeft(1).
Foreground(lipgloss.Color("205"))