Skip to content

Commit

Permalink
Add Pull request status (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
itupix authored May 29, 2020
1 parent 1e4a462 commit a1d07db
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 29 deletions.
5 changes: 5 additions & 0 deletions src/components/Pullrequest/Pullrequest.scss
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@
border-color: red;
color: red;
}

&--auto-complete {
border-color: green;
color: green;
}
}

@media (prefers-color-scheme: dark) {
Expand Down
42 changes: 13 additions & 29 deletions src/components/Pullrequest/Pullrequest.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,6 @@
const openUrl = () => shell.openExternal(makeUrl(pullRequest));
const hasStatusLabel = pullrequest => (pullrequest.mergeStatus && pullrequest.mergeStatus === "conflicts") || pullrequest.isDraft;
const getStatusLabel = pullrequest => {
if (pullrequest.mergeStatus && pullrequest.mergeStatus === "conflicts") {
return 'Conflicts';
}
if (pullrequest.isDraft) {
return 'Draft';
}
return '';
}
const getStatusStyle = pullrequest => {
if (pullrequest.mergeStatus && pullrequest.mergeStatus === "conflicts") {
return '--conflicts';
}
if (pullrequest.isDraft) {
return '--draft';
}
return '';
}
const getAvatarUrl = pr => getAvatar(pr.createdBy.id, pr.organizationName, pr.createdBy.descriptor);
const getTime = pullrequest => {
Expand Down Expand Up @@ -100,9 +74,19 @@
<span>{pullRequest.repository.project.name}</span>
</h2>
<h3 class="skz-pullrequest__title">
{#if hasStatusLabel(pullRequest)}
<span class="skz-pullrequest__status skz-pullrequest__status{getStatusStyle(pullRequest)}">
{getStatusLabel(pullRequest)}
{#if pullRequest.autoCompleteSetBy}
<span class="skz-pullrequest__status skz-pullrequest__status--auto-complete">
Auto complete
</span>
{/if}
{#if pullRequest.isDraft}
<span class="skz-pullrequest__status skz-pullrequest__status--draft">
Draft
</span>
{/if}
{#if pullRequest.mergeStatus && pullRequest.mergeStatus === 'conflicts'}
<span class="skz-pullrequest__status skz-pullrequest__status--conflicts">
Conflicts
</span>
{/if}
{pullRequest.title}
Expand Down

0 comments on commit a1d07db

Please sign in to comment.