This repository has been archived by the owner on Jul 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ffd35c9
commit 8bb735a
Showing
32 changed files
with
461 additions
and
822 deletions.
There are no files selected for viewing
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
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
26 changes: 26 additions & 0 deletions
26
src/app/components/dashboard/dashboard-content/dashboard-content.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,26 @@ | ||
<section class="ev-md-container center"> | ||
<div class="row"> | ||
<div class="col s12"> | ||
<a class="btn ev-btn-dark waves-effect waves-dark grad-btn grad-btn-dark fs-14" routerLink="/analytics">Go to Analytics Dashboard</a> | ||
</div> | ||
</div> | ||
</section> | ||
<section class="ev-md-container center"> | ||
<div class="row"> | ||
<div class="col s12 m4"> | ||
<h3 class="fs-20 main-title">Ongoing Challenges</h3> | ||
<h4 class="text-dark-black">{{challenges.length || 0}}</h4> | ||
<a class="btn ev-btn-dark waves-effect waves-dark grad-btn grad-btn-transparent fs-14" routerLink="/challenges/all">View All</a> | ||
</div> | ||
<div class="col s12 m4"> | ||
<h3 class="fs-20 main-title">My Host Teams</h3> | ||
<h4 class="text-dark-black">{{hostTeams.length || 0}}</h4> | ||
<a class="btn ev-btn-dark waves-effect waves-dark grad-btn grad-btn-transparent fs-14" routerLink="/teams/hosts">View or Create</a> | ||
</div> | ||
<div class="col s12 m4"> | ||
<h3 class="fs-20 main-title">My Participant Teams</h3> | ||
<h4 class="text-dark-black">{{participantTeams.length || 0}}</h4> | ||
<a class="btn ev-btn-dark waves-effect waves-dark grad-btn grad-btn-transparent fs-14" routerLink="/teams/participants">View or Create</a> | ||
</div> | ||
</div> | ||
</section> |
8 changes: 8 additions & 0 deletions
8
src/app/components/dashboard/dashboard-content/dashboard-content.component.scss
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,8 @@ | ||
.main-title { | ||
margin-bottom: 0px; | ||
background: -webkit-linear-gradient(#f5ac28, #e07e7e); | ||
-webkit-background-clip: text; | ||
-webkit-text-fill-color: transparent; | ||
} | ||
|
||
|
51 changes: 51 additions & 0 deletions
51
src/app/components/dashboard/dashboard-content/dashboard-content.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,51 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { DashboardContentComponent } from './dashboard-content.component'; | ||
import {ApiService} from '../../../services/api.service'; | ||
import {HttpClientModule} from '@angular/common/http'; | ||
import {RouterTestingModule} from '@angular/router/testing'; | ||
import {GlobalService} from '../../../services/global.service'; | ||
import {AuthService} from '../../../services/auth.service'; | ||
import {EndpointsService} from '../../../services/endpoints.service'; | ||
import {Routes} from '@angular/router'; | ||
import {NotFoundComponent} from '../../not-found/not-found.component'; | ||
|
||
const routes: Routes = [ | ||
{ | ||
path: '', | ||
component: DashboardContentComponent, | ||
}, | ||
{ | ||
path: '404', | ||
component: NotFoundComponent | ||
}, | ||
{ | ||
path: '**', | ||
redirectTo: '/404', | ||
pathMatch: 'full' | ||
} | ||
]; | ||
|
||
describe('DashboardContentComponent', () => { | ||
let component: DashboardContentComponent; | ||
let fixture: ComponentFixture<DashboardContentComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ DashboardContentComponent, NotFoundComponent ], | ||
providers: [ApiService, GlobalService, AuthService, EndpointsService], | ||
imports: [HttpClientModule, RouterTestingModule.withRoutes(routes)] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DashboardContentComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
109 changes: 109 additions & 0 deletions
109
src/app/components/dashboard/dashboard-content/dashboard-content.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,109 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import {ApiService} from '../../../services/api.service'; | ||
import {AuthService} from '../../../services/auth.service'; | ||
import {GlobalService} from '../../../services/global.service'; | ||
import {ActivatedRoute, Router} from '@angular/router'; | ||
import {EndpointsService} from '../../../services/endpoints.service'; | ||
|
||
@Component({ | ||
selector: 'app-dashboard-content', | ||
templateUrl: './dashboard-content.component.html', | ||
styleUrls: ['./dashboard-content.component.scss'] | ||
}) | ||
export class DashboardContentComponent implements OnInit { | ||
|
||
|
||
/** | ||
* Challenges list | ||
*/ | ||
challenges = []; | ||
|
||
/** | ||
* Host teams list | ||
*/ | ||
hostTeams = []; | ||
|
||
/** | ||
* Participant teams list | ||
*/ | ||
participantTeams = []; | ||
|
||
/** | ||
* Path for routing | ||
*/ | ||
routePath = '/auth/login'; | ||
|
||
/** | ||
* Constructor. | ||
* @param endpointsService EndpointService Injection. | ||
* @param route ActivatedRoute Injection. | ||
* @param router Router Injection. | ||
* @param globalService GlobalService Injection. | ||
* @param apiService ApiService Injection. | ||
* @param authService AuthService Injection. | ||
*/ | ||
constructor(private apiService: ApiService, | ||
private authService: AuthService, | ||
private globalService: GlobalService, | ||
private router: Router, | ||
private route: ActivatedRoute, | ||
private endpointsService: EndpointsService) { } | ||
|
||
/** | ||
* Component on initialized. | ||
*/ | ||
ngOnInit() { | ||
if (!this.authService.isLoggedIn()) { | ||
this.router.navigate([this.routePath]); | ||
} else { | ||
this.fetchChallengesFromApi(this.endpointsService.allChallengesURL('present')); | ||
this.fetchTeams(this.endpointsService.allParticipantTeamsURL()); | ||
this.fetchTeams(this.endpointsService.allHostTeamsURL()); | ||
} | ||
} | ||
|
||
/** | ||
* Fetch challenges from backend. | ||
* @param path Challenges fetch URL. | ||
*/ | ||
fetchChallengesFromApi(path) { | ||
const SELF = this; | ||
SELF.apiService.getUrl(path).subscribe( | ||
data => { | ||
SELF.challenges = data['results']; | ||
}, | ||
err => { | ||
SELF.globalService.handleApiError(err); | ||
}, | ||
() => {} | ||
); | ||
} | ||
|
||
/** | ||
* Fetch teams from backend. | ||
* @param path Teams fetch URL. | ||
*/ | ||
fetchTeams(path) { | ||
const SELF = this; | ||
let isHost = false; | ||
if (path.includes('hosts')) { | ||
isHost = true; | ||
} | ||
this.apiService.getUrl(path).subscribe( | ||
data => { | ||
if (data['results']) { | ||
if (isHost) { | ||
SELF.hostTeams = data['results']; | ||
} else { | ||
SELF.participantTeams = data['results']; | ||
} | ||
} | ||
}, | ||
err => { | ||
SELF.globalService.handleApiError(err, false); | ||
}, | ||
() => {} | ||
); | ||
} | ||
|
||
} |
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,45 +1,14 @@ | ||
<app-side-bar *ngIf="authService.isAuth"></app-side-bar> | ||
<app-header-static></app-header-static> | ||
<div class="web-container" [style.center]="!authService.isAuth"> | ||
<div class="dashboard-flex"> | ||
<div class="dashboard-content"> | ||
<app-dashboard-content></app-dashboard-content> | ||
</div> | ||
<!--Dashboard-Footer--> | ||
<app-footer [isDash]="true" *ngIf="authService.isAuth"></app-footer> | ||
</div> | ||
</div> | ||
<div class="clearfix"></div> | ||
|
||
<div class="container-top dashboard-container"> | ||
|
||
<div class="row card"> | ||
<div class="section col-lg-4 col-md-4 com-sm-12 col-xs-12"> | ||
<div class="section-title"> | ||
Ongoing Challenges | ||
</div> | ||
<div class="section-number"> | ||
{{challenges.length}} | ||
</div> | ||
<div class="section-link"> | ||
<span [routerLink]="['/challenges/all']" class="btn btn-filter">View All</span> | ||
</div> | ||
</div> | ||
<div class="section col-lg-4 col-md-4 com-sm-12 col-xs-12"> | ||
<div class="section-title"> | ||
My Host Teams | ||
</div> | ||
<div class="section-number"> | ||
{{hostteams.length}} | ||
</div> | ||
<div class="section-link"> | ||
<span [routerLink]="['/teams/hosts']" class="btn btn-filter">View or Create</span> | ||
</div> | ||
</div> | ||
<div class="section col-lg-4 col-md-4 com-sm-12 col-xs-12"> | ||
<div class="section-title"> | ||
My Participant Teams | ||
</div> | ||
<div class="section-number"> | ||
{{participantteams.length}} | ||
</div> | ||
<div class="section-link"> | ||
<span [routerLink]="['/teams/participants']" class="btn btn-filter">View or Create</span> | ||
</div> | ||
</div> | ||
<div class="analytics"> | ||
<span class="btn btn-filter selected">Go to Analytics Dashboard</span> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<app-footer></app-footer> | ||
<app-footer *ngIf="!authService.isAuth"></app-footer> |
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,41 +1,37 @@ | ||
@import './variables.scss'; | ||
@import './mixins.scss'; | ||
@import "styles/variables"; | ||
|
||
.dashboard-flex { | ||
display: flex; | ||
flex-direction: column; | ||
min-height: 100vh; | ||
} | ||
|
||
.dashboard-content { | ||
flex: 1; | ||
min-height: 100vh; | ||
} | ||
|
||
.web-container { | ||
width: calc(100vw - 223px); | ||
float: right; | ||
padding-top: 70px; | ||
overflow-x: hidden; | ||
&.center { | ||
float: none; | ||
margin: 0 auto; | ||
text-align: left; | ||
overflow: hidden; | ||
} | ||
} | ||
|
||
/*media queries*/ | ||
|
||
@media only screen and (max-width: $med-screen) { | ||
.web-container { | ||
width: 100%; | ||
} | ||
} | ||
|
||
.light-dark-container { | ||
} | ||
|
||
.dashboard-container { | ||
font-size:$fs-16; | ||
font-weight: $fw-light; | ||
.card { | ||
background: $gray-lighter; | ||
padding:30px; | ||
.analytics { | ||
text-align: center; | ||
padding:20px; | ||
.btn { | ||
margin-left:0; | ||
margin-top:30px; | ||
} | ||
} | ||
.section { | ||
padding:10px; | ||
text-align:center; | ||
border-bottom:1px solid rgba(0,0,0,0.05); | ||
.section-title { | ||
text-align:center; | ||
font-size:$fs-18; | ||
font-weight:$fw-regular; | ||
color: $red-light; | ||
padding:20px; | ||
} | ||
.section-number { | ||
text-align:center; | ||
font-size:$fs-24; | ||
font-weight:$fw-regular; | ||
padding:20px; | ||
} | ||
.section-link { | ||
text-align:center; | ||
padding:20px; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.