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

fix(openchallenges): fix challenge stats on OC challenge page #2324

Merged
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div *ngIf="challenge$ | async as challenge" class="stats-group">
<div *ngIf="challenge" class="stats-group">
<div class="stat-item">
<h3>N</h3>
<p [ngPlural]="mockViews || 0" class="mat-caption">
Expand All @@ -17,8 +17,13 @@ <h3>{{ shorthand(mockStargazers) }}</h3>
<mat-icon aria-hidden="true" class="stats-card-icon">edit</mat-icon>
Edit
</a>
<a target="_blank" href="{{challenge.websiteUrl}}" class="stat-item action-btn" *ngIf="!loggedIn">
<mat-icon aria-hidden="true" class="stats-card-icon">open_in_new</mat-icon>
<a
target="_blank"
href="{{ challenge.websiteUrl }}"
class="stat-item action-btn"
*ngIf="!loggedIn"
>
<mat-icon aria-hidden="true" class="stats-card-icon">open_in_new</mat-icon>
Go to Website
</a>
</div>
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Component, Input, OnInit } from '@angular/core';
import { Challenge } from '@sagebionetworks/openchallenges/api-client-angular';
import { Observable } from 'rxjs';
import { CommonModule } from '@angular/common';
import { MatIconModule } from '@angular/material/icon';
import { Challenge } from '@sagebionetworks/openchallenges/api-client-angular';

@Component({
selector: 'openchallenges-challenge-stats',
Expand All @@ -12,8 +11,9 @@ import { MatIconModule } from '@angular/material/icon';
styleUrls: ['./challenge-stats.component.scss'],
})
export class ChallengeStatsComponent implements OnInit {
@Input({ required: true }) challenge: Challenge | undefined;
@Input({ required: true }) loggedIn = false;
challenge$!: Observable<Challenge>;

mockViews!: number;
mockStargazers!: number;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h2>
<section id="profile-stats" class="row">
<div class="col fill-empty"></div>
<div class="col">
<openchallenges-challenge-stats [loggedIn]="loggedIn" />
<openchallenges-challenge-stats [challenge]="challenge" [loggedIn]="loggedIn" />
</div>
</section>
<section id="profile-bottom" class="content">
Expand Down
Loading