This repository has been archived by the owner on Jul 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from GDG-Lille/feat/add-metrics
Feat/add metrics
- Loading branch information
Showing
20 changed files
with
416 additions
and
45 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/app/tweets/components/tweet-metrics/tweet-metrics.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.tweet-metrics .total { | ||
position: absolute; | ||
bottom: 20px; | ||
right: 30px; | ||
width: 50px; | ||
height: 50px; | ||
background-color: white; | ||
border-radius: 50%; | ||
border: 1px solid whitesmoke; | ||
|
||
font-size: 30px; | ||
font-weight: bold; | ||
text-align: center; | ||
line-height: 50px; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/app/tweets/components/tweet-metrics/tweet-metrics.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div class="tweet-metrics mat-typography"> | ||
<ngx-charts-area-chart | ||
[results]="metrics" | ||
[view]="view" | ||
[scheme]="scheme" | ||
[tooltipDisabled]="true"> | ||
</ngx-charts-area-chart> | ||
<div class="total">{{ totalOfTweets }}</div> | ||
</div> |
25 changes: 25 additions & 0 deletions
25
src/app/tweets/components/tweet-metrics/tweet-metrics.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {async, ComponentFixture, TestBed} from '@angular/core/testing'; | ||
|
||
import {TweetMetricsComponent} from './tweet-metrics.component'; | ||
|
||
describe('TweetMetricsComponent', () => { | ||
let component: TweetMetricsComponent; | ||
let fixture: ComponentFixture<TweetMetricsComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [TweetMetricsComponent] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(TweetMetricsComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
35 changes: 35 additions & 0 deletions
35
src/app/tweets/components/tweet-metrics/tweet-metrics.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core'; | ||
import {Metric} from '../../shared/domains/metric'; | ||
|
||
@Component({ | ||
selector: 'app-tweet-metrics', | ||
templateUrl: './tweet-metrics.component.html', | ||
styleUrls: ['./tweet-metrics.component.css'] | ||
}) | ||
export class TweetMetricsComponent implements OnInit, OnChanges { | ||
|
||
@Input() public width: number; | ||
@Input() public height: number; | ||
@Input() public metrics: Array<Metric>; | ||
|
||
public view = []; | ||
public scheme: any; | ||
public totalOfTweets: number; | ||
|
||
ngOnInit() { | ||
this.view.push(this.width, this.height); | ||
|
||
this.scheme = {}; | ||
this.scheme.domain = []; | ||
this.scheme.domain.push('#0E6993'); | ||
} | ||
|
||
ngOnChanges(changes: SimpleChanges) { | ||
if (changes.metrics.currentValue !== undefined) { | ||
this.metrics = changes.metrics.currentValue; | ||
this.totalOfTweets = 0; | ||
this.metrics[0].series.forEach(serie => this.totalOfTweets += serie.value); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
.tweets-list { | ||
padding: 8px; | ||
column-count: 4; | ||
background-color: whitesmoke; | ||
margin: 8px; | ||
display: flex; | ||
flex-direction: row; | ||
min-height: 100%; | ||
} | ||
|
||
.tweets-list .cell { | ||
display: inline-block; | ||
.tweets-list .column { | ||
width: calc(100% / 4); | ||
} | ||
|
||
.tweets-list .column + .column { | ||
margin-left: 8px; | ||
} | ||
|
||
.tweets-list .metrics { | ||
position: fixed; | ||
z-index: 1; | ||
bottom: -10px; | ||
} | ||
|
||
.tweets-list .spinner { | ||
position: absolute; | ||
top: calc(50% - 50px); | ||
left: calc(50% - 50px); | ||
} |
Oops, something went wrong.