├── fitness-tracker
├── src
│ ├── assets
│ │ └── .gitkeep
│ ├── app
│ │ ├── training
│ │ │ ├── training.component.scss
│ │ │ ├── current-training
│ │ │ │ ├── stop-training
│ │ │ │ │ ├── stop-training.component.scss
│ │ │ │ │ ├── stop-training.component.html
│ │ │ │ │ └── stop-training.component.ts
│ │ │ │ ├── current-training.component.scss
│ │ │ │ ├── current-training.component.html
│ │ │ │ └── current-training.component.ts
│ │ │ ├── new-training
│ │ │ │ ├── new-training.component.scss
│ │ │ │ ├── new-training.component.ts
│ │ │ │ └── new-training.component.html
│ │ │ ├── exercise.model.ts
│ │ │ ├── past-trainings
│ │ │ │ ├── past-trainings.component.scss
│ │ │ │ ├── past-trainings.component.ts
│ │ │ │ └── past-trainings.component.html
│ │ │ ├── training.component.html
│ │ │ ├── training-routing.module.ts
│ │ │ ├── training.component.ts
│ │ │ ├── training.actions.ts
│ │ │ ├── training.module.ts
│ │ │ ├── training.reducer.ts
│ │ │ └── training.service.ts
│ │ ├── welcome
│ │ │ ├── welcome.component.scss
│ │ │ ├── welcome.component.ts
│ │ │ └── welcome.component.html
│ │ ├── auth
│ │ │ ├── user.model.ts
│ │ │ ├── auth-data.model.ts
│ │ │ ├── login
│ │ │ │ ├── login.component.scss
│ │ │ │ ├── login.component.html
│ │ │ │ └── login.component.ts
│ │ │ ├── signup
│ │ │ │ ├── signup.component.scss
│ │ │ │ ├── signup.component.ts
│ │ │ │ └── signup.component.html
│ │ │ ├── auth.actions.ts
│ │ │ ├── auth-routing.module.ts
│ │ │ ├── auth.reducer.ts
│ │ │ ├── auth.module.ts
│ │ │ ├── auth.guard.ts
│ │ │ └── auth.service.ts
│ │ ├── app.component.scss
│ │ ├── navigation
│ │ │ ├── sidenav-list
│ │ │ │ ├── sidenav-list.component.scss
│ │ │ │ ├── sidenav-list.component.ts
│ │ │ │ └── sidenav-list.component.html
│ │ │ └── header
│ │ │ │ ├── header.component.scss
│ │ │ │ ├── header.component.html
│ │ │ │ └── header.component.ts
│ │ ├── shared
│ │ │ ├── ui.service.ts
│ │ │ ├── ui.actions.ts
│ │ │ ├── shared.module.ts
│ │ │ └── ui.reducer.ts
│ │ ├── app.component.html
│ │ ├── app.component.ts
│ │ ├── app-routing.module.ts
│ │ ├── app.reducer.ts
│ │ ├── app.component.spec.ts
│ │ ├── app.module.ts
│ │ └── material.module.ts
│ ├── favicon.ico
│ ├── main.ts
│ ├── environments
│ │ ├── environment.prod.ts
│ │ └── environment.ts
│ ├── index.html
│ ├── test.ts
│ ├── styles.scss
│ └── polyfills.ts
├── .firebaserc
├── .firebase
│ ├── hosting.IGRpc3Q.cache
│ └── hosting.ZGlzdA.cache
├── e2e
│ ├── tsconfig.json
│ ├── src
│ │ ├── app.po.ts
│ │ └── app.e2e-spec.ts
│ └── protractor.conf.js
├── .editorconfig
├── firebase.json
├── tsconfig.app.json
├── tsconfig.spec.json
├── browserslist
├── tsconfig.json
├── .gitignore
├── README.md
├── karma.conf.js
├── package.json
├── tslint.json
├── dist
│ └── index.html
└── angular.json
├── src
└── ng-refresher
│ ├── src
│ ├── assets
│ │ └── .gitkeep
│ ├── app
│ │ ├── app.component.scss
│ │ ├── home
│ │ │ ├── home.component.scss
│ │ │ ├── home.component.html
│ │ │ └── home.component.ts
│ │ ├── products
│ │ │ ├── products.component.scss
│ │ │ ├── product
│ │ │ │ ├── product.component.scss
│ │ │ │ ├── product.component.html
│ │ │ │ └── product.component.ts
│ │ │ ├── products.service.ts
│ │ │ ├── products.component.html
│ │ │ └── products.component.ts
│ │ ├── app.component.html
│ │ ├── app.component.ts
│ │ ├── app-routing.module.ts
│ │ ├── app.component.spec.ts
│ │ └── app.module.ts
│ ├── environments
│ │ ├── environment.prod.ts
│ │ └── environment.ts
│ ├── styles.scss
│ ├── favicon.ico
│ ├── index.html
│ ├── main.ts
│ ├── test.ts
│ └── polyfills.ts
│ ├── e2e
│ ├── tsconfig.json
│ ├── src
│ │ ├── app.po.ts
│ │ └── app.e2e-spec.ts
│ └── protractor.conf.js
│ ├── .editorconfig
│ ├── tsconfig.app.json
│ ├── tsconfig.spec.json
│ ├── browserslist
│ ├── tsconfig.json
│ ├── .gitignore
│ ├── README.md
│ ├── karma.conf.js
│ ├── package.json
│ ├── tslint.json
│ └── angular.json
├── README.md
└── .gitignore
/fitness-tracker/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/app.component.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/home/home.component.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/training.component.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/products/products.component.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/home/home.component.html:
--------------------------------------------------------------------------------
1 |
home works!
2 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/current-training/stop-training/stop-training.component.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/welcome/welcome.component.scss:
--------------------------------------------------------------------------------
1 | .welcome{
2 | text-align: center;
3 | }
4 |
--------------------------------------------------------------------------------
/fitness-tracker/.firebaserc:
--------------------------------------------------------------------------------
1 | {
2 | "projects": {
3 | "default": "ud-ng-fitness-tracker"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/styles.scss:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/auth/user.model.ts:
--------------------------------------------------------------------------------
1 | export interface User {
2 | email: string;
3 | userId: string;
4 | }
5 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/new-training/new-training.component.scss:
--------------------------------------------------------------------------------
1 | .new-training {
2 | padding: 2rem 0;
3 | }
4 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/auth/auth-data.model.ts:
--------------------------------------------------------------------------------
1 | export interface AuthData {
2 | email: string;
3 | password: string;
4 | }
5 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/current-training/current-training.component.scss:
--------------------------------------------------------------------------------
1 | .current-training {
2 | padding: 24px 12px;
3 | }
4 |
--------------------------------------------------------------------------------
/fitness-tracker/.firebase/hosting.IGRpc3Q.cache:
--------------------------------------------------------------------------------
1 | index.html,1576839130054,14d14080bd1df8f1618a7f76537810d7802cc694c901a52b4abcbd0ff08916cd
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # angular-full-app-with-angular-material-angularfire-ngrx-
2 | https://www.udemy.com/course/angular-full-app-with-angular-material-angularfire-ngrx/
3 |
--------------------------------------------------------------------------------
/fitness-tracker/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nirzaf/angular-full-app-with-angular-material-angularfire-ngrx/HEAD/fitness-tracker/src/favicon.ico
--------------------------------------------------------------------------------
/src/ng-refresher/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nirzaf/angular-full-app-with-angular-material-angularfire-ngrx/HEAD/src/ng-refresher/src/favicon.ico
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/products/product/product.component.scss:
--------------------------------------------------------------------------------
1 | .product {
2 | padding: 1rem;
3 | margin: .5rem 0;
4 | box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
5 | }
6 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/app.component.html:
--------------------------------------------------------------------------------
1 | Header
2 | Home
3 | Products
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/products/product/product.component.html:
--------------------------------------------------------------------------------
1 |
4 | {{productName}}
5 | Lorem ipsum dolor.
6 |
7 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/app.component.scss:
--------------------------------------------------------------------------------
1 | mat-sidenav-container, mat-sidenav-content {
2 | height : 100%;
3 | }
4 |
5 | mat-sidenav {
6 | width : 100%;
7 | max-width : 280px;
8 |
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/navigation/sidenav-list/sidenav-list.component.scss:
--------------------------------------------------------------------------------
1 | a.active {
2 | background-color: darken(#fff, 10);
3 | }
4 |
5 | .nav-caption {
6 | display : inline-block;
7 | padding-left : .75rem;
8 | }
9 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/exercise.model.ts:
--------------------------------------------------------------------------------
1 | export interface Exercise {
2 | id: string;
3 | name: string;
4 | duration: number;
5 | calories: number;
6 | date?: Date;
7 | state?: 'completed' | 'cancelled' | null;
8 | }
9 |
--------------------------------------------------------------------------------
/fitness-tracker/e2e/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/e2e",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-root',
5 | templateUrl: './app.component.html',
6 | styleUrls: ['./app.component.scss']
7 | })
8 | export class AppComponent {
9 | title = 'ng-refresher';
10 | }
11 |
--------------------------------------------------------------------------------
/src/ng-refresher/e2e/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/e2e",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/auth/login/login.component.scss:
--------------------------------------------------------------------------------
1 | :host{
2 | padding-top: 2rem;
3 | display: block;
4 | }
5 |
6 | .login-form {
7 | max-width: 360px;
8 | width: 95%;
9 | margin: 2rem auto;
10 | }
11 |
12 | mat-form-field {
13 | width: 100%;
14 | }
15 |
16 | .mat-spinner {
17 | margin: 0 auto;
18 | }
19 |
--------------------------------------------------------------------------------
/fitness-tracker/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see https://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | max_line_length = off
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/auth/signup/signup.component.scss:
--------------------------------------------------------------------------------
1 | :host{
2 | padding-top: 2rem;
3 | display: block;
4 | }
5 |
6 | .sign-up-form {
7 | max-width: 360px;
8 | width: 95%;
9 | margin: 2rem auto;
10 | }
11 |
12 | mat-form-field {
13 | width: 100%;
14 | }
15 |
16 | .mat-spinner {
17 | margin: 0 auto;
18 | }
19 |
--------------------------------------------------------------------------------
/src/ng-refresher/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see https://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | max_line_length = off
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/fitness-tracker/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "hosting": {
3 | "public": "dist",
4 | "ignore": [
5 | "firebase.json",
6 | "**/.*",
7 | "**/node_modules/**"
8 | ],
9 | "rewrites": [
10 | {
11 | "source": "**",
12 | "destination": "/index.html"
13 | }
14 | ]
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/fitness-tracker/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo() {
5 | return browser.get(browser.baseUrl) as Promise;
6 | }
7 |
8 | getTitleText() {
9 | return element(by.css('app-root .content span')).getText() as Promise;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/past-trainings/past-trainings.component.scss:
--------------------------------------------------------------------------------
1 | section {
2 | padding : 2rem 0;
3 | }
4 |
5 | mat-card {
6 | overflow : auto;
7 | padding : 0;
8 |
9 | > .mat-form-field {
10 | margin-left : 1rem;
11 | }
12 |
13 | }
14 |
15 | table {
16 | width : 100%;
17 | min-width : 640px;
18 | }
19 |
--------------------------------------------------------------------------------
/src/ng-refresher/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo() {
5 | return browser.get(browser.baseUrl) as Promise;
6 | }
7 |
8 | getTitleText() {
9 | return element(by.css('app-root .content span')).getText() as Promise;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/home/home.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-home',
5 | templateUrl: './home.component.html',
6 | styleUrls: ['./home.component.scss']
7 | })
8 | export class HomeComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/fitness-tracker/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "./out-tsc/app",
5 | "types": []
6 | },
7 | "files": [
8 | "src/main.ts",
9 | "src/polyfills.ts"
10 | ],
11 | "include": [
12 | "src/**/*.ts"
13 | ],
14 | "exclude": [
15 | "src/test.ts",
16 | "src/**/*.spec.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/fitness-tracker/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "./out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NgRefresher
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/ng-refresher/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "./out-tsc/app",
5 | "types": []
6 | },
7 | "files": [
8 | "src/main.ts",
9 | "src/polyfills.ts"
10 | ],
11 | "include": [
12 | "src/**/*.ts"
13 | ],
14 | "exclude": [
15 | "src/test.ts",
16 | "src/**/*.spec.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/src/ng-refresher/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "./out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/welcome/welcome.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-welcome',
5 | templateUrl: './welcome.component.html',
6 | styleUrls: ['./welcome.component.scss']
7 | })
8 | export class WelcomeComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/training.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
12 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/navigation/header/header.component.scss:
--------------------------------------------------------------------------------
1 | nav {
2 | margin-left : auto;
3 | }
4 |
5 | mat-toolbar {
6 |
7 | a {
8 | color : #fff;
9 | text-decoration : none;
10 | padding : .25rem .5rem;
11 | display : inline-flex;
12 |
13 | &:hover, &:active {
14 | color : darken(#fff, 8);
15 | text-decoration : none;
16 | }
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/shared/ui.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import {MatSnackBar} from '@angular/material/snack-bar';
3 |
4 | @Injectable({
5 | providedIn: 'root'
6 | })
7 | export class UiService {
8 | constructor(private snackBar: MatSnackBar) { }
9 |
10 | showSnackbar(message, action, duration) {
11 | this.snackBar.open(message, action, {
12 | duration: duration
13 | });
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic().bootstrapModule(AppModule)
12 | .catch(err => console.error(err));
13 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/shared/ui.actions.ts:
--------------------------------------------------------------------------------
1 | import {Action} from '@ngrx/store';
2 |
3 | export const START_LOADING = '[UI] Start Loading';
4 | export const STOP_LOADING = '[UI] Stop Loading';
5 |
6 | export class StartLoading implements Action {
7 | readonly type = START_LOADING;
8 | }
9 |
10 | export class StopLoading implements Action {
11 | readonly type = STOP_LOADING;
12 | }
13 |
14 | export type UIActions = StartLoading | StopLoading;
15 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/training-routing.module.ts:
--------------------------------------------------------------------------------
1 | import {NgModule} from '@angular/core';
2 | import {Routes, RouterModule} from '@angular/router';
3 | import {TrainingComponent} from './training.component';
4 |
5 | const routes: Routes = [
6 | {path: '', component: TrainingComponent},
7 | ];
8 |
9 | @NgModule({
10 | imports: [RouterModule.forChild(routes)],
11 | exports: [RouterModule]
12 | })
13 | export class TrainingRoutingModule {
14 | }
15 |
--------------------------------------------------------------------------------
/fitness-tracker/src/main.ts:
--------------------------------------------------------------------------------
1 | import 'hammerjs';
2 | import { enableProdMode } from '@angular/core';
3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
4 |
5 | import { AppModule } from './app/app.module';
6 | import { environment } from './environments/environment';
7 |
8 | if (environment.production) {
9 | enableProdMode();
10 | }
11 |
12 | platformBrowserDynamic().bootstrapModule(AppModule)
13 | .catch(err => console.error(err));
14 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/current-training/stop-training/stop-training.component.html:
--------------------------------------------------------------------------------
1 | Are you sure?
2 |
3 | You already got {{passedData.progress}}%
4 |
5 |
6 |
10 |
14 |
15 |
--------------------------------------------------------------------------------
/fitness-tracker/browserslist:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # You can see what browsers were selected by your queries by running:
6 | # npx browserslist
7 |
8 | > 0.5%
9 | last 2 versions
10 | Firefox ESR
11 | not dead
12 | not IE 9-11 # For IE 9-11 support, remove 'not'.
--------------------------------------------------------------------------------
/fitness-tracker/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, OnInit, ViewChild} from '@angular/core';
2 | import {AuthService} from './auth/auth.service';
3 |
4 | @Component({
5 | selector: 'app-root',
6 | templateUrl: './app.component.html',
7 | styleUrls: ['./app.component.scss']
8 | })
9 | export class AppComponent implements OnInit {
10 | constructor(private authService: AuthService) {
11 | }
12 |
13 | ngOnInit(): void {
14 | this.authService.initAuthListener();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/ng-refresher/browserslist:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # You can see what browsers were selected by your queries by running:
6 | # npx browserslist
7 |
8 | > 0.5%
9 | last 2 versions
10 | Firefox ESR
11 | not dead
12 | not IE 9-11 # For IE 9-11 support, remove 'not'.
--------------------------------------------------------------------------------
/fitness-tracker/src/app/auth/auth.actions.ts:
--------------------------------------------------------------------------------
1 | import {Action} from '@ngrx/store';
2 |
3 | export const SET_AUTHENTICATED = '[Auth] Set Authenticated';
4 | export const SET_UNAUTHENTICATED = '[Auth] Set Unauthenticated';
5 |
6 | export class SetAuthenticated implements Action {
7 | readonly type = SET_AUTHENTICATED;
8 | }
9 |
10 | export class SetUnauthenticated implements Action {
11 | readonly type = SET_UNAUTHENTICATED;
12 | }
13 |
14 | export type AuthActions = SetAuthenticated | SetUnauthenticated;
15 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/current-training/current-training.component.html:
--------------------------------------------------------------------------------
1 |
7 |
11 |
12 | {{progress}}%
13 | Keep on going, you can do it!
14 |
18 |
19 |
--------------------------------------------------------------------------------
/fitness-tracker/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true,
3 | firebase: {
4 | apiKey: "AIzaSyAL8mRiMhConrQ_2aWWT82xulT6uiUvI90",
5 | authDomain: "ud-ng-fitness-tracker.firebaseapp.com",
6 | databaseURL: "https://ud-ng-fitness-tracker.firebaseio.com",
7 | projectId: "ud-ng-fitness-tracker",
8 | storageBucket: "ud-ng-fitness-tracker.appspot.com",
9 | messagingSenderId: "94347406266",
10 | appId: "1:94347406266:web:78e861b0d69c9b8e2f4b83",
11 | measurementId: "G-0KW97X8DLS"
12 | }
13 | };
14 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import {HomeComponent} from './home/home.component';
4 | import {ProductsComponent} from './products/products.component';
5 |
6 |
7 | const routes: Routes = [
8 | { path: '', component: HomeComponent },
9 | { path: 'products', component: ProductsComponent }
10 | ];
11 |
12 | @NgModule({
13 | imports: [RouterModule.forRoot(routes)],
14 | exports: [RouterModule]
15 | })
16 | export class AppRoutingModule { }
17 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/auth/auth-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import {SignupComponent} from './signup/signup.component';
4 | import {LoginComponent} from './login/login.component';
5 |
6 |
7 | const routes: Routes = [
8 | {path: 'signup', component: SignupComponent},
9 | {path: 'login', component: LoginComponent},
10 | ];
11 |
12 | @NgModule({
13 | imports: [RouterModule.forChild(routes)],
14 | exports: [RouterModule]
15 | })
16 | export class AuthRoutingModule { }
17 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/current-training/stop-training/stop-training.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, Inject, OnInit} from '@angular/core';
2 | import {MAT_DIALOG_DATA} from '@angular/material/dialog';
3 |
4 | @Component({
5 | selector: 'app-stop-training',
6 | templateUrl: './stop-training.component.html',
7 | styleUrls: ['./stop-training.component.scss']
8 | })
9 | export class StopTrainingComponent implements OnInit {
10 | constructor(
11 | @Inject(MAT_DIALOG_DATA) public passedData: any
12 | ) { }
13 |
14 | ngOnInit() {
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/fitness-tracker/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | FitnessTracker
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/welcome/welcome.component.html:
--------------------------------------------------------------------------------
1 |
7 |
8 | ACTIVITY
9 | Stay active and enjoy better health and more fun!
10 |
11 |
12 | COMMUNITY
13 | Get to know other people who share your passion!
14 |
15 |
16 | CHALLENGES
17 | Never stop! Dive into new challenges every day
18 |
19 |
20 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/navigation/header/header.component.html:
--------------------------------------------------------------------------------
1 |
2 |
8 | FIT
9 |
15 |
16 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 | import {WelcomeComponent} from './welcome/welcome.component';
4 | import {AuthGuard} from './auth/auth.guard';
5 |
6 |
7 | const routes: Routes = [
8 | {path: '', component: WelcomeComponent},
9 | {path: 'training', loadChildren: './training/training.module#TrainingModule', canLoad: [AuthGuard]},
10 |
11 | ];
12 |
13 | @NgModule({
14 | imports: [RouterModule.forRoot(routes)],
15 | exports: [RouterModule],
16 | providers: [AuthGuard]
17 | })
18 | export class AppRoutingModule { }
19 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/shared/shared.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 | import {FormsModule} from '@angular/forms';
4 | import {FlexLayoutModule} from '@angular/flex-layout';
5 |
6 | import {MaterialModule} from '../material.module';
7 |
8 |
9 |
10 | @NgModule({
11 | declarations: [],
12 | imports: [
13 | CommonModule,
14 | FormsModule,
15 | MaterialModule,
16 | FlexLayoutModule,
17 | ],
18 | exports: [
19 | CommonModule,
20 | FormsModule,
21 | MaterialModule,
22 | FlexLayoutModule,
23 | ]
24 | })
25 | export class SharedModule { }
26 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/shared/ui.reducer.ts:
--------------------------------------------------------------------------------
1 | import {START_LOADING, STOP_LOADING, UIActions} from './ui.actions';
2 |
3 | export interface State {
4 | isLoading: boolean;
5 | }
6 |
7 | const initialState: State = {
8 | isLoading: false
9 | };
10 |
11 | export function uiReducer(state = initialState, action: UIActions) {
12 | switch (action.type) {
13 | case START_LOADING:
14 | return {
15 | isLoading: true
16 | };
17 | case STOP_LOADING:
18 | return {
19 | isLoading: false
20 | };
21 | default:{
22 | return state;
23 | }
24 | }
25 | }
26 |
27 | export const getIsLoading = (state: State) => state.isLoading;
28 |
--------------------------------------------------------------------------------
/fitness-tracker/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "downlevelIteration": true,
9 | "experimentalDecorators": true,
10 | "module": "esnext",
11 | "moduleResolution": "node",
12 | "importHelpers": true,
13 | "target": "es2015",
14 | "typeRoots": [
15 | "node_modules/@types"
16 | ],
17 | "lib": [
18 | "es2018",
19 | "dom"
20 | ]
21 | },
22 | "angularCompilerOptions": {
23 | "fullTemplateTypeCheck": true,
24 | "strictInjectionParameters": true
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/ng-refresher/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "downlevelIteration": true,
9 | "experimentalDecorators": true,
10 | "module": "esnext",
11 | "moduleResolution": "node",
12 | "importHelpers": true,
13 | "target": "es2015",
14 | "typeRoots": [
15 | "node_modules/@types"
16 | ],
17 | "lib": [
18 | "es2018",
19 | "dom"
20 | ]
21 | },
22 | "angularCompilerOptions": {
23 | "fullTemplateTypeCheck": true,
24 | "strictInjectionParameters": true
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/products/products.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import {Subject} from 'rxjs';
3 |
4 | @Injectable({
5 | providedIn: 'root'
6 | })
7 | export class ProductsService {
8 |
9 | private products = ['A Book'];
10 | productsUpdated = new Subject();
11 |
12 | constructor() { }
13 |
14 | addProduct(productName: string) {
15 | this.products.push(productName);
16 | this.productsUpdated.next(this.products)
17 | }
18 |
19 | getProducts(){
20 | return [...this.products];
21 | }
22 |
23 | deleteProduct(productName: string) {
24 | this.products = this.products.filter(p=> p!== productName);
25 | this.productsUpdated.next();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/auth/auth.reducer.ts:
--------------------------------------------------------------------------------
1 | import {AuthActions, SET_AUTHENTICATED, SET_UNAUTHENTICATED} from './auth.actions';
2 |
3 | export interface State {
4 | isAuthenticated: boolean;
5 | }
6 |
7 | const initialState: State = {
8 | isAuthenticated: false
9 | };
10 |
11 | export function authReducer(state = initialState, action: AuthActions) {
12 | switch (action.type) {
13 | case SET_AUTHENTICATED:
14 | return {
15 | isAuthenticated: true
16 | };
17 | case SET_UNAUTHENTICATED:
18 | return {
19 | isAuthenticated: false
20 | };
21 | default:{
22 | return state;
23 | }
24 | }
25 | }
26 |
27 | export const getIsAuth = (state: State) => state.isAuthenticated;
28 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/auth/auth.module.ts:
--------------------------------------------------------------------------------
1 | import {NgModule} from '@angular/core';
2 | import {ReactiveFormsModule} from '@angular/forms';
3 | import {AngularFireAuthModule} from '@angular/fire/auth';
4 |
5 | import {SignupComponent} from './signup/signup.component';
6 | import {LoginComponent} from './login/login.component';
7 | import {SharedModule} from '../shared/shared.module';
8 | import {AuthRoutingModule} from './auth-routing.module';
9 |
10 | @NgModule({
11 | declarations: [
12 | SignupComponent,
13 | LoginComponent,
14 | ],
15 | imports: [
16 | ReactiveFormsModule,
17 | AngularFireAuthModule,
18 | SharedModule,
19 | AuthRoutingModule
20 | ],
21 | exports: []
22 | })
23 | export class AuthModule {
24 | }
25 |
--------------------------------------------------------------------------------
/fitness-tracker/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: any;
11 |
12 | // First, initialize the Angular testing environment.
13 | getTestBed().initTestEnvironment(
14 | BrowserDynamicTestingModule,
15 | platformBrowserDynamicTesting()
16 | );
17 | // Then we find all the tests.
18 | const context = require.context('./', true, /\.spec\.ts$/);
19 | // And load the modules.
20 | context.keys().map(context);
21 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: any;
11 |
12 | // First, initialize the Angular testing environment.
13 | getTestBed().initTestEnvironment(
14 | BrowserDynamicTestingModule,
15 | platformBrowserDynamicTesting()
16 | );
17 | // Then we find all the tests.
18 | const context = require.context('./', true, /\.spec\.ts$/);
19 | // And load the modules.
20 | context.keys().map(context);
21 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/products/product/product.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
2 | import {ProductsService} from '../products.service';
3 |
4 | @Component({
5 | selector: 'app-product',
6 | templateUrl: './product.component.html',
7 | styleUrls: ['./product.component.scss']
8 | })
9 | export class ProductComponent implements OnInit {
10 | @Input() productName: string;
11 |
12 | @Output() productClicked = new EventEmitter();
13 |
14 | constructor(
15 | private productsService: ProductsService
16 | ) { }
17 |
18 | ngOnInit() {
19 | }
20 |
21 | onClicked() {
22 | // this.productClicked.emit( )
23 | this.productsService.deleteProduct(this.productName)
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/fitness-tracker/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 | import { browser, logging } from 'protractor';
3 |
4 | describe('workspace-project App', () => {
5 | let page: AppPage;
6 |
7 | beforeEach(() => {
8 | page = new AppPage();
9 | });
10 |
11 | it('should display welcome message', () => {
12 | page.navigateTo();
13 | expect(page.getTitleText()).toEqual('fitness-tracker app is running!');
14 | });
15 |
16 | afterEach(async () => {
17 | // Assert that there are no errors emitted from the browser
18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19 | expect(logs).not.toContain(jasmine.objectContaining({
20 | level: logging.Level.SEVERE,
21 | } as logging.Entry));
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/app.reducer.ts:
--------------------------------------------------------------------------------
1 | import {ActionReducerMap, createFeatureSelector, createSelector} from '@ngrx/store';
2 |
3 | import * as fromUi from './shared/ui.reducer';
4 | import * as fromAuth from './auth/auth.reducer';
5 |
6 | export interface State {
7 | ui: fromUi.State;
8 | auth: fromAuth.State;
9 | }
10 |
11 | export const reducers: ActionReducerMap = {
12 | ui: fromUi.uiReducer,
13 | auth: fromAuth.authReducer
14 | };
15 |
16 | export const getUiState = createFeatureSelector('ui');
17 | export const getIsLoading = createSelector(getUiState, fromUi.getIsLoading);
18 |
19 | export const getAuthState = createFeatureSelector('auth');
20 | export const getIsAuth = createSelector(getAuthState, fromAuth.getIsAuth);
21 |
--------------------------------------------------------------------------------
/src/ng-refresher/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 | import { browser, logging } from 'protractor';
3 |
4 | describe('workspace-project App', () => {
5 | let page: AppPage;
6 |
7 | beforeEach(() => {
8 | page = new AppPage();
9 | });
10 |
11 | it('should display welcome message', () => {
12 | page.navigateTo();
13 | expect(page.getTitleText()).toEqual('ng-refresher app is running!');
14 | });
15 |
16 | afterEach(async () => {
17 | // Assert that there are no errors emitted from the browser
18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19 | expect(logs).not.toContain(jasmine.objectContaining({
20 | level: logging.Level.SEVERE,
21 | } as logging.Entry));
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/training.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, OnInit} from '@angular/core';
2 | import {Store} from '@ngrx/store';
3 | import {TrainingService} from './training.service';
4 | import * as fromTraining from './training.reducer'
5 | import {Observable} from 'rxjs';
6 |
7 | @Component({
8 | selector: 'app-training',
9 | templateUrl: './training.component.html',
10 | styleUrls: ['./training.component.scss']
11 | })
12 | export class TrainingComponent implements OnInit {
13 | ongoingTraining$: Observable;
14 |
15 | constructor(
16 | private trainingService: TrainingService,
17 | private store: Store
18 | ) { }
19 |
20 | ngOnInit() {
21 | this.ongoingTraining$ = this.store.select(fromTraining.getIsTraining);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/fitness-tracker/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 | # Only exists if Bazel was run
8 | /bazel-out
9 |
10 | # dependencies
11 | /node_modules
12 |
13 | # profiling files
14 | chrome-profiler-events*.json
15 | speed-measure-plugin*.json
16 |
17 | # IDEs and editors
18 | /.idea
19 | .project
20 | .classpath
21 | .c9/
22 | *.launch
23 | .settings/
24 | *.sublime-workspace
25 |
26 | # IDE - VSCode
27 | .vscode/*
28 | !.vscode/settings.json
29 | !.vscode/tasks.json
30 | !.vscode/launch.json
31 | !.vscode/extensions.json
32 | .history/*
33 |
34 | # misc
35 | /.sass-cache
36 | /connect.lock
37 | /coverage
38 | /libpeerconnection.log
39 | npm-debug.log
40 | yarn-error.log
41 | testem.log
42 | /typings
43 |
44 | # System Files
45 | .DS_Store
46 | Thumbs.db
47 |
--------------------------------------------------------------------------------
/src/ng-refresher/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 | # Only exists if Bazel was run
8 | /bazel-out
9 |
10 | # dependencies
11 | /node_modules
12 |
13 | # profiling files
14 | chrome-profiler-events*.json
15 | speed-measure-plugin*.json
16 |
17 | # IDEs and editors
18 | /.idea
19 | .project
20 | .classpath
21 | .c9/
22 | *.launch
23 | .settings/
24 | *.sublime-workspace
25 |
26 | # IDE - VSCode
27 | .vscode/*
28 | !.vscode/settings.json
29 | !.vscode/tasks.json
30 | !.vscode/launch.json
31 | !.vscode/extensions.json
32 | .history/*
33 |
34 | # misc
35 | /.sass-cache
36 | /connect.lock
37 | /coverage
38 | /libpeerconnection.log
39 | npm-debug.log
40 | yarn-error.log
41 | testem.log
42 | /typings
43 |
44 | # System Files
45 | .DS_Store
46 | Thumbs.db
47 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/products/products.component.html:
--------------------------------------------------------------------------------
1 | My products!
2 |
3 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
28 |
29 | {{productName}}
30 |
31 |
36 |
--------------------------------------------------------------------------------
/fitness-tracker/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 | // Protractor configuration file, see link for more information
3 | // https://github.com/angular/protractor/blob/master/lib/config.ts
4 |
5 | const { SpecReporter } = require('jasmine-spec-reporter');
6 |
7 | /**
8 | * @type { import("protractor").Config }
9 | */
10 | exports.config = {
11 | allScriptsTimeout: 11000,
12 | specs: [
13 | './src/**/*.e2e-spec.ts'
14 | ],
15 | capabilities: {
16 | 'browserName': 'chrome'
17 | },
18 | directConnect: true,
19 | baseUrl: 'http://localhost:4200/',
20 | framework: 'jasmine',
21 | jasmineNodeOpts: {
22 | showColors: true,
23 | defaultTimeoutInterval: 30000,
24 | print: function() {}
25 | },
26 | onPrepare() {
27 | require('ts-node').register({
28 | project: require('path').join(__dirname, './tsconfig.json')
29 | });
30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
31 | }
32 | };
--------------------------------------------------------------------------------
/src/ng-refresher/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 | // Protractor configuration file, see link for more information
3 | // https://github.com/angular/protractor/blob/master/lib/config.ts
4 |
5 | const { SpecReporter } = require('jasmine-spec-reporter');
6 |
7 | /**
8 | * @type { import("protractor").Config }
9 | */
10 | exports.config = {
11 | allScriptsTimeout: 11000,
12 | specs: [
13 | './src/**/*.e2e-spec.ts'
14 | ],
15 | capabilities: {
16 | 'browserName': 'chrome'
17 | },
18 | directConnect: true,
19 | baseUrl: 'http://localhost:4200/',
20 | framework: 'jasmine',
21 | jasmineNodeOpts: {
22 | showColors: true,
23 | defaultTimeoutInterval: 30000,
24 | print: function() {}
25 | },
26 | onPrepare() {
27 | require('ts-node').register({
28 | project: require('path').join(__dirname, './tsconfig.json')
29 | });
30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
31 | }
32 | };
--------------------------------------------------------------------------------
/fitness-tracker/src/app/navigation/header/header.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, EventEmitter, OnDestroy, OnInit, Output} from '@angular/core';
2 | import {Observable} from 'rxjs';
3 | import {Store} from '@ngrx/store';
4 | import * as fromRoot from '../../app.reducer';
5 | import {AuthService} from '../../auth/auth.service';
6 |
7 | @Component({
8 | selector: 'app-header',
9 | templateUrl: './header.component.html',
10 | styleUrls: ['./header.component.scss']
11 | })
12 | export class HeaderComponent implements OnInit {
13 | @Output() sidenavToggle = new EventEmitter();
14 | isAuth$: Observable;
15 |
16 | constructor(
17 | private authService: AuthService,
18 | private store: Store
19 | ) {
20 | }
21 |
22 | ngOnInit() {
23 | this.isAuth$ = this.store.select(fromRoot.getIsAuth);
24 | }
25 |
26 | onLogout() {
27 | this.authService.logout();
28 | }
29 |
30 | onToggleSidenav() {
31 | this.sidenavToggle.emit();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/navigation/sidenav-list/sidenav-list.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, EventEmitter, OnDestroy, OnInit, Output} from '@angular/core';
2 | import {Observable} from 'rxjs';
3 | import {AuthService} from '../../auth/auth.service';
4 | import {Store} from '@ngrx/store';
5 | import * as fromRoot from '../../app.reducer';
6 |
7 | @Component({
8 | selector: 'app-sidenav-list',
9 | templateUrl: './sidenav-list.component.html',
10 | styleUrls: ['./sidenav-list.component.scss']
11 | })
12 | export class SidenavListComponent implements OnInit {
13 | @Output() closeSidenav = new EventEmitter();
14 | isAuth$: Observable;
15 |
16 | constructor(
17 | private authService: AuthService,
18 | private store: Store
19 | ) {
20 | }
21 |
22 | ngOnInit() {
23 | this.isAuth$ = this.store.select(fromRoot.getIsAuth);
24 | }
25 |
26 | onLogout() {
27 | this.authService.logout();
28 | }
29 |
30 | onClose() {
31 | this.closeSidenav.emit();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/navigation/sidenav-list/sidenav-list.component.html:
--------------------------------------------------------------------------------
1 |
4 |
8 | face
9 | Sign Up
10 |
11 |
15 | fingerprint
16 | Login
17 |
18 |
22 | fitness_center
23 | Training
24 |
25 |
26 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/auth/auth.guard.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import {
3 | CanActivate,
4 | ActivatedRouteSnapshot,
5 | RouterStateSnapshot,
6 | UrlTree,
7 | CanLoad, Route, UrlSegment
8 | } from '@angular/router';
9 | import { Observable } from 'rxjs';
10 | import {take} from 'rxjs/operators';
11 | import {Store} from '@ngrx/store';
12 |
13 | import * as fromRoot from '../app.reducer'
14 |
15 | @Injectable({
16 | providedIn: 'root'
17 | })
18 | export class AuthGuard implements CanActivate, CanLoad {
19 | constructor(
20 | private store: Store
21 | ) {
22 | }
23 | canActivate(
24 | next: ActivatedRouteSnapshot,
25 | state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree {
26 | return this.store.select(fromRoot.getIsAuth).pipe(take(1));
27 | }
28 |
29 | canLoad(route: Route, segments: UrlSegment[]): Observable | Promise | boolean {
30 | return this.store.select(fromRoot.getIsAuth).pipe(take(1));
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/training.actions.ts:
--------------------------------------------------------------------------------
1 | import {Action} from '@ngrx/store';
2 | import {Exercise} from './exercise.model';
3 |
4 | export const SET_AVAILABLE_TRAININGS = '[Training] Set Available Trainings';
5 | export const SET_FINISHED_TRAININGS = '[Training] Set Finished Trainings';
6 | export const START_TRAINING = '[Training] Start Training';
7 | export const STOP_TRAINING = '[Training] Stop Training';
8 |
9 | export class SetAvailableTrainings implements Action {
10 | readonly type = SET_AVAILABLE_TRAININGS;
11 |
12 | constructor(public payload: Exercise[]) {
13 | }
14 | }
15 |
16 | export class SetFinishedTrainings implements Action {
17 | readonly type = SET_FINISHED_TRAININGS;
18 |
19 | constructor(public payload: Exercise[]) {
20 | }
21 | }
22 |
23 | export class StartTraining implements Action {
24 | readonly type = START_TRAINING;
25 |
26 | constructor(public payload: string) {
27 | }
28 | }
29 |
30 | export class StopTraining implements Action {
31 | readonly type = STOP_TRAINING;
32 | }
33 |
34 | export type TrainingActions = SetAvailableTrainings | SetFinishedTrainings | StartTraining | StopTraining;
35 |
--------------------------------------------------------------------------------
/fitness-tracker/README.md:
--------------------------------------------------------------------------------
1 | # FitnessTracker
2 |
3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.8.
4 |
5 | ## Development server
6 |
7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
8 |
9 | ## Code scaffolding
10 |
11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12 |
13 | ## Build
14 |
15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
16 |
17 | ## Running unit tests
18 |
19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20 |
21 | ## Running end-to-end tests
22 |
23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24 |
25 | ## Further help
26 |
27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
28 |
--------------------------------------------------------------------------------
/src/ng-refresher/README.md:
--------------------------------------------------------------------------------
1 | # NgRefresher
2 |
3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.6.
4 |
5 | ## Development server
6 |
7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
8 |
9 | ## Code scaffolding
10 |
11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12 |
13 | ## Build
14 |
15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
16 |
17 | ## Running unit tests
18 |
19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20 |
21 | ## Running end-to-end tests
22 |
23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24 |
25 | ## Further help
26 |
27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
28 |
--------------------------------------------------------------------------------
/fitness-tracker/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, './coverage/fitness-tracker'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/src/ng-refresher/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, './coverage/ng-refresher'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false,
30 | restartOnFileChange: true
31 | });
32 | };
33 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/training.module.ts:
--------------------------------------------------------------------------------
1 | import {NgModule} from '@angular/core';
2 | import {StoreModule} from '@ngrx/store';
3 | import {SharedModule} from '../shared/shared.module';
4 |
5 | import {TrainingComponent} from './training.component';
6 | import {CurrentTrainingComponent} from './current-training/current-training.component';
7 | import {NewTrainingComponent} from './new-training/new-training.component';
8 | import {PastTrainingsComponent} from './past-trainings/past-trainings.component';
9 | import {StopTrainingComponent} from './current-training/stop-training/stop-training.component';
10 | import {TrainingRoutingModule} from './training-routing.module';
11 | import {trainingReducer} from './training.reducer';
12 |
13 |
14 | @NgModule({
15 | declarations: [
16 | TrainingComponent,
17 | CurrentTrainingComponent,
18 | NewTrainingComponent,
19 | PastTrainingsComponent,
20 | StopTrainingComponent
21 | ],
22 | imports: [
23 | SharedModule,
24 | TrainingRoutingModule,
25 | StoreModule.forFeature('training', trainingReducer)
26 | ],
27 | entryComponents: [StopTrainingComponent]
28 | })
29 | export class TrainingModule {
30 | }
31 |
--------------------------------------------------------------------------------
/fitness-tracker/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false,
7 | firebase: {
8 | apiKey: "AIzaSyAL8mRiMhConrQ_2aWWT82xulT6uiUvI90",
9 | authDomain: "ud-ng-fitness-tracker.firebaseapp.com",
10 | databaseURL: "https://ud-ng-fitness-tracker.firebaseio.com",
11 | projectId: "ud-ng-fitness-tracker",
12 | storageBucket: "ud-ng-fitness-tracker.appspot.com",
13 | messagingSenderId: "94347406266",
14 | appId: "1:94347406266:web:78e861b0d69c9b8e2f4b83",
15 | measurementId: "G-0KW97X8DLS"
16 | }
17 | };
18 |
19 | /*
20 | * For easier debugging in development mode, you can import the following file
21 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
22 | *
23 | * This import should be commented out in production mode because it will have a negative impact
24 | * on performance if an error is thrown.
25 | */
26 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
27 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/auth/signup/signup.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, OnInit} from '@angular/core';
2 | import {NgForm} from '@angular/forms';
3 | import {AuthService} from '../auth.service';
4 | import {UiService} from '../../shared/ui.service';
5 | import {Observable, Subscription} from 'rxjs';
6 | import {Store} from '@ngrx/store';
7 | import * as fromRoot from '../../app.reducer';
8 |
9 | @Component({
10 | selector: 'app-signup',
11 | templateUrl: './signup.component.html',
12 | styleUrls: ['./signup.component.scss']
13 | })
14 | export class SignupComponent implements OnInit {
15 | maxDate;
16 | isLoading$: Observable;
17 | private loadingSubs: Subscription;
18 |
19 | constructor(
20 | private authService: AuthService,
21 | private uiService: UiService,
22 | private store: Store
23 | ) {
24 | }
25 |
26 | ngOnInit() {
27 | this.isLoading$ = this.store.select(fromRoot.getIsLoading);
28 | this.maxDate = new Date();
29 | this.maxDate.setFullYear(this.maxDate.getFullYear() - 18);
30 | }
31 |
32 | onSubmit(form: NgForm) {
33 | this.authService.registerUser({
34 | email: form.value.email,
35 | password: form.value.password
36 | });
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 | import { RouterTestingModule } from '@angular/router/testing';
3 | import { AppComponent } from './app.component';
4 |
5 | describe('AppComponent', () => {
6 | beforeEach(async(() => {
7 | TestBed.configureTestingModule({
8 | imports: [
9 | RouterTestingModule
10 | ],
11 | declarations: [
12 | AppComponent
13 | ],
14 | }).compileComponents();
15 | }));
16 |
17 | it('should create the app', () => {
18 | const fixture = TestBed.createComponent(AppComponent);
19 | const app = fixture.debugElement.componentInstance;
20 | expect(app).toBeTruthy();
21 | });
22 |
23 | it(`should have as title 'ng-refresher'`, () => {
24 | const fixture = TestBed.createComponent(AppComponent);
25 | const app = fixture.debugElement.componentInstance;
26 | expect(app.title).toEqual('ng-refresher');
27 | });
28 |
29 | it('should render title', () => {
30 | const fixture = TestBed.createComponent(AppComponent);
31 | fixture.detectChanges();
32 | const compiled = fixture.debugElement.nativeElement;
33 | expect(compiled.querySelector('.content span').textContent).toContain('ng-refresher app is running!');
34 | });
35 | });
36 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 | import { RouterTestingModule } from '@angular/router/testing';
3 | import { AppComponent } from './app.component';
4 |
5 | describe('AppComponent', () => {
6 | beforeEach(async(() => {
7 | TestBed.configureTestingModule({
8 | imports: [
9 | RouterTestingModule
10 | ],
11 | declarations: [
12 | AppComponent
13 | ],
14 | }).compileComponents();
15 | }));
16 |
17 | it('should create the app', () => {
18 | const fixture = TestBed.createComponent(AppComponent);
19 | const app = fixture.debugElement.componentInstance;
20 | expect(app).toBeTruthy();
21 | });
22 |
23 | it(`should have as title 'fitness-tracker'`, () => {
24 | const fixture = TestBed.createComponent(AppComponent);
25 | const app = fixture.debugElement.componentInstance;
26 | expect(app.title).toEqual('fitness-tracker');
27 | });
28 |
29 | it('should render title', () => {
30 | const fixture = TestBed.createComponent(AppComponent);
31 | fixture.detectChanges();
32 | const compiled = fixture.debugElement.nativeElement;
33 | expect(compiled.querySelector('.content span').textContent).toContain('fitness-tracker app is running!');
34 | });
35 | });
36 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule } from '@angular/core';
3 | import {FormsModule} from '@angular/forms';
4 |
5 | import { AppRoutingModule } from './app-routing.module';
6 | import { AppComponent } from './app.component';
7 | import { ProductsComponent } from './products/products.component';
8 | import { ProductComponent } from './products/product/product.component';
9 | import {FaIconLibrary, FontAwesomeModule} from '@fortawesome/angular-fontawesome';
10 | import {fas} from '@fortawesome/free-solid-svg-icons';
11 | import {far} from '@fortawesome/free-regular-svg-icons';
12 | import {fab} from '@fortawesome/free-brands-svg-icons';
13 | import { HomeComponent } from './home/home.component';
14 | import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
15 |
16 | @NgModule({
17 | declarations: [
18 | AppComponent,
19 | ProductsComponent,
20 | ProductComponent,
21 | HomeComponent
22 | ],
23 | imports: [
24 | BrowserModule,
25 | FontAwesomeModule,
26 | AppRoutingModule,
27 | FormsModule,
28 | BrowserAnimationsModule
29 | ],
30 | providers: [],
31 | bootstrap: [AppComponent]
32 | })
33 | export class AppModule {
34 | constructor(library: FaIconLibrary) {
35 | library.addIconPacks(fas, far, fab);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/new-training/new-training.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, OnInit} from '@angular/core';
2 | import {NgForm} from '@angular/forms';
3 | import {Observable} from 'rxjs';
4 | import {Store} from '@ngrx/store';
5 |
6 | import {TrainingService} from '../training.service';
7 | import {Exercise} from '../exercise.model';
8 | import {UiService} from '../../shared/ui.service';
9 | import * as fromTraining from '../training.reducer';
10 | import * as fromRoot from '../../app.reducer';
11 |
12 | @Component({
13 | selector: 'app-new-training',
14 | templateUrl: './new-training.component.html',
15 | styleUrls: ['./new-training.component.scss']
16 | })
17 | export class NewTrainingComponent implements OnInit {
18 | exercises$: Observable;
19 | isLoading$: Observable;
20 |
21 | constructor(
22 | private trainingService: TrainingService,
23 | private uiService: UiService,
24 | private store: Store
25 | ) {
26 | }
27 |
28 | ngOnInit() {
29 | this.isLoading$ = this.store.select(fromRoot.getIsLoading);
30 | this.exercises$ = this.store.select(fromTraining.getAvailableExercises);
31 | this.fetchExercises();
32 | }
33 |
34 | fetchExercises() {
35 | this.trainingService.fetchAvailableExercises();
36 | }
37 |
38 | onStartTraining(form: NgForm) {
39 | this.trainingService.startExercise(form.value.exercise);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/new-training/new-training.component.html:
--------------------------------------------------------------------------------
1 |
45 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import {BrowserModule} from '@angular/platform-browser';
2 | import {NgModule} from '@angular/core';
3 | import {FlexLayoutModule} from '@angular/flex-layout';
4 | import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
5 |
6 | import {AngularFireModule} from '@angular/fire';
7 | import {AngularFirestoreModule} from '@angular/fire/firestore';
8 | import {StoreModule} from '@ngrx/store';
9 |
10 | import {environment} from '../environments/environment';
11 | import {AppRoutingModule} from './app-routing.module';
12 |
13 | import {MaterialModule} from './material.module';
14 |
15 | import {AppComponent} from './app.component';
16 | import {WelcomeComponent} from './welcome/welcome.component';
17 | import {HeaderComponent} from './navigation/header/header.component';
18 | import {SidenavListComponent} from './navigation/sidenav-list/sidenav-list.component';
19 | import {AuthService} from './auth/auth.service';
20 | import {AuthModule} from './auth/auth.module';
21 | import {reducers} from './app.reducer';
22 |
23 |
24 | @NgModule({
25 | declarations: [
26 | AppComponent,
27 | WelcomeComponent,
28 | HeaderComponent,
29 | SidenavListComponent
30 | ],
31 | imports: [
32 | BrowserModule,
33 | BrowserAnimationsModule,
34 | MaterialModule,
35 | AppRoutingModule,
36 | FlexLayoutModule,
37 | AngularFireModule.initializeApp(environment.firebase),
38 | AuthModule,
39 | AngularFirestoreModule,
40 | StoreModule.forRoot(reducers)
41 | ],
42 | providers: [AuthService],
43 | bootstrap: [AppComponent]
44 | })
45 | export class AppModule {
46 | }
47 |
--------------------------------------------------------------------------------
/fitness-tracker/src/styles.scss:
--------------------------------------------------------------------------------
1 |
2 | // Custom Theming for Angular Material
3 | // For more information: https://material.angular.io/guide/theming
4 | @import '~@angular/material/theming';
5 | // Plus imports for other components in your app.
6 |
7 | // Include the common styles for Angular Material. We include this here so that you only
8 | // have to load a single css file for Angular Material in your app.
9 | // Be sure that you only ever include this mixin once!
10 | @include mat-core();
11 |
12 | // Define the palettes for your theme using the Material Design palettes available in palette.scss
13 | // (imported above). For each palette, you can optionally specify a default, lighter, and darker
14 | // hue. Available color palettes: https://material.io/design/color/
15 | $fitness-tracker-primary: mat-palette($mat-blue-grey);
16 | $fitness-tracker-accent: mat-palette($mat-pink, A200, A100, A400);
17 |
18 | // The warn palette is optional (defaults to red).
19 | $fitness-tracker-warn: mat-palette($mat-red);
20 |
21 | // Create the theme object (a Sass map containing all of the palettes).
22 | $fitness-tracker-theme: mat-light-theme($fitness-tracker-primary, $fitness-tracker-accent, $fitness-tracker-warn);
23 |
24 | // Include theme styles for core and each component used in your app.
25 | // Alternatively, you can import and @include the theme mixins for each component
26 | // that you are using.
27 | @include angular-material-theme($fitness-tracker-theme);
28 |
29 | /* You can add global styles to this file, and also import other style files */
30 |
31 | html, body { height: 100%; }
32 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
33 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/auth/login/login.component.html:
--------------------------------------------------------------------------------
1 |
51 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/app/products/products.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, OnDestroy, OnInit} from '@angular/core';
2 |
3 | import {faCoffee} from '@fortawesome/free-solid-svg-icons';
4 | import {ProductsService} from './products.service';
5 | import {NgForm} from '@angular/forms';
6 | import {Subscription} from 'rxjs';
7 |
8 | @Component({
9 | selector: 'app-products',
10 | templateUrl: './products.component.html',
11 | styleUrls: ['./products.component.scss']
12 | })
13 | export class ProductsComponent implements OnInit, OnDestroy {
14 | faCoffee = faCoffee;
15 | productName = 'book';
16 | isDisabled = true;
17 | products: string[];
18 |
19 | private productsSubscription: Subscription;
20 |
21 |
22 | constructor(
23 | private productsService: ProductsService
24 | ) {
25 | setTimeout(() => {
26 | this.isDisabled = false;
27 | }, 3000);
28 | }
29 |
30 | ngOnInit() {
31 | this.products = this.productsService.getProducts();
32 |
33 | this.productsSubscription = this.productsService.productsUpdated.subscribe(() => {
34 | this.products = this.productsService.getProducts();
35 | });
36 | }
37 |
38 |
39 | onAddProduct(form: NgForm) {
40 | if (form.valid) {
41 | this.productsService.addProduct(form.value.productName);
42 | // this.products.push(form.value.productName);
43 | }
44 | console.log('*** form ', form);
45 | }
46 |
47 | onRemoveProduct(productName: string) {
48 | this.products = this.products.filter(p => p !== productName);
49 | }
50 |
51 | ngOnDestroy(): void {
52 | if (this.productsSubscription) {
53 | this.productsSubscription.unsubscribe();
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/past-trainings/past-trainings.component.ts:
--------------------------------------------------------------------------------
1 | import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core';
2 | import {MatTableDataSource} from '@angular/material/table';
3 | import {MatSort} from '@angular/material/sort';
4 | import {Exercise} from '../exercise.model';
5 | import {TrainingService} from '../training.service';
6 | import {MatPaginator} from '@angular/material/paginator';
7 | import {Store} from '@ngrx/store';
8 | import * as fromTraining from '../training.reducer';
9 |
10 | @Component({
11 | selector: 'app-past-trainings',
12 | templateUrl: './past-trainings.component.html',
13 | styleUrls: ['./past-trainings.component.scss']
14 | })
15 | export class PastTrainingsComponent implements OnInit, AfterViewInit {
16 | displayedColumns = ['date', 'name', 'duration', 'calories', 'state'];
17 | dataSource = new MatTableDataSource();
18 |
19 | @ViewChild(MatSort, {static: false}) sort: MatSort;
20 | @ViewChild(MatPaginator, {static: false}) paginator: MatPaginator;
21 |
22 | constructor(
23 | private trainingService: TrainingService,
24 | private store: Store
25 | ) {
26 | }
27 |
28 | ngOnInit() {
29 | this.store.select(fromTraining.getFinishedExercises).subscribe(
30 | (exercises: Exercise[]) => {
31 | this.dataSource.data = exercises;
32 | });
33 | this.trainingService.fetchCompletedOrCancelledExercises();
34 | }
35 |
36 | ngAfterViewInit(): void {
37 | this.dataSource.sort = this.sort;
38 | this.dataSource.paginator = this.paginator;
39 | }
40 |
41 | doFilter(filterValue: string) {
42 | this.dataSource.filter = filterValue.trim().toLowerCase();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/material.module.ts:
--------------------------------------------------------------------------------
1 | import {NgModule} from '@angular/core';
2 | import {
3 | MatButtonModule,
4 | MatIconModule,
5 | MatFormFieldModule,
6 | MatInputModule,
7 | MatDatepickerModule,
8 | MatNativeDateModule,
9 | MatCheckboxModule,
10 | MatCardModule,
11 | MatToolbarModule,
12 | MatSidenavModule,
13 | MatListModule,
14 | MatTabsModule,
15 | MatSelectModule,
16 | MatProgressSpinnerModule,
17 | MatDialogModule,
18 | MatTableModule,
19 | MatSortModule,
20 | MatPaginatorModule,
21 | MatSnackBarModule
22 | } from '@angular/material';
23 |
24 |
25 | // @ts-ignore
26 | @NgModule({
27 | imports: [
28 | MatButtonModule,
29 | MatIconModule,
30 | MatFormFieldModule,
31 | MatInputModule,
32 | MatDatepickerModule,
33 | MatNativeDateModule,
34 | MatCheckboxModule,
35 | MatCardModule,
36 | MatToolbarModule,
37 | MatSidenavModule,
38 | MatListModule,
39 | MatTabsModule,
40 | MatSelectModule,
41 | MatProgressSpinnerModule,
42 | MatDialogModule,
43 | MatTableModule,
44 | MatSortModule,
45 | MatPaginatorModule,
46 | MatSnackBarModule
47 | ],
48 | exports: [
49 | MatButtonModule,
50 | MatIconModule,
51 | MatFormFieldModule,
52 | MatInputModule,
53 | MatDatepickerModule,
54 | MatNativeDateModule,
55 | MatCheckboxModule,
56 | MatCardModule,
57 | MatToolbarModule,
58 | MatSidenavModule,
59 | MatListModule,
60 | MatTabsModule,
61 | MatSelectModule,
62 | MatProgressSpinnerModule,
63 | MatDialogModule,
64 | MatTableModule,
65 | MatSortModule,
66 | MatPaginatorModule,
67 | MatSnackBarModule
68 | ]
69 | })
70 | export class MaterialModule {
71 | }
72 |
--------------------------------------------------------------------------------
/fitness-tracker/.firebase/hosting.ZGlzdA.cache:
--------------------------------------------------------------------------------
1 | 404.html,1576839309104,daa499dd96d8229e73235345702ba32f0793f0c8e5c0d30e40e37a5872be57aa
2 | index.html,1576839287883,14d14080bd1df8f1618a7f76537810d7802cc694c901a52b4abcbd0ff08916cd
3 | fitness-tracker/3rdpartylicenses.txt,1576838743799,62da55b48da35d4c8f79e97b759095e2a195dc1f67e8400bde2833f7bbc0a428
4 | fitness-tracker/5-es2015.7e93a3e37861b3f502ac.js,1576838750199,7ff68d05d03c8ea5bd335e8ad62a5e3fd9407a459f2cb9855216e0b723ad61f1
5 | fitness-tracker/5-es5.7e93a3e37861b3f502ac.js,1576838750278,91955a24a01551b9e2e3c2e28423031a2dc1d418482cfc1ad339a061e1be546f
6 | fitness-tracker/favicon.ico,1576838743799,2c19690e9587bae12f419b34d2edeecc76808099540a9c9f4ea6194116cfc8f7
7 | fitness-tracker/index.html,1576838775437,ed247de1b9022857dbdbf073b99951366a7ee6e39e680723a8f2636b757bc94b
8 | fitness-tracker/main-es2015.666ba4ff23f9c5e9bb91.js,1576838773316,6e0afaccb3bec89d1191f5681cccdf1e0b2cf5c547c32318f9dcdbdda48ea45e
9 | fitness-tracker/main-es5.666ba4ff23f9c5e9bb91.js,1576838773993,6164cb1ad89465a85067089b52687e5335fdead164054db3fed2b5e8cd3f4a4d
10 | fitness-tracker/polyfills-es2015.d3e61f0dd2b58e518eca.js,1576505680014,597aea6bf09f25be57228b80f045822d8676487b3d34889cb9ac784dc50a0ac5
11 | fitness-tracker/polyfills-es5.f8b5a32bf736d11d106f.js,1576505684833,65670f29a9229491e31bda99f6c28adb8227b22be24790debe8663b141cfd0b3
12 | fitness-tracker/runtime-es2015.956a10688bece798081c.js,1576838775406,e7d57c4ecd3573878abe6be38d3ab6aa1509eac176fa5fd63ee7cb9b8bbcce31
13 | fitness-tracker/runtime-es5.956a10688bece798081c.js,1576838775423,818e48f8cb54d72813dcae89227a010581823d3a754b8d7439e8defda7296b8a
14 | fitness-tracker/styles.8e081f12c68d8382ae0c.css,1576838743800,b159afd1b08f8fd687a3f86d31d1f19ade2e4265ac81b6c4c97805ed45fd0667
15 |
--------------------------------------------------------------------------------
/src/ng-refresher/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ng-refresher",
3 | "version": "0.0.0",
4 | "scripts": {
5 | "ng": "ng",
6 | "start": "ng serve",
7 | "build": "ng build",
8 | "test": "ng test",
9 | "lint": "ng lint",
10 | "e2e": "ng e2e"
11 | },
12 | "private": true,
13 | "dependencies": {
14 | "@angular/animations": "~8.2.8",
15 | "@angular/common": "~8.2.8",
16 | "@angular/compiler": "~8.2.8",
17 | "@angular/core": "~8.2.8",
18 | "@angular/forms": "~8.2.8",
19 | "@angular/platform-browser": "~8.2.8",
20 | "@angular/platform-browser-dynamic": "~8.2.8",
21 | "@angular/router": "~8.2.8",
22 | "@fortawesome/angular-fontawesome": "^0.5.0",
23 | "@fortawesome/fontawesome-svg-core": "^1.2.25",
24 | "@fortawesome/free-brands-svg-icons": "^5.11.2",
25 | "@fortawesome/free-regular-svg-icons": "^5.11.2",
26 | "@fortawesome/free-solid-svg-icons": "^5.11.2",
27 | "rxjs": "~6.4.0",
28 | "tslib": "^1.10.0",
29 | "zone.js": "~0.9.1"
30 | },
31 | "devDependencies": {
32 | "@angular-devkit/build-angular": "~0.803.6",
33 | "@angular/cli": "~8.3.6",
34 | "@angular/compiler-cli": "~8.2.8",
35 | "@angular/language-service": "~8.2.8",
36 | "@types/node": "~8.9.4",
37 | "@types/jasmine": "~3.3.8",
38 | "@types/jasminewd2": "~2.0.3",
39 | "codelyzer": "^5.0.0",
40 | "jasmine-core": "~3.4.0",
41 | "jasmine-spec-reporter": "~4.2.1",
42 | "karma": "~4.1.0",
43 | "karma-chrome-launcher": "~2.2.0",
44 | "karma-coverage-istanbul-reporter": "~2.0.1",
45 | "karma-jasmine": "~2.0.1",
46 | "karma-jasmine-html-reporter": "^1.4.0",
47 | "protractor": "~5.4.0",
48 | "ts-node": "~7.0.0",
49 | "tslint": "~5.15.0",
50 | "typescript": "~3.5.3"
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/fitness-tracker/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "fitness-tracker",
3 | "version": "0.0.0",
4 | "scripts": {
5 | "ng": "ng",
6 | "start": "ng serve",
7 | "build": "ng build",
8 | "test": "ng test",
9 | "lint": "ng lint",
10 | "e2e": "ng e2e"
11 | },
12 | "private": true,
13 | "dependencies": {
14 | "@angular/animations": "~8.2.9",
15 | "@angular/cdk": "^8.2.3",
16 | "@angular/common": "~8.2.9",
17 | "@angular/compiler": "~8.2.9",
18 | "@angular/core": "~8.2.9",
19 | "@angular/fire": "^5.2.3",
20 | "@angular/flex-layout": "^8.0.0-beta.27",
21 | "@angular/forms": "~8.2.9",
22 | "@angular/material": "^8.2.3",
23 | "@angular/platform-browser": "~8.2.9",
24 | "@angular/platform-browser-dynamic": "~8.2.9",
25 | "@angular/router": "~8.2.9",
26 | "@ngrx/store": "^8.5.2",
27 | "firebase": "^7.5.2",
28 | "hammerjs": "^2.0.8",
29 | "rxjs": "~6.4.0",
30 | "rxjs-compat": "^6.5.3",
31 | "tslib": "^1.10.0",
32 | "zone.js": "~0.9.1"
33 | },
34 | "devDependencies": {
35 | "@angular-devkit/build-angular": "~0.803.8",
36 | "@angular/cli": "~8.3.8",
37 | "@angular/compiler-cli": "~8.2.9",
38 | "@angular/language-service": "~8.2.9",
39 | "@types/node": "~8.9.4",
40 | "@types/jasmine": "~3.3.8",
41 | "@types/jasminewd2": "~2.0.3",
42 | "codelyzer": "^5.0.0",
43 | "jasmine-core": "~3.4.0",
44 | "jasmine-spec-reporter": "~4.2.1",
45 | "karma": "~4.1.0",
46 | "karma-chrome-launcher": "~2.2.0",
47 | "karma-coverage-istanbul-reporter": "~2.0.1",
48 | "karma-jasmine": "~2.0.1",
49 | "karma-jasmine-html-reporter": "^1.4.0",
50 | "protractor": "~5.4.0",
51 | "ts-node": "~7.0.0",
52 | "tslint": "~5.15.0",
53 | "typescript": "~3.5.3"
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/auth/login/login.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, OnDestroy, OnInit} from '@angular/core';
2 | import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
3 | import {Observable, Subscription} from 'rxjs';
4 | import {map} from 'rxjs/operators';
5 | import {Store} from '@ngrx/store';
6 | import {AuthService} from '../auth.service';
7 | import {UiService} from '../../shared/ui.service';
8 | import * as fromRoot from '../../app.reducer';
9 |
10 | @Component({
11 | selector: 'app-login',
12 | templateUrl: './login.component.html',
13 | styleUrls: ['./login.component.scss']
14 | })
15 | export class LoginComponent implements OnInit {
16 | loginForm: FormGroup;
17 | isLoading$: Observable;
18 | private loadingSubs: Subscription;
19 |
20 | constructor(
21 | private fb: FormBuilder,
22 | private authService: AuthService,
23 | private uiService: UiService,
24 | private store: Store
25 | ) {
26 | }
27 |
28 | get email() {
29 | return this.loginForm.get('email');
30 | }
31 |
32 | get password() {
33 | return this.loginForm.get('password');
34 | }
35 |
36 | ngOnInit() {
37 | this.isLoading$ = this.store.select(fromRoot.getIsLoading);
38 |
39 | /*this.loadingSubs = this.uiService.loadingStateChanged.subscribe( isloadingState => this.isLoading = isloadingState);*/
40 |
41 | this.loginForm = this.fb.group({
42 | email: ['', [Validators.required, Validators.email]],
43 | password: ['', Validators.required]
44 | });
45 | }
46 |
47 | onSubmit() {
48 | this.authService.login({
49 | email: this.loginForm.value.email,
50 | password: this.loginForm.value.password
51 | });
52 | }
53 |
54 | /*ngOnDestroy(): void {
55 | if (this.loadingSubs) {
56 | this.loadingSubs.unsubscribe();
57 | }
58 | }*/
59 | }
60 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/current-training/current-training.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, EventEmitter, OnInit} from '@angular/core';
2 | import {MatDialog} from '@angular/material/dialog';
3 | import {Store} from '@ngrx/store';
4 | import {StopTrainingComponent} from './stop-training/stop-training.component';
5 | import {TrainingService} from '../training.service';
6 | import * as fromTraining from '../training.reducer';
7 | import {take} from 'rxjs/operators';
8 |
9 | @Component({
10 | selector: 'app-current-training',
11 | templateUrl: './current-training.component.html',
12 | styleUrls: ['./current-training.component.scss']
13 | })
14 | export class CurrentTrainingComponent implements OnInit {
15 |
16 | progress = 0;
17 | timer: number;
18 |
19 | constructor(
20 | private dialog: MatDialog,
21 | private trainingService: TrainingService,
22 | private store: Store
23 | ) {
24 | }
25 |
26 | ngOnInit() {
27 | this.startOrResumeTimer();
28 | }
29 |
30 | startOrResumeTimer() {
31 | this.store.select(fromTraining.getActiveTraining)
32 | .pipe(take(1))
33 | .subscribe(ex => {
34 | const step = ex.duration / 100 * 1000;
35 | this.timer = setInterval(() => {
36 | this.progress += 1;
37 | if (this.progress >= 100) {
38 | this.trainingService.completeExercise();
39 | clearInterval(this.timer);
40 | }
41 | }, step);
42 | });
43 | }
44 |
45 | onStop() {
46 | clearInterval(this.timer);
47 | const dialogRef = this.dialog.open(StopTrainingComponent, {
48 | data: {
49 | progress: this.progress
50 | }
51 | });
52 |
53 | dialogRef.afterClosed().subscribe(result => {
54 | if (result) {
55 | this.trainingService.cancelExercise(this.progress);
56 | } else {
57 | this.startOrResumeTimer();
58 | }
59 | });
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/past-trainings/past-trainings.component.html:
--------------------------------------------------------------------------------
1 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/training.reducer.ts:
--------------------------------------------------------------------------------
1 | import {
2 | SET_AVAILABLE_TRAININGS,
3 | SET_FINISHED_TRAININGS,
4 | START_TRAINING,
5 | STOP_TRAINING,
6 | TrainingActions
7 | } from './training.actions';
8 | import {Exercise} from './exercise.model';
9 |
10 | import * as fromRoot from '../app.reducer';
11 | import {createFeatureSelector, createSelector} from '@ngrx/store';
12 |
13 | export interface TrainingState {
14 | availableExercises: Exercise[];
15 | finishedExercises: Exercise[];
16 | activeTraining: Exercise;
17 | }
18 |
19 | export interface State extends fromRoot.State {
20 | training: TrainingState;
21 | }
22 |
23 | const initialState: TrainingState = {
24 | availableExercises: [],
25 | finishedExercises: [],
26 | activeTraining: null
27 | };
28 |
29 | export function trainingReducer(state = initialState, action: TrainingActions) {
30 | switch (action.type) {
31 | case SET_AVAILABLE_TRAININGS:
32 | return {
33 | ...state,
34 | availableExercises: action.payload
35 | };
36 | case SET_FINISHED_TRAININGS:
37 | return {
38 | ...state,
39 | finishedExercises: action.payload
40 | };
41 | case START_TRAINING:
42 | return {
43 | ...state,
44 | activeTraining: {...state.availableExercises.find(ex => ex.id === action.payload)}
45 | };
46 | case STOP_TRAINING:
47 | return {
48 | ...state,
49 | activeTraining: null
50 | };
51 | default: {
52 | return state;
53 | }
54 | }
55 | }
56 |
57 | export const getTrainingState = createFeatureSelector('training');
58 |
59 | export const getAvailableExercises = createSelector(getTrainingState, (state: TrainingState) => state.availableExercises);
60 | export const getFinishedExercises = createSelector(getTrainingState, (state: TrainingState) => state.finishedExercises);
61 | export const getActiveTraining = createSelector(getTrainingState, (state: TrainingState) => state.activeTraining);
62 | export const getIsTraining = createSelector(getTrainingState, (state: TrainingState) => state.activeTraining != null );
63 |
--------------------------------------------------------------------------------
/fitness-tracker/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "tslint:recommended",
3 | "rules": {
4 | "array-type": false,
5 | "arrow-parens": false,
6 | "deprecation": {
7 | "severity": "warning"
8 | },
9 | "component-class-suffix": true,
10 | "contextual-lifecycle": true,
11 | "directive-class-suffix": true,
12 | "directive-selector": [
13 | true,
14 | "attribute",
15 | "app",
16 | "camelCase"
17 | ],
18 | "component-selector": [
19 | true,
20 | "element",
21 | "app",
22 | "kebab-case"
23 | ],
24 | "import-blacklist": [
25 | true,
26 | "rxjs/Rx"
27 | ],
28 | "interface-name": false,
29 | "max-classes-per-file": false,
30 | "max-line-length": [
31 | true,
32 | 140
33 | ],
34 | "member-access": false,
35 | "member-ordering": [
36 | true,
37 | {
38 | "order": [
39 | "static-field",
40 | "instance-field",
41 | "static-method",
42 | "instance-method"
43 | ]
44 | }
45 | ],
46 | "no-consecutive-blank-lines": false,
47 | "no-console": [
48 | true,
49 | "debug",
50 | "info",
51 | "time",
52 | "timeEnd",
53 | "trace"
54 | ],
55 | "no-empty": false,
56 | "no-inferrable-types": [
57 | true,
58 | "ignore-params"
59 | ],
60 | "no-non-null-assertion": true,
61 | "no-redundant-jsdoc": true,
62 | "no-switch-case-fall-through": true,
63 | "no-var-requires": false,
64 | "object-literal-key-quotes": [
65 | true,
66 | "as-needed"
67 | ],
68 | "object-literal-sort-keys": false,
69 | "ordered-imports": false,
70 | "quotemark": [
71 | true,
72 | "single"
73 | ],
74 | "trailing-comma": false,
75 | "no-conflicting-lifecycle": true,
76 | "no-host-metadata-property": true,
77 | "no-input-rename": true,
78 | "no-inputs-metadata-property": true,
79 | "no-output-native": true,
80 | "no-output-on-prefix": true,
81 | "no-output-rename": true,
82 | "no-outputs-metadata-property": true,
83 | "template-banana-in-box": true,
84 | "template-no-negated-async": true,
85 | "use-lifecycle-interface": true,
86 | "use-pipe-transform-interface": true
87 | },
88 | "rulesDirectory": [
89 | "codelyzer"
90 | ]
91 | }
--------------------------------------------------------------------------------
/src/ng-refresher/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "tslint:recommended",
3 | "rules": {
4 | "array-type": false,
5 | "arrow-parens": false,
6 | "deprecation": {
7 | "severity": "warning"
8 | },
9 | "component-class-suffix": true,
10 | "contextual-lifecycle": true,
11 | "directive-class-suffix": true,
12 | "directive-selector": [
13 | true,
14 | "attribute",
15 | "app",
16 | "camelCase"
17 | ],
18 | "component-selector": [
19 | true,
20 | "element",
21 | "app",
22 | "kebab-case"
23 | ],
24 | "import-blacklist": [
25 | true,
26 | "rxjs/Rx"
27 | ],
28 | "interface-name": false,
29 | "max-classes-per-file": false,
30 | "max-line-length": [
31 | true,
32 | 140
33 | ],
34 | "member-access": false,
35 | "member-ordering": [
36 | true,
37 | {
38 | "order": [
39 | "static-field",
40 | "instance-field",
41 | "static-method",
42 | "instance-method"
43 | ]
44 | }
45 | ],
46 | "no-consecutive-blank-lines": false,
47 | "no-console": [
48 | true,
49 | "debug",
50 | "info",
51 | "time",
52 | "timeEnd",
53 | "trace"
54 | ],
55 | "no-empty": false,
56 | "no-inferrable-types": [
57 | true,
58 | "ignore-params"
59 | ],
60 | "no-non-null-assertion": true,
61 | "no-redundant-jsdoc": true,
62 | "no-switch-case-fall-through": true,
63 | "no-use-before-declare": true,
64 | "no-var-requires": false,
65 | "object-literal-key-quotes": [
66 | true,
67 | "as-needed"
68 | ],
69 | "object-literal-sort-keys": false,
70 | "ordered-imports": false,
71 | "quotemark": [
72 | true,
73 | "single"
74 | ],
75 | "trailing-comma": false,
76 | "no-conflicting-lifecycle": true,
77 | "no-host-metadata-property": true,
78 | "no-input-rename": true,
79 | "no-inputs-metadata-property": true,
80 | "no-output-native": true,
81 | "no-output-on-prefix": true,
82 | "no-output-rename": true,
83 | "no-outputs-metadata-property": true,
84 | "template-banana-in-box": true,
85 | "template-no-negated-async": true,
86 | "use-lifecycle-interface": true,
87 | "use-pipe-transform-interface": true
88 | },
89 | "rulesDirectory": [
90 | "codelyzer"
91 | ]
92 | }
--------------------------------------------------------------------------------
/fitness-tracker/src/app/auth/signup/signup.component.html:
--------------------------------------------------------------------------------
1 |
78 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/auth/auth.service.ts:
--------------------------------------------------------------------------------
1 | import {Injectable} from '@angular/core';
2 | import {Router} from '@angular/router';
3 | import {AngularFireAuth} from '@angular/fire/auth';
4 | import {Store} from '@ngrx/store';
5 |
6 | import {AuthData} from './auth-data.model';
7 | import {TrainingService} from '../training/training.service';
8 | import {UiService} from '../shared/ui.service';
9 | import * as fromRoot from '../app.reducer';
10 | import * as UI from '../shared/ui.actions';
11 | import * as Auth from './auth.actions';
12 |
13 | @Injectable({
14 | providedIn: 'root'
15 | })
16 | export class AuthService {
17 | constructor(
18 | private router: Router,
19 | private afAuth: AngularFireAuth,
20 | private trainingService: TrainingService,
21 | private uiService: UiService,
22 | private store: Store
23 | ) {
24 | }
25 |
26 | initAuthListener() {
27 | this.afAuth.authState.subscribe(
28 | user => {
29 | if (user) {
30 | this.store.dispatch(new Auth.SetAuthenticated());
31 | this.router.navigate(['/training']);
32 | } else {
33 | this.trainingService.cancelSubscriptions();
34 | this.store.dispatch(new Auth.SetUnauthenticated());
35 | this.router.navigate(['/login']);
36 | }
37 | }
38 | );
39 | }
40 |
41 | registerUser(authData: AuthData) {
42 | // this.uiService.loadingStateChanged.next(true);
43 | this.store.dispatch(new UI.StartLoading());
44 | this.afAuth
45 | .auth.createUserWithEmailAndPassword(authData.email, authData.password)
46 | .then(result => {
47 | console.log('*** ', result);
48 | // this.uiService.loadingStateChanged.next(false);
49 | this.store.dispatch(new UI.StopLoading());
50 | })
51 | .catch(error => {
52 | // this.uiService.loadingStateChanged.next(false);
53 | this.store.dispatch(new UI.StopLoading());
54 | this.uiService.showSnackbar(error.message, null,3000);
55 | });
56 | }
57 |
58 | login(authData: AuthData) {
59 | //this.uiService.loadingStateChanged.next(true);
60 | this.store.dispatch(new UI.StartLoading());
61 | this.afAuth
62 | .auth.signInWithEmailAndPassword(authData.email, authData.password)
63 | .then(result => {
64 | console.log('*** ', result);
65 | // this.uiService.loadingStateChanged.next(false);
66 | this.store.dispatch(new UI.StopLoading());
67 | })
68 | .catch(error => {
69 | // this.uiService.loadingStateChanged.next(false);
70 | this.store.dispatch(new UI.StopLoading());
71 | this.uiService.showSnackbar(error.message, null,3000);
72 | });
73 | }
74 |
75 | logout() {
76 | this.afAuth.auth.signOut();
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/fitness-tracker/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/guide/browser-support
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
22 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
23 |
24 | /**
25 | * Web Animations `@angular/platform-browser/animations`
26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
28 | */
29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
30 |
31 | /**
32 | * By default, zone.js will patch all possible macroTask and DomEvents
33 | * user can disable parts of macroTask/DomEvents patch by setting following flags
34 | * because those flags need to be set before `zone.js` being loaded, and webpack
35 | * will put import in the top of bundle, so user need to create a separate file
36 | * in this directory (for example: zone-flags.ts), and put the following flags
37 | * into that file, and then add the following code before importing zone.js.
38 | * import './zone-flags.ts';
39 | *
40 | * The flags allowed in zone-flags.ts are listed here.
41 | *
42 | * The following flags will work for all browsers.
43 | *
44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
47 | *
48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
50 | *
51 | * (window as any).__Zone_enable_cross_context_check = true;
52 | *
53 | */
54 |
55 | /***************************************************************************************************
56 | * Zone JS is required by default for Angular itself.
57 | */
58 | import 'zone.js/dist/zone'; // Included with Angular CLI.
59 |
60 |
61 | /***************************************************************************************************
62 | * APPLICATION IMPORTS
63 | */
64 |
--------------------------------------------------------------------------------
/src/ng-refresher/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/guide/browser-support
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
22 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
23 |
24 | /**
25 | * Web Animations `@angular/platform-browser/animations`
26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
28 | */
29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
30 |
31 | /**
32 | * By default, zone.js will patch all possible macroTask and DomEvents
33 | * user can disable parts of macroTask/DomEvents patch by setting following flags
34 | * because those flags need to be set before `zone.js` being loaded, and webpack
35 | * will put import in the top of bundle, so user need to create a separate file
36 | * in this directory (for example: zone-flags.ts), and put the following flags
37 | * into that file, and then add the following code before importing zone.js.
38 | * import './zone-flags.ts';
39 | *
40 | * The flags allowed in zone-flags.ts are listed here.
41 | *
42 | * The following flags will work for all browsers.
43 | *
44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
47 | *
48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
50 | *
51 | * (window as any).__Zone_enable_cross_context_check = true;
52 | *
53 | */
54 |
55 | /***************************************************************************************************
56 | * Zone JS is required by default for Angular itself.
57 | */
58 | import 'zone.js/dist/zone'; // Included with Angular CLI.
59 |
60 |
61 | /***************************************************************************************************
62 | * APPLICATION IMPORTS
63 | */
64 |
--------------------------------------------------------------------------------
/fitness-tracker/ dist/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Welcome to Firebase Hosting
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
32 |
33 |
34 |
35 |
Welcome
36 |
Firebase Hosting Setup Complete
37 |
You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary!
38 |
Open Hosting Documentation
39 |
40 | Firebase SDK Loading…
41 |
42 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### Node template
3 | # Logs
4 | logs
5 | *.log
6 | npm-debug.log*
7 | yarn-debug.log*
8 | yarn-error.log*
9 | lerna-debug.log*
10 |
11 | # Diagnostic reports (https://nodejs.org/api/report.html)
12 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
13 |
14 | # Runtime data
15 | pids
16 | *.pid
17 | *.seed
18 | *.pid.lock
19 |
20 | # Directory for instrumented libs generated by jscoverage/JSCover
21 | lib-cov
22 |
23 | # Coverage directory used by tools like istanbul
24 | coverage
25 | *.lcov
26 |
27 | # nyc test coverage
28 | .nyc_output
29 |
30 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
31 | .grunt
32 |
33 | # Bower dependency directory (https://bower.io/)
34 | bower_components
35 |
36 | # node-waf configuration
37 | .lock-wscript
38 |
39 | # Compiled binary addons (https://nodejs.org/api/addons.html)
40 | build/Release
41 |
42 | # Dependency directories
43 | node_modules/
44 | jspm_packages/
45 |
46 | # TypeScript v1 declaration files
47 | typings/
48 |
49 | # TypeScript cache
50 | *.tsbuildinfo
51 |
52 | # Optional npm cache directory
53 | .npm
54 |
55 | # Optional eslint cache
56 | .eslintcache
57 |
58 | # Optional REPL history
59 | .node_repl_history
60 |
61 | # Output of 'npm pack'
62 | *.tgz
63 |
64 | # Yarn Integrity file
65 | .yarn-integrity
66 |
67 | # dotenv environment variables file
68 | .env
69 | .env.test
70 |
71 | # parcel-bundler cache (https://parceljs.org/)
72 | .cache
73 |
74 | # next.js build output
75 | .next
76 |
77 | # nuxt.js build output
78 | .nuxt
79 |
80 | # vuepress build output
81 | .vuepress/dist
82 |
83 | # Serverless directories
84 | .serverless/
85 |
86 | # FuseBox cache
87 | .fusebox/
88 |
89 | # DynamoDB Local files
90 | .dynamodb/
91 |
92 | ### JetBrains template
93 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
94 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
95 |
96 | # User-specific stuff
97 | .idea/**/workspace.xml
98 | .idea/**/tasks.xml
99 | .idea/**/usage.statistics.xml
100 | .idea/**/dictionaries
101 | .idea/**/shelf
102 |
103 | # Generated files
104 | .idea/**/contentModel.xml
105 |
106 | # Sensitive or high-churn files
107 | .idea/**/dataSources/
108 | .idea/**/dataSources.ids
109 | .idea/**/dataSources.local.xml
110 | .idea/**/sqlDataSources.xml
111 | .idea/**/dynamic.xml
112 | .idea/**/uiDesigner.xml
113 | .idea/**/dbnavigator.xml
114 |
115 | # Gradle
116 | .idea/**/gradle.xml
117 | .idea/**/libraries
118 |
119 | # Gradle and Maven with auto-import
120 | # When using Gradle or Maven with auto-import, you should exclude module files,
121 | # since they will be recreated, and may cause churn. Uncomment if using
122 | # auto-import.
123 | # .idea/modules.xml
124 | # .idea/*.iml
125 | # .idea/modules
126 | # *.iml
127 | # *.ipr
128 |
129 | # CMake
130 | cmake-build-*/
131 |
132 | # Mongo Explorer plugin
133 | .idea/**/mongoSettings.xml
134 |
135 | # File-based project format
136 | *.iws
137 |
138 | # IntelliJ
139 | out/
140 |
141 | # mpeltonen/sbt-idea plugin
142 | .idea_modules/
143 |
144 | # JIRA plugin
145 | atlassian-ide-plugin.xml
146 |
147 | # Cursive Clojure plugin
148 | .idea/replstate.xml
149 |
150 | # Crashlytics plugin (for Android Studio and IntelliJ)
151 | com_crashlytics_export_strings.xml
152 | crashlytics.properties
153 | crashlytics-build.properties
154 | fabric.properties
155 |
156 | # Editor-based Rest Client
157 | .idea/httpRequests
158 |
159 | # Android studio 3.1+ serialized cache file
160 | .idea/caches/build_file_checksums.ser
161 |
162 | /.idea/
163 |
--------------------------------------------------------------------------------
/fitness-tracker/src/app/training/training.service.ts:
--------------------------------------------------------------------------------
1 | import {Injectable} from '@angular/core';
2 | import {Exercise} from './exercise.model';
3 | import {Subscription} from 'rxjs';
4 | import {map, take} from 'rxjs/operators';
5 | import {Store} from '@ngrx/store';
6 | import {AngularFirestore} from '@angular/fire/firestore';
7 | import {UiService} from '../shared/ui.service';
8 | import * as UI from '../shared/ui.actions';
9 | import * as Training from './training.actions';
10 | import * as fromTraining from './training.reducer';
11 |
12 | @Injectable({
13 | providedIn: 'root'
14 | })
15 | export class TrainingService {
16 | private fbSubs: Subscription[] = [];
17 |
18 | constructor(
19 | private db: AngularFirestore,
20 | private uiService: UiService,
21 | private store: Store
22 | ) {
23 | }
24 |
25 | fetchAvailableExercises() {
26 | this.store.dispatch(new UI.StartLoading());
27 | this.fbSubs.push(
28 | this.db
29 | .collection('availableExercises')
30 | .snapshotChanges()
31 | .pipe(
32 | map(docArray => {
33 | return docArray.map(doc => {
34 | return {
35 | id: doc.payload.doc.id,
36 | name: doc.payload.doc.data()['name'],
37 | calories: doc.payload.doc.data()['calories'],
38 | duration: doc.payload.doc.data()['duration']
39 | };
40 | });
41 | })
42 | ).subscribe(
43 | (exercises: Exercise[]) => {
44 | this.store.dispatch(new UI.StopLoading());
45 | this.store.dispatch(new Training.SetAvailableTrainings(exercises));
46 | },
47 | error => {
48 | console.log('*** Fetching Exercises failed: ', error.message);
49 | this.store.dispatch(new UI.StopLoading());
50 | this.uiService.showSnackbar('Fetching Exercises failed, please try again later.', null, 3000);
51 | }
52 | )
53 | );
54 | }
55 |
56 | startExercise(selectedId: string) {
57 | this.store.dispatch(new Training.StartTraining(selectedId));
58 | }
59 |
60 | completeExercise() {
61 | this.store.select(fromTraining.getActiveTraining)
62 | .pipe(take(1))
63 | .subscribe(ex => {
64 | this.addDataToDatabase({
65 | ...ex,
66 | date: new Date(),
67 | state: 'completed'
68 | });
69 | this.store.dispatch(new Training.StopTraining());
70 | });
71 | }
72 |
73 | cancelExercise(progress: number) {
74 | this.store.select(fromTraining.getActiveTraining)
75 | .pipe(take(1))
76 | .subscribe(ex => {
77 | this.addDataToDatabase({
78 | ...ex,
79 | duration: ex.duration * (progress / 100),
80 | calories: ex.calories * (progress / 100),
81 | date: new Date(),
82 | state: 'cancelled'
83 | });
84 | this.store.dispatch(new Training.StopTraining());
85 | });
86 | }
87 |
88 | fetchCompletedOrCancelledExercises() {
89 | this.store.dispatch(new UI.StartLoading());
90 | this.fbSubs.push(
91 | this.db
92 | .collection('finishedExercises')
93 | .valueChanges()
94 | .subscribe(
95 | (exercises: Exercise[]) => {
96 | this.store.dispatch(new UI.StopLoading());
97 | this.store.dispatch(new Training.SetFinishedTrainings(exercises));
98 | },
99 | error => {
100 | this.store.dispatch(new UI.StopLoading());
101 | this.uiService.showSnackbar(error.message, null, 3000);
102 | }
103 | )
104 | );
105 | }
106 |
107 | cancelSubscriptions() {
108 | this.fbSubs.forEach(sub => sub.unsubscribe());
109 | }
110 |
111 | private addDataToDatabase(exercise: Exercise) {
112 | this.db
113 | .collection('finishedExercises')
114 | .add(exercise);
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/src/ng-refresher/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "ng-refresher": {
7 | "projectType": "application",
8 | "schematics": {
9 | "@schematics/angular:component": {
10 | "style": "scss"
11 | }
12 | },
13 | "root": "",
14 | "sourceRoot": "src",
15 | "prefix": "app",
16 | "architect": {
17 | "build": {
18 | "builder": "@angular-devkit/build-angular:browser",
19 | "options": {
20 | "outputPath": "dist/ng-refresher",
21 | "index": "src/index.html",
22 | "main": "src/main.ts",
23 | "polyfills": "src/polyfills.ts",
24 | "tsConfig": "tsconfig.app.json",
25 | "aot": false,
26 | "assets": [
27 | "src/favicon.ico",
28 | "src/assets"
29 | ],
30 | "styles": [
31 | "src/styles.scss"
32 | ],
33 | "scripts": []
34 | },
35 | "configurations": {
36 | "production": {
37 | "fileReplacements": [
38 | {
39 | "replace": "src/environments/environment.ts",
40 | "with": "src/environments/environment.prod.ts"
41 | }
42 | ],
43 | "optimization": true,
44 | "outputHashing": "all",
45 | "sourceMap": false,
46 | "extractCss": true,
47 | "namedChunks": false,
48 | "aot": true,
49 | "extractLicenses": true,
50 | "vendorChunk": false,
51 | "buildOptimizer": true,
52 | "budgets": [
53 | {
54 | "type": "initial",
55 | "maximumWarning": "2mb",
56 | "maximumError": "5mb"
57 | },
58 | {
59 | "type": "anyComponentStyle",
60 | "maximumWarning": "6kb",
61 | "maximumError": "10kb"
62 | }
63 | ]
64 | }
65 | }
66 | },
67 | "serve": {
68 | "builder": "@angular-devkit/build-angular:dev-server",
69 | "options": {
70 | "browserTarget": "ng-refresher:build"
71 | },
72 | "configurations": {
73 | "production": {
74 | "browserTarget": "ng-refresher:build:production"
75 | }
76 | }
77 | },
78 | "extract-i18n": {
79 | "builder": "@angular-devkit/build-angular:extract-i18n",
80 | "options": {
81 | "browserTarget": "ng-refresher:build"
82 | }
83 | },
84 | "test": {
85 | "builder": "@angular-devkit/build-angular:karma",
86 | "options": {
87 | "main": "src/test.ts",
88 | "polyfills": "src/polyfills.ts",
89 | "tsConfig": "tsconfig.spec.json",
90 | "karmaConfig": "karma.conf.js",
91 | "assets": [
92 | "src/favicon.ico",
93 | "src/assets"
94 | ],
95 | "styles": [
96 | "src/styles.scss"
97 | ],
98 | "scripts": []
99 | }
100 | },
101 | "lint": {
102 | "builder": "@angular-devkit/build-angular:tslint",
103 | "options": {
104 | "tsConfig": [
105 | "tsconfig.app.json",
106 | "tsconfig.spec.json",
107 | "e2e/tsconfig.json"
108 | ],
109 | "exclude": [
110 | "**/node_modules/**"
111 | ]
112 | }
113 | },
114 | "e2e": {
115 | "builder": "@angular-devkit/build-angular:protractor",
116 | "options": {
117 | "protractorConfig": "e2e/protractor.conf.js",
118 | "devServerTarget": "ng-refresher:serve"
119 | },
120 | "configurations": {
121 | "production": {
122 | "devServerTarget": "ng-refresher:serve:production"
123 | }
124 | }
125 | }
126 | }
127 | }},
128 | "defaultProject": "ng-refresher"
129 | }
--------------------------------------------------------------------------------
/fitness-tracker/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "fitness-tracker": {
7 | "projectType": "application",
8 | "schematics": {
9 | "@schematics/angular:component": {
10 | "style": "scss"
11 | }
12 | },
13 | "root": "",
14 | "sourceRoot": "src",
15 | "prefix": "app",
16 | "architect": {
17 | "build": {
18 | "builder": "@angular-devkit/build-angular:browser",
19 | "options": {
20 | "outputPath": "dist/fitness-tracker",
21 | "index": "src/index.html",
22 | "main": "src/main.ts",
23 | "polyfills": "src/polyfills.ts",
24 | "tsConfig": "tsconfig.app.json",
25 | "aot": false,
26 | "assets": [
27 | "src/favicon.ico",
28 | "src/assets"
29 | ],
30 | "styles": [
31 | "src/styles.scss"
32 | ],
33 | "scripts": []
34 | },
35 | "configurations": {
36 | "production": {
37 | "fileReplacements": [
38 | {
39 | "replace": "src/environments/environment.ts",
40 | "with": "src/environments/environment.prod.ts"
41 | }
42 | ],
43 | "optimization": true,
44 | "outputHashing": "all",
45 | "sourceMap": false,
46 | "extractCss": true,
47 | "namedChunks": false,
48 | "aot": true,
49 | "extractLicenses": true,
50 | "vendorChunk": false,
51 | "buildOptimizer": true,
52 | "budgets": [
53 | {
54 | "type": "initial",
55 | "maximumWarning": "2mb",
56 | "maximumError": "5mb"
57 | },
58 | {
59 | "type": "anyComponentStyle",
60 | "maximumWarning": "6kb",
61 | "maximumError": "10kb"
62 | }
63 | ]
64 | }
65 | }
66 | },
67 | "serve": {
68 | "builder": "@angular-devkit/build-angular:dev-server",
69 | "options": {
70 | "browserTarget": "fitness-tracker:build"
71 | },
72 | "configurations": {
73 | "production": {
74 | "browserTarget": "fitness-tracker:build:production"
75 | }
76 | }
77 | },
78 | "extract-i18n": {
79 | "builder": "@angular-devkit/build-angular:extract-i18n",
80 | "options": {
81 | "browserTarget": "fitness-tracker:build"
82 | }
83 | },
84 | "test": {
85 | "builder": "@angular-devkit/build-angular:karma",
86 | "options": {
87 | "main": "src/test.ts",
88 | "polyfills": "src/polyfills.ts",
89 | "tsConfig": "tsconfig.spec.json",
90 | "karmaConfig": "karma.conf.js",
91 | "assets": [
92 | "src/favicon.ico",
93 | "src/assets"
94 | ],
95 | "styles": [
96 | "src/styles.scss"
97 | ],
98 | "scripts": []
99 | }
100 | },
101 | "lint": {
102 | "builder": "@angular-devkit/build-angular:tslint",
103 | "options": {
104 | "tsConfig": [
105 | "tsconfig.app.json",
106 | "tsconfig.spec.json",
107 | "e2e/tsconfig.json"
108 | ],
109 | "exclude": [
110 | "**/node_modules/**"
111 | ]
112 | }
113 | },
114 | "e2e": {
115 | "builder": "@angular-devkit/build-angular:protractor",
116 | "options": {
117 | "protractorConfig": "e2e/protractor.conf.js",
118 | "devServerTarget": "fitness-tracker:serve"
119 | },
120 | "configurations": {
121 | "production": {
122 | "devServerTarget": "fitness-tracker:serve:production"
123 | }
124 | }
125 | }
126 | }
127 | }},
128 | "defaultProject": "fitness-tracker"
129 | }
--------------------------------------------------------------------------------