-
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.
Leaderboard component and homepage (#78)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Felix T.J. Dietrich <[email protected]>
- Loading branch information
1 parent
84d59a4
commit eef2dfa
Showing
23 changed files
with
459 additions
and
17 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
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
5 changes: 5 additions & 0 deletions
5
.../application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/user/UserType.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,5 @@ | ||
package de.tum.in.www1.hephaestus.codereview.user; | ||
|
||
public enum UserType { | ||
USER, BOT | ||
} |
21 changes: 19 additions & 2 deletions
21
...lication-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardEntry.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 |
---|---|---|
@@ -1,8 +1,25 @@ | ||
package de.tum.in.www1.hephaestus.leaderboard; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import de.tum.in.www1.hephaestus.codereview.user.UserType; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
public record LeaderboardEntry(String githubName, String name, int score, int total, int changesRequested, | ||
int approvals, int comments) { | ||
@AllArgsConstructor | ||
@Getter | ||
@Setter | ||
@ToString | ||
public class LeaderboardEntry { | ||
private String githubName; | ||
private String avatarUrl; | ||
private String name; | ||
private UserType type; | ||
private int score; | ||
private int rank; | ||
private int changesRequested; | ||
private int approvals; | ||
private int comments; | ||
} |
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,6 @@ | ||
{ | ||
"tailwindCSS.experimental.classRegex": ["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]", "cn\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"], | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": "explicit" | ||
} | ||
} |
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
57 changes: 57 additions & 0 deletions
57
webapp/src/app/components/leaderboard/leaderboard.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,57 @@ | ||
<div class="flex flex-col gap-4 py-8"> | ||
<h1 class="text-3xl font-bold">Artemis Leaderboard</h1> | ||
@if (query.isPending()) { | ||
<span class="text-muted-foreground">Data is loading...</span> | ||
} @else if (query.error()) { | ||
<span class="text-destructive">An error has occurred</span> | ||
} | ||
|
||
@if (leaderboard(); as leaderboard) { | ||
<div class="px-4"> | ||
<app-table> | ||
<thead appTableHeader> | ||
<tr appTableRow> | ||
<th appTableHead>Rank</th> | ||
<th appTableHead>Contributor</th> | ||
<th appTableHead>Score</th> | ||
<th appTableHead>Activity</th> | ||
</tr> | ||
</thead> | ||
<tbody appTableBody> | ||
@for (entry of leaderboard; track entry.githubName) { | ||
<tr appTableRow> | ||
<td appTableCell>{{ entry.rank }}</td> | ||
<td appTableCell> | ||
<a href="https://github.com/{{ entry.githubName }}" target="_blank" rel="noopener noreferrer" class="flex items-center gap-2 font-medium"> | ||
<img src="{{ entry.avatarUrl }}" width="24" height="24" /> | ||
<span class="text-muted-foreground">{{ entry.name }}</span> | ||
</a> | ||
</td> | ||
<td appTableCell>{{ entry.score }}</td> | ||
<td appTableCell class="flex items-center gap-4" title="Changes Requested"> | ||
@if (entry.changesRequested && entry.changesRequested > 0) { | ||
<div class="flex items-center gap-2"> | ||
<app-icon-pull-request-changes-requested /> | ||
{{ entry.changesRequested }} | ||
</div> | ||
} | ||
@if (entry.approvals && entry.approvals > 0) { | ||
<div class="flex items-center gap-2" title="Approvals"> | ||
<app-icon-pull-request-approved /> | ||
{{ entry.approvals }} | ||
</div> | ||
} | ||
@if (entry.comments && entry.comments > 0) { | ||
<div class="flex items-center gap-2" title="Comments"> | ||
<app-icon-pull-request-comment /> | ||
{{ entry.comments }} | ||
</div> | ||
} | ||
</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</app-table> | ||
</div> | ||
} | ||
</div> |
Oops, something went wrong.