Skip to content

Commit

Permalink
Show Parts of the Legend per default (#181)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix T.J. Dietrich <[email protected]>
Co-authored-by: Felix T.J. Dietrich <[email protected]>
  • Loading branch information
3 people authored Nov 20, 2024
1 parent b79417b commit 1222ea7
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 47 deletions.
62 changes: 28 additions & 34 deletions webapp/src/app/home/leaderboard/legend/legend.component.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
<div hlmCard>
<div class="flex items-center group hover:cursor-pointer" (click)="toggleOpen()">
<div hlmCardHeader class="flex-1">
<h3 hlmCardTitle class="group-hover:underline">Leaderboard Legend</h3>
<p hlmCardDescription class="group-hover:underline">Explanation of the most important elements</p>
</div>
<div class="flex items-center gap-2 px-6">
@if (open()) {
<hlm-icon name="lucideChevronsUp" />
} @else {
<hlm-icon name="lucideChevronsDown" />
}
</div>
</div>
<div hlmCardContent [class]="contentClass()">
<div hlmCardContent class="flex flex-col gap-y-4 pb-0">
<div class="flex flex-col gap-2 sm:min-w-[250px]">
<h4 class="font-medium mb-2">Icons</h4>
<h4 class="mb-2 text-lg font-semibold leading-none tracking-tight">Icons</h4>
<div class="flex items-center gap-2 text-github-muted-foreground">
<ng-icon [svg]="octGitPullRequest" size="16" />
Reviewed pull requests
Expand All @@ -35,25 +22,32 @@ <h4 class="font-medium mb-2">Icons</h4>
<ng-icon [svg]="octCommentDiscussion" size="16" />
Code comments
</div>
</div>
<div class="max-w-[500px]">
<h4 class="font-medium mb-2">Scoring System</h4>
<p class="text-sm text-github-muted-foreground">
The score approximates your contribution activity by evaluating your review interactions and the complexity of the pull requests you've reviewed.
<span class="font-semibold">Change requests are valued highest</span>, followed by approvals and comments. The score increases with the number of review interactions. Pull
request complexity &mdash; based on factors like changed files, commits, additions, and deletions &mdash; also enhances your score;
<span class="font-semibold">more complex pull requests contribute more</span>. The final score balances your interactions with the complexity of the work reviewed,
highlighting both your engagement and the difficulty of the tasks you've undertaken. This score reflects your impact but does not directly measure time invested or work
quality.
<a
hlmBtn
variant="link"
size="none"
href="https://github.com/ls1intum/Hephaestus/blob/961614388f7860319a076089be0095190bf20a71/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardService.java#L160"
>
[source]
</a>
</p>
<div hlmAccordion>
<div hlmAccordionItem class="border-none">
<button hlmAccordionTrigger>
Scoring system
<hlm-icon hlmAccIcon />
</button>
<hlm-accordion-content class="max-w-xl">
<p class="text-sm text-github-muted-foreground">
The score approximates your contribution activity by evaluating your review interactions and the complexity of the pull requests you've reviewed.
<span class="font-semibold">Change requests are valued highest</span>, followed by approvals and comments. The score increases with the number of review interactions.
Pull request complexity &mdash; based on factors like changed files, commits, additions, and deletions &mdash; also enhances your score;
<span class="font-semibold">more complex pull requests contribute more</span>. The final score balances your interactions with the complexity of the work reviewed,
highlighting both your engagement and the difficulty of the tasks you've undertaken. This score reflects your impact but does not directly measure time invested or
work quality.
<a
hlmBtn
variant="link"
size="none"
href="https://github.com/ls1intum/Hephaestus/blob/961614388f7860319a076089be0095190bf20a71/server/application-server/src/main/java/de/tum/in/www1/hephaestus/leaderboard/LeaderboardService.java#L160"
>
[source]
</a>
</p>
</hlm-accordion-content>
</div>
</div>
</div>
</div>
</div>
32 changes: 19 additions & 13 deletions webapp/src/app/home/leaderboard/legend/legends.component.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
import { Component, computed, input, signal } from '@angular/core';
import { Component, input } from '@angular/core';
import { NgIconComponent } from '@ng-icons/core';
import { octFileDiff, octCheck, octComment, octCommentDiscussion, octGitPullRequest } from '@ng-icons/octicons';
import { HlmIconComponent } from '@spartan-ng/ui-icon-helm';
import { HlmCardModule } from '@spartan-ng/ui-card-helm';
import { provideIcons } from '@spartan-ng/ui-icon-helm';
import { lucideChevronsDown, lucideChevronsUp } from '@ng-icons/lucide';
import { cn } from '@app/utils';
import { HlmButtonDirective } from '@spartan-ng/ui-button-helm';
import {
HlmAccordionContentComponent,
HlmAccordionDirective,
HlmAccordionIconDirective,
HlmAccordionItemDirective,
HlmAccordionTriggerDirective
} from '@spartan-ng/ui-accordion-helm';

@Component({
selector: 'app-leaderboard-legend',
standalone: true,
imports: [HlmCardModule, NgIconComponent, HlmIconComponent, HlmButtonDirective],
providers: [provideIcons({ lucideChevronsDown, lucideChevronsUp })],
imports: [
HlmAccordionDirective,
HlmAccordionItemDirective,
HlmAccordionTriggerDirective,
HlmAccordionContentComponent,
HlmAccordionIconDirective,
HlmCardModule,
NgIconComponent,
HlmIconComponent,
HlmButtonDirective
],
templateUrl: './legend.component.html'
})
export class LeaderboardLegendComponent {
Expand All @@ -23,11 +36,4 @@ export class LeaderboardLegendComponent {
protected octGitPullRequest = octGitPullRequest;

isLoading = input<boolean>();
open = signal(false);

contentClass = computed(() => cn('flex flex-wrap gap-y-4 gap-x-8 pt-2', { hidden: !this.open() }));

toggleOpen() {
this.open.set(!this.open());
}
}

0 comments on commit 1222ea7

Please sign in to comment.