Skip to content

Commit

Permalink
Improve commit status icons
Browse files Browse the repository at this point in the history
- Show them on hover/focus (tippy default) instead of click
- If there is only one status, add href to trigger element
- Increase tippy interactiveBorder, making it easier to keep interactive
  tooltips open with sloppy mouse movement
- Fix a overflow issue in the commit list
  • Loading branch information
silverwind committed Sep 9, 2022
1 parent b5d21c0 commit 9946d31
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion templates/repo/commit_statuses.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a class="ui link commit-statuses-trigger vm">{{template "repo/commit_status" .Status}}</a>
<a class="ui link commit-statuses-trigger vm"{{if eq (len .Statuses) 1}}{{$status := index .Statuses 0}}{{if $status.TargetURL}} href="{{$status.TargetURL}}"{{end}}{{end}}>{{template "repo/commit_status" .Status}}</a>
<div class="ui commit-statuses-popup commit-statuses tippy-target">
<div class="ui relaxed list divided">
{{range .Statuses}}
Expand Down
1 change: 0 additions & 1 deletion web_src/js/features/repo-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export function initCommitStatuses() {
const top = $('.repository.file.list').length > 0 || $('.repository.diff').length > 0;

createTippy(this, {
trigger: 'click',
content: this.nextElementSibling,
placement: top ? 'top-start' : 'bottom-start',
interactive: true,
Expand Down
1 change: 1 addition & 0 deletions web_src/js/modules/tippy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export function createTippy(target, opts = {}) {
placement: target.getAttribute('data-placement') || 'top-start',
animation: false,
allowHTML: false,
interactiveBorder: 30,
maxWidth: 500, // increase over default 350px
arrow: `<svg width="16" height="7"><path d="m0 7 8-7 8 7Z" class="tippy-svg-arrow-outer"/><path d="m0 8 8-7 8 7Z" class="tippy-svg-arrow-inner"/></svg>`,
...(opts?.role && {theme: opts.role}),
Expand Down
5 changes: 5 additions & 0 deletions web_src/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -2827,6 +2827,11 @@ tbody.commit-list {
vertical-align: middle;
}

// in the commit list, messages can wrap so we can use inline
.commit-list .message-wrapper {
display: inline;
}

@media @mediaSm {
tr.commit-list {
width: 100%;
Expand Down

0 comments on commit 9946d31

Please sign in to comment.