-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#82: update naming, add more details to appIssueCard
- Loading branch information
Showing
6 changed files
with
74 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
webapp/src/app/ui/app-issue-card/app-issue-card.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<div class="border border-gray-300 rounded-lg p-4 w-72"> | ||
<div class="flex justify-between items-center mb-2 text-xs text-gray-500"> | ||
<span class="font-bold flex justify-center items-center space-x-1"> | ||
<ng-icon [svg]="octGitPullRequest" size="16" class="mr-1"></ng-icon> {{ pullRequest().repository.name }} #{{ pullRequest().number }} on {{ pullRequest().createdAt }} | ||
</span> | ||
<span class="flex items-center space-x-2"> | ||
<span class="text-github-success-foreground font-bold">+{{ pullRequest().additions }}</span> | ||
<span class="text-github-danger-foreground font-bold">-{{ pullRequest().deletions }}</span> | ||
</span> | ||
</div> | ||
|
||
<div class="flex justify-between font-bold text-sm mb-3"> | ||
{{ pullRequest().title }} | ||
@if (getMostRecentReview(); as review) { | ||
@if(review.state === 'APPROVED') { | ||
<ng-icon [svg]="octCheck" size="16"></ng-icon> | ||
} @else if(review.state === 'DISMISSED') { | ||
<ng-icon [svg]="octX" size="16"></ng-icon> | ||
} @else if (review.state === 'COMMENTED') { | ||
<ng-icon [svg]="octComment" size="16"></ng-icon> | ||
} @else { | ||
<ng-icon [svg]="octFileDiff" size="16"></ng-icon> | ||
} | ||
} | ||
</div> | ||
<div class="flex gap-1 flex-wrap"> | ||
@for (label of pullRequest().pullRequestLabels; track label.name) { | ||
<span class="px-2 py-1 rounded-full text-xs text-white mr-2" [style.background-color]="label.color">{{ label.name }}</span> | ||
} | ||
</div> | ||
</div> |
30 changes: 30 additions & 0 deletions
30
webapp/src/app/ui/app-issue-card/app-issue-card.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Component, input } from '@angular/core'; | ||
import { PullRequest, PullRequestReview } from '@app/core/modules/openapi'; | ||
import { NgIcon } from '@ng-icons/core'; | ||
import { octCheck, octComment, octFileDiff, octGitPullRequest, octX } from '@ng-icons/octicons'; | ||
|
||
@Component({ | ||
selector: 'app-issue-card', | ||
templateUrl: './app-issue-card.component.html', | ||
imports: [NgIcon], | ||
standalone: true | ||
}) | ||
export class AppIssueCardComponent { | ||
pullRequest = input.required<PullRequest>(); | ||
protected readonly octCheck = octCheck; | ||
protected readonly octX = octX; | ||
protected readonly octComment = octComment; | ||
protected readonly octGitPullRequest = octGitPullRequest; | ||
|
||
getMostRecentReview() { | ||
if (!this.pullRequest() || !this.pullRequest().reviews) { | ||
return null; | ||
} | ||
|
||
return Array.from(this.pullRequest().reviews || []).reduce((latest: PullRequestReview, review: PullRequestReview) => { | ||
return new Date(review.updatedAt || 0) > new Date(latest.updatedAt || 0) ? review : latest; | ||
}); | ||
} | ||
|
||
protected readonly octFileDiff = octFileDiff; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
webapp/src/app/ui/pull-request-widget/pull-request-widget.component.html
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
webapp/src/app/ui/pull-request-widget/pull-request-widget.component.ts
This file was deleted.
Oops, something went wrong.