-
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.
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
7b9c90c
commit cec2e16
Showing
13 changed files
with
198 additions
and
7 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
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
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
19 changes: 19 additions & 0 deletions
19
...rver/src/main/java/de/tum/in/www1/hephaestus/codereview/pullrequest/PullRequestLabel.java
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,19 @@ | ||
package de.tum.in.www1.hephaestus.codereview.pullrequest; | ||
|
||
import jakarta.persistence.Embeddable; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.NonNull; | ||
import lombok.Setter; | ||
|
||
@Embeddable | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
public class PullRequestLabel { | ||
@NonNull | ||
private String name; | ||
|
||
@NonNull | ||
private String color; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,37 @@ | ||
<div class="border border-border bg-card 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"> | ||
@if (state() === 'OPEN') { | ||
<ng-icon [svg]="octGitPullRequest" size="16" class="mr-1 text-github-success-foreground"></ng-icon> | ||
} @else { | ||
<ng-icon [svg]="octGitPullRequestClosed" size="16" class="mr-1 text-github-danger-foreground"></ng-icon> | ||
} | ||
|
||
{{ repositoryName() }} #{{ number() }} on {{ createdAt().format('MMM D') }} | ||
</span> | ||
<span class="flex items-center space-x-2"> | ||
<span class="text-github-success-foreground font-bold">+{{ additions() }}</span> | ||
<span class="text-github-danger-foreground font-bold">-{{ deletions() }}</span> | ||
</span> | ||
</div> | ||
|
||
<div class="flex justify-between font-bold text-sm mb-3 hover:text-github-accent-foreground cursor-pointer" (click)="openIssue()"> | ||
{{ title() }} | ||
@if (getMostRecentReview(); as review) { | ||
@if (review.state === 'APPROVED') { | ||
<ng-icon [svg]="octCheck" size="16" class="text-github-success-foreground"></ng-icon> | ||
} @else if (review.state === 'DISMISSED') { | ||
<ng-icon [svg]="octX" size="16" class="text-github-danger-foreground"></ng-icon> | ||
} @else if (review.state === 'COMMENTED') { | ||
<ng-icon [svg]="octComment" size="16" class="text-github-muted-foreground"></ng-icon> | ||
} @else { | ||
<ng-icon [svg]="octFileDiff" size="16" class="text-github-danger-foreground"></ng-icon> | ||
} | ||
} | ||
</div> | ||
<div class="flex gap-1 flex-wrap"> | ||
@for (label of pullRequestLabels(); track label.name) { | ||
<span class="px-2 py-1 rounded-full text-xs mr-2 text-neutral-100/95" [style.background-color]="label.color">{{ label.name }}</span> | ||
} | ||
</div> | ||
</div> |
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,41 @@ | ||
import { Component, input } from '@angular/core'; | ||
import { PullRequest, PullRequestLabel, PullRequestReview } from '@app/core/modules/openapi'; | ||
import { NgIcon } from '@ng-icons/core'; | ||
import { octCheck, octComment, octFileDiff, octGitPullRequest, octGitPullRequestClosed, octX } from '@ng-icons/octicons'; | ||
import { Dayjs } from 'dayjs'; | ||
import { NgStyle } from '@angular/common'; | ||
|
||
@Component({ | ||
selector: 'app-issue-card', | ||
templateUrl: './issue-card.component.html', | ||
imports: [NgIcon, NgStyle], | ||
standalone: true | ||
}) | ||
export class IssueCardComponent { | ||
title = input.required<string>(); | ||
number = input.required<number>(); | ||
additions = input.required<number>(); | ||
deletions = input.required<number>(); | ||
url = input.required<string>(); | ||
repositoryName = input.required<string>(); | ||
reviews = input.required<Array<PullRequestReview>>(); | ||
createdAt = input.required<Dayjs>(); | ||
state = input.required<PullRequest.StateEnum>(); | ||
pullRequestLabels = input.required<Array<PullRequestLabel>>(); | ||
protected readonly octCheck = octCheck; | ||
protected readonly octX = octX; | ||
protected readonly octComment = octComment; | ||
protected readonly octGitPullRequest = octGitPullRequest; | ||
protected readonly octFileDiff = octFileDiff; | ||
protected readonly octGitPullRequestClosed = octGitPullRequestClosed; | ||
|
||
getMostRecentReview() { | ||
return this.reviews().reduce((latest, review) => { | ||
return new Date(review.updatedAt || 0) > new Date(latest.updatedAt || 0) ? review : latest; | ||
}); | ||
} | ||
|
||
openIssue() { | ||
window.open(this.url()); | ||
} | ||
} |
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,40 @@ | ||
import { Meta, StoryObj } from '@storybook/angular'; | ||
import { IssueCardComponent } from './issue-card.component'; | ||
import dayjs from 'dayjs'; | ||
|
||
const meta: Meta<IssueCardComponent> = { | ||
title: 'Components/Core/IssueCard', | ||
component: IssueCardComponent, | ||
tags: ['autodocs'] // Auto-generate docs if enabled | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<IssueCardComponent>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
title: 'Add feature X', | ||
number: 12, | ||
additions: 10, | ||
deletions: 5, | ||
url: 'http://example.com', | ||
state: 'OPEN', | ||
repositoryName: 'Artemis', | ||
createdAt: dayjs('Jan 1'), | ||
pullRequestLabels: [ | ||
{ name: 'bug', color: 'red' }, | ||
{ name: 'enhancement', color: 'green' } | ||
], | ||
reviews: [ | ||
{ | ||
state: 'APPROVED', | ||
updatedAt: 'Jan 2' | ||
}, | ||
{ | ||
state: 'CHANGES_REQUESTED', | ||
updatedAt: 'Jan 4' | ||
} | ||
] | ||
} | ||
}; |
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
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
18 changes: 18 additions & 0 deletions
18
webapp/src/app/core/modules/openapi/model/pull-request-label.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,18 @@ | ||
/** | ||
* Hephaestus API | ||
* API documentation for the Hephaestus application server. | ||
* | ||
* The version of the OpenAPI document: 0.0.1 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
export interface PullRequestLabel { | ||
name?: string; | ||
color?: string; | ||
} | ||
|
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