Skip to content

Commit

Permalink
feat(ui): show committer in blame
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Oct 31, 2023
1 parent 29de922 commit 56a17a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/ui/pages/repo/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,11 @@ func renderBlame(c common.Common, f *FileItem, b *gitm.Blame) string {
if commit == nil {
break
}
line := fmt.Sprintf("%s %s",
who := fmt.Sprintf("%s <%s>", commit.Author.Name, commit.Author.Email)
line := fmt.Sprintf("%s %s %s",
c.Styles.Tree.Blame.Hash.Render(commit.ID.String()[:7]),
c.Styles.Tree.Blame.Message.Render(commit.Summary()),
c.Styles.Tree.Blame.Who.Render(who),
)
if line != prev {
lines = append(lines, line)
Expand Down
4 changes: 4 additions & 0 deletions pkg/ui/styles/styles.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ type Styles struct {
Blame struct {
Hash lipgloss.Style
Message lipgloss.Style
Who lipgloss.Style
}
}

Expand Down Expand Up @@ -446,6 +447,9 @@ func DefaultStyles() *Styles {

s.Tree.Blame.Message = lipgloss.NewStyle()

s.Tree.Blame.Who = lipgloss.NewStyle().
Faint(true)

s.Spinner = lipgloss.NewStyle().
MarginTop(1).
MarginLeft(2).
Expand Down

0 comments on commit 56a17a3

Please sign in to comment.