Skip to content
This repository has been archived by the owner on Jul 6, 2020. It is now read-only.

Modified dashboard page #141

Merged
merged 47 commits into from
Jul 21, 2019
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
cf7c538
Ported image assets
sanketbansal Jun 1, 2019
37ef1a0
Added styles from angularjs
sanketbansal Jun 4, 2019
954d187
Modified footer
sanketbansal Jun 5, 2019
9dcdf53
Modified static header
sanketbansal Jun 4, 2019
d1e5701
Modified auth service
sanketbansal Jun 4, 2019
a1abd0a
Modified test case of twitter feed component
sanketbansal Jun 4, 2019
cf74ea6
Modified footer component
sanketbansal Jun 4, 2019
cebdde0
Modified footer component
sanketbansal Jun 4, 2019
56b8c9b
Modified auth service
sanketbansal Jun 5, 2019
3812f73
Modifications in header static component
sanketbansal Jun 5, 2019
613f9e1
Modified angular.json file
sanketbansal Jun 5, 2019
5668dc3
Added dashboard content component
sanketbansal Jun 5, 2019
bc97718
Added simple header component
sanketbansal Jun 5, 2019
2782231
Added side bar component
sanketbansal Jun 5, 2019
92ec709
Added dash footer component
sanketbansal Jun 6, 2019
c0aadab
Modified dashboard component
sanketbansal Jun 5, 2019
f1e835c
Removed routing from auth service
sanketbansal Jun 5, 2019
02f222e
Modified test cases
sanketbansal Jun 4, 2019
cc00045
Fixed testing issue
sanketbansal Jun 8, 2019
0cb1912
Moved dashboard component styles
sanketbansal Jun 29, 2019
35141c1
Fixed lint error in angular.json file
sanketbansal Jul 14, 2019
c1ed943
Removed images-port and styles-port folder
sanketbansal Jul 19, 2019
c3005a6
Modified basic styles
sanketbansal Jul 19, 2019
0d8429b
Removed duplicate styles
sanketbansal Jul 19, 2019
ed24070
Changes made in sidebar component
sanketbansal Jul 18, 2019
8d39a3a
Added materialize css lib
sanketbansal Jul 18, 2019
a2d824b
Removed unused css from main.scss
sanketbansal Jul 19, 2019
138a619
Removed console.logs and comments
sanketbansal Jul 19, 2019
9f3b900
Modified styles
sanketbansal Jul 19, 2019
6bcec49
Changes in auth service
sanketbansal Jul 19, 2019
239aa1d
Removed comments
sanketbansal Jul 19, 2019
80ef472
Fixed UI bug
sanketbansal Jul 20, 2019
ad3d55a
Added style for footer
sanketbansal Jul 20, 2019
d076682
Changes in auth services
sanketbansal Jul 20, 2019
a7a6f46
Removed unused method
sanketbansal Jul 20, 2019
a46cb00
changes in dashboard component
sanketbansal Jul 20, 2019
26dfe99
Fixed bug in challenge submit component
sanketbansal Jul 20, 2019
fe24c07
Configuration changes
sanketbansal Jul 21, 2019
50b8b39
changes in base.scss file
sanketbansal Jul 21, 2019
096a9d5
Removed unnecessary changes
sanketbansal Jul 21, 2019
3f160f0
Changes made in static-header
sanketbansal Jul 21, 2019
ab74faa
Removed simple header
sanketbansal Jul 21, 2019
6c50e87
Changes in static header
sanketbansal Jul 21, 2019
712efed
Changes in footer component
sanketbansal Jul 21, 2019
c2c85bd
Removed dash footer component
sanketbansal Jul 21, 2019
af99264
Changes in footer component
sanketbansal Jul 21, 2019
99befb6
Merge branch 'master' into modified-dashboard
lunayach Jul 21, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
"styles": [
"./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
"node_modules/normalize.css/normalize.css",
"node_modules/materialize-css/dist/css/materialize.css",
"src/styles/base.scss",
"./node_modules/froala-editor/css/froala_editor.pkgd.min.css",
"./node_modules/froala-editor/css/froala_style.min.css",
"./node_modules/ng-pick-datetime/assets/style/picker.min.css"
"./node_modules/ng-pick-datetime/assets/style/picker.min.css",
],
"scripts": [
"./node_modules/froala-editor/js/froala_editor.pkgd.min.js"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@types/moment-timezone": "^0.5.12",
"angular-froala-wysiwyg": "^3.0.0-rc.2-1",
"core-js": "^2.4.1",
"materialize-css": "^0.97.8",
"hammerjs": "^2.0.8",
"moment": "^2.24.0",
"ng-pick-datetime": "^7.0.0",
Expand Down
4 changes: 4 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import { RulesComponent } from './components/home/rules/rules.component';
import { TestimonialsComponent } from './components/home/testimonials/testimonials.component';
import { FeaturedChallengesComponent } from './components/home/featured-challenges/featured-challenges.component';
import { EditphasemodalComponent } from './components/challenge/challengephases/editphasemodal/editphasemodal.component';
import { SimpleHeaderComponent } from './components/nav/simple-header/simple-header.component';
import {
TermsAndConditionsModalComponent
} from './components/challenge/challengeparticipate/terms-and-conditions-modal/terms-and-conditions-modal.component';
Expand All @@ -78,6 +79,7 @@ import { DashFooterComponent } from './components/nav/dash-footer/dash-footer.co
import { MatMenuModule } from '@angular/material/menu';
import { MatIconModule } from '@angular/material/icon';

import { DashboardContentComponent } from './components/dashboard/dashboard-content/dashboard-content.component';
@NgModule({
declarations: [
AppComponent,
Expand Down Expand Up @@ -127,6 +129,8 @@ import { MatIconModule } from '@angular/material/icon';
SideBarComponent,
FeaturedChallengesComponent,
DashFooterComponent,
SimpleHeaderComponent,
DashboardContentComponent,
EditphasemodalComponent,
ChallengeviewallsubmissionsComponent,
TermsAndConditionsModalComponent
Expand Down
2 changes: 0 additions & 2 deletions src/app/components/about/about.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ describe('AboutComponent', () => {
declarations: [ AboutComponent, HeaderStaticComponent, FooterComponent ],
providers: [
GlobalService,
{provide: ActivatedRoute, useValue: fakeActivatedRoute},
{provide: Router, useClass: class { navigate = jasmine.createSpy('navigate'); }},
AuthService,
ApiService,
EndpointsService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ td, th {
padding-left: 16px;
padding-right: 36px;
}
ul {
padding-left: 40px;
}
}

.remaining-submission-clock {
Expand Down
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>
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;
}


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();
});
});
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);
},
() => {}
);
}

}
57 changes: 13 additions & 44 deletions src/app/components/dashboard/dashboard.component.html
Original file line number Diff line number Diff line change
@@ -1,45 +1,14 @@
<app-header-static></app-header-static>
<app-side-bar *ngIf="authService.isAuth"></app-side-bar>
<app-simple-header></app-simple-header>
<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-dash-footer *ngIf="authService.isAuth"></app-dash-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>
Loading