Skip to content
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

Pull request status #23

Merged
merged 2 commits into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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