Skip to content

Commit

Permalink
Fix challenge stats
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaffter committed Nov 4, 2023
1 parent b00d56e commit c16078d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
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,6 +1,5 @@
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';

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 = 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

0 comments on commit c16078d

Please sign in to comment.