File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 < a href ="{{settings.gitHubRepo}} " target ="blank " class ="nav-link ">
2121 < i class ="fa fa-github "> </ i >
2222 GitHub
23+ < a href ="{{settings.gitHubRepo + '/stargazers'}} " target ="blank " class ="badge badge-light ">
24+ < i class ="fa fa-star "> </ i >
25+ {{ (gitHubRepo$ | async)?.stargazers_count}}
26+ </ a >
2327 </ a >
2428 < a href ="{{settings.nugetPackage}} " target ="blank " class ="nav-link ">
2529 < i class ="fa fa-download "> </ i >
2630 Nuget
31+ < span class ="badge badge-light ">
32+ {{ (nugetPackage$ | async)?.data[0].totalDownloads}}
33+ </ span >
2734 </ a >
2835 </ div >
2936 </ nav >
Original file line number Diff line number Diff line change 1- import { Component } from "@angular/core" ;
1+ import { Component , OnInit } from "@angular/core" ;
2+ import { Observable } from "rxjs" ;
23import { environment } from "../../../../environments/environment" ;
4+ import { LibService } from "../../services" ;
5+ import { IGitHubRepo , INugetPackage } from "../../models" ;
36
47@Component ( {
58 selector : "app-footer" ,
69 templateUrl : "./footer.component.html" ,
710 styleUrls : [ "./footer.component.sass" ]
811} )
9- export class FooterComponent {
12+ export class FooterComponent implements OnInit {
1013
1114 year : number = new Date ( ) . getFullYear ( ) ;
1215 settings = environment ;
16+
17+ gitHubRepo$ : Observable < IGitHubRepo > ;
18+ nugetPackage$ : Observable < INugetPackage > ;
19+
20+ constructor ( private libService : LibService ) { }
21+
22+ ngOnInit ( ) {
23+ this . gitHubRepo$ = this . libService . fetchGitHubRepo ( ) ;
24+ this . nugetPackage$ = this . libService . fetchNugetPackage ( ) ;
25+ }
1326}
Original file line number Diff line number Diff line change 1+ export interface IGitHubRepo {
2+ id : string ;
3+ stargazers_count : number ;
4+ }
Original file line number Diff line number Diff line change 1+ export * from "./git-hub-repo.model" ;
2+ export * from "./nuget-package.model" ;
Original file line number Diff line number Diff line change 1+ export interface INugetPackage {
2+ data : {
3+ id : string ;
4+ version : string ;
5+ description : string ;
6+ summary : string ;
7+ title : string ;
8+ licenseUrl : string ;
9+ tags : string [ ] ;
10+ authors : string [ ] ;
11+ totalDownloads : number ;
12+ verified : boolean ;
13+ versions : {
14+ version : string ,
15+ downloads : number ,
16+ "@id" : string ;
17+ } [ ] ;
18+ } [ ] ;
19+ }
Original file line number Diff line number Diff line change 11import { GlobalService } from "./global.service" ;
2+ import { LibService } from "./lib.service" ;
23
34export * from "./global.service" ;
5+ export * from "./lib.service" ;
46
57export const SERVICES : any [ ] = [
6- GlobalService
8+ GlobalService ,
9+ LibService
710] ;
Original file line number Diff line number Diff line change 1+ import { Injectable } from "@angular/core" ;
2+ import { HttpClient } from "@angular/common/http" ;
3+ import { Observable } from "rxjs" ;
4+ import { environment } from "../../../environments/environment" ;
5+ import { IGitHubRepo , INugetPackage } from "../models" ;
6+
7+ /**
8+ * A library service to fetch git-hb & nuget-package data.
9+ */
10+ @Injectable ( )
11+ export class LibService {
12+
13+ constructor ( private http : HttpClient ) { }
14+
15+ /**
16+ * Fetches the git-hub-repo data.
17+ */
18+ public fetchGitHubRepo ( ) : Observable < IGitHubRepo > {
19+ return this . http . get < IGitHubRepo > ( environment . gitHubApi ) ;
20+ }
21+
22+ /**
23+ * Fetches the nuget-package data.
24+ */
25+ public fetchNugetPackage ( ) : Observable < INugetPackage > {
26+ return this . http . get < INugetPackage > ( environment . nugetApi ) ;
27+ }
28+ }
Original file line number Diff line number Diff line change 11export const environment = {
22 production : true ,
3- gitHubRepo : "https://github.com/dotnet-validator/lib" ,
3+ gitHubRepo : "https://github.com/DotNetValidator/DotNetValidator" ,
4+ gitHubApi : "https://api.github.com/repos/DotNetValidator/DotNetValidator" ,
45 nugetPackage : "https://www.nuget.org/packages/DotNetValidator/" ,
5- stackOverflow : "https://stackoverflow.com/questions/tagged/dotnet-validator" ,
6+ nugetApi : "https://api-v2v3search-0.nuget.org/query?q=packageid:dotnetvalidator" ,
7+ stackOverflow : "https://stackoverflow.com/questions/tagged/DotNetValidator" ,
68} ;
Original file line number Diff line number Diff line change 44
55export const environment = {
66 production : false ,
7- gitHubRepo : "https://github.com/dotnet-validator/lib" ,
7+ gitHubRepo : "https://github.com/DotNetValidator/DotNetValidator" ,
8+ gitHubApi : "https://api.github.com/repos/DotNetValidator/DotNetValidator" ,
89 nugetPackage : "https://www.nuget.org/packages/DotNetValidator/" ,
9- stackOverflow : "https://stackoverflow.com/questions/tagged/dotnet-validator" ,
10+ nugetApi : "https://api-v2v3search-0.nuget.org/query?q=packageid:dotnetvalidator" ,
11+ stackOverflow : "https://stackoverflow.com/questions/tagged/DotNetValidator" ,
1012} ;
1113
1214/*
You can’t perform that action at this time.
0 commit comments