diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index a2a162e8f1..f7ea6a1867 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -16,6 +16,8 @@ import { CovalentMarkdownModule } from '../platform/markdown';
import { CovalentChartsModule } from '../platform/charts';
import { CovalentDynamicFormsModule } from '../platform/dynamic-forms';
+import { GitHubService } from './services';
+
@NgModule({
declarations: [
DocsAppComponent,
@@ -37,6 +39,7 @@ import { CovalentDynamicFormsModule } from '../platform/dynamic-forms';
], // modules needed to run this module
providers: [
appRoutingProviders,
+ GitHubService,
], // additional providers needed for this module
entryComponents: [ ],
bootstrap: [ DocsAppComponent ],
diff --git a/src/app/components/home/home.component.html b/src/app/components/home/home.component.html
index 1b59e6b7ba..3ee4e60cad 100644
--- a/src/app/components/home/home.component.html
+++ b/src/app/components/home/home.component.html
@@ -92,9 +92,14 @@
{{item.title}}
-
+
Gitter Chat
Bug or Feature Request
+
+
+
+ star {{starCount}}
+
FAQs
@@ -104,7 +109,7 @@
FAQs
Covalent gives you a quickstart to build a modern web application UI and ensure consistency across your enterprise products.
Some of Covalent's most important features include:
- - Angular-Material 2.
+ - Angular-Material 2
- Angular 2 Command-line interface (CLI) for builds, deploys, testing & more.
- Drastically simplified interface layouts (for dashboards, lists, etc).
- Custom web components (stepper, file upload, expansion panels & more).
@@ -132,7 +137,7 @@ FAQs
- Custom layouts & components in Covalent are developed specifically for enterprise solutions.
- Covalent provides a selection of UI layouts out of the box.
- Our team is continuously adding tools like Syntax Highlighting & Markdown.
- - Our team will always maintain native compatibility with Angular 2 & Material 2.
+ - Our team will always maintain native compatibility with Angular 2 & Material
- Our team will always follow the principles of the official Material Design spec.
@@ -247,7 +252,7 @@ Feature Requests & Bugs
- Copyright © 2016 Teradata. All rights reserved
+ Copyright © 2016 - 2017 Teradata. All rights reserved
diff --git a/src/app/components/home/home.component.ts b/src/app/components/home/home.component.ts
index 92d24122a9..2aae0ad8c9 100644
--- a/src/app/components/home/home.component.ts
+++ b/src/app/components/home/home.component.ts
@@ -1,4 +1,6 @@
-import { Component, HostBinding } from '@angular/core';
+import { Component, HostBinding, OnInit } from '@angular/core';
+
+import { GitHubService } from '../../services';
import { fadeAnimation } from '../../app.animations';
@@ -9,11 +11,13 @@ import { fadeAnimation } from '../../app.animations';
animations: [fadeAnimation],
})
-export class HomeComponent {
+export class HomeComponent implements OnInit {
@HostBinding('@routeAnimation') routeAnimation: boolean = true;
@HostBinding('class.td-route-animation') classAnimation: boolean = true;
+ starCount: number = 0;
+
items: Object[] = [{
color: 'purple-700',
description: 'Your guide to start using the UI platform in your app!',
@@ -41,4 +45,13 @@ export class HomeComponent {
},
];
+ constructor(private _gitHubService: GitHubService) {
+ }
+
+ ngOnInit(): void {
+ this._gitHubService.queryStartCount().subscribe((starsCount: number) => {
+ this.starCount = starsCount;
+ });
+ }
+
}
diff --git a/src/app/services/github.service.ts b/src/app/services/github.service.ts
new file mode 100644
index 0000000000..8e8209339b
--- /dev/null
+++ b/src/app/services/github.service.ts
@@ -0,0 +1,42 @@
+import { Injectable } from '@angular/core';
+import { Response } from '@angular/http';
+import { Observable } from 'rxjs/Observable';
+import { Subscriber } from 'rxjs/Subscriber';
+
+import { HttpInterceptorService } from '@covalent/http';
+
+export interface IGithubRepository {
+ stargazers_count: number;
+}
+
+const GITHUB_URL: string = 'https://api.github.com';
+
+@Injectable()
+export class GitHubService {
+
+ constructor(private _http: HttpInterceptorService) {
+
+ }
+
+ queryStartCount(): Observable {
+ return new Observable((subscriber: Subscriber) => {
+ this._http.get(GITHUB_URL + '/search/repositories?q=repo:Teradata/covalent').subscribe((response: Response) => {
+ let data: IGithubRepository[];
+ try {
+ data = response.json().items;
+ } catch (e) {
+ subscriber.error();
+ }
+ if (data.length > 0) {
+ subscriber.next(data[0].stargazers_count);
+ } else {
+ subscriber.next(0);
+ }
+ subscriber.complete();
+ }, (error: any) => {
+ subscriber.error();
+ });
+ });
+ }
+
+}
diff --git a/src/app/services/index.ts b/src/app/services/index.ts
new file mode 100644
index 0000000000..2c23c67f7d
--- /dev/null
+++ b/src/app/services/index.ts
@@ -0,0 +1 @@
+export { GitHubService } from './github.service';