-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ui): update the PR view diff changes summary #295
Conversation
658594c
to
f1e0ef6
Compare
1191a92
to
6605fb9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great thank you! <3
ui/components/pr/pr.go
Outdated
return pr.getTextStyle().Render( | ||
components.KeepSameSpacesOnAddDeletions( | ||
fmt.Sprintf( | ||
"\033[32m+%s \033[31m-%s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use lipgloss
for this. Specifically lipgloss.NewStyle().Foreground(lipgloss.Color("1"))
and then use lipgloss.JoinHorizontal()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review @dlvhdr
i updated the method like this :
func (pr *PullRequest) renderLines() string {
deletions := 0
if pr.Data.Deletions > 0 {
deletions = pr.Data.Deletions
}
greenStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("2"))
redStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("1"))
greenText := greenStyle.Render("+" + components.FormatNumber(pr.Data.Additions))
redText := redStyle.Render("-" + components.FormatNumber(deletions))
return pr.getTextStyle().Render(
components.KeepSameSpacesOnAddDeletions(
lipgloss.JoinHorizontal(lipgloss.Top, greenText, redText),
),
)
}
but am having an output not "fine" for the redText :
Any tips ? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not near a computer right now but look at the code, there are other instances where I applied the "selected" background again. When you create a style you lose the bg the cell previously had, so you need to reapply it.
@Sanix-Darker I fixed the issue, also see the open issue on lipgloss for reference: charmbracelet/lipgloss#144 |
looks amazing @dlvhdr , thank you so much ! |
Summary
UI changes proposal on +/- with colors like the view we have on github.
How did you test this change?
On my Ubuntu Os 20.04 , tmux, under allacrity.
Images/Videos
BEFORE
AFTER
NOTE