From 4e4fd771f06bb771a338f4954652c9497fd740e3 Mon Sep 17 00:00:00 2001 From: chandermani Date: Fri, 6 Nov 2015 08:21:03 +0530 Subject: [PATCH 01/35] Fixed path to rest image. --- trainer/src/components/workout-runner/workout-runner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trainer/src/components/workout-runner/workout-runner.ts b/trainer/src/components/workout-runner/workout-runner.ts index 10ce622..f24c573 100644 --- a/trainer/src/components/workout-runner/workout-runner.ts +++ b/trainer/src/components/workout-runner/workout-runner.ts @@ -16,7 +16,7 @@ export class WorkoutRunner { constructor() { this.workoutPlan = this.buildWorkout(); - this.restExercise = new ExercisePlan(new Exercise("rest", "Relax!", "Relax a bit", "img/rest.png"), this.workoutPlan.restBetweenExercise); + this.restExercise = new ExercisePlan(new Exercise("rest", "Relax!", "Relax a bit", "rest.png"), this.workoutPlan.restBetweenExercise); } onInit() { this.start(); From 1ddd0ac2701454d78cd185516164abeb2c40b9a3 Mon Sep 17 00:00:00 2001 From: chandermani Date: Thu, 19 Nov 2015 07:45:38 +0530 Subject: [PATCH 02/35] Fixed 2.1 checkpoint code. --- trainer/src/components/app/app.ts | 3 +-- trainer/src/components/workout-runner/model.ts | 2 +- trainer/src/components/workout-runner/workout-runner.ts | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/trainer/src/components/app/app.ts b/trainer/src/components/app/app.ts index 868abc0..e1351c0 100644 --- a/trainer/src/components/app/app.ts +++ b/trainer/src/components/app/app.ts @@ -3,8 +3,7 @@ import {WorkoutRunner} from '../workout-runner/workout-runner'; @Component({ selector: 'trainer-app', directives:[WorkoutRunner], - template: ` - ` + template: `` }) export class TrainerApp { name: string = 'World'; diff --git a/trainer/src/components/workout-runner/model.ts b/trainer/src/components/workout-runner/model.ts index 64d9614..db7933e 100644 --- a/trainer/src/components/workout-runner/model.ts +++ b/trainer/src/components/workout-runner/model.ts @@ -7,7 +7,7 @@ export class WorkoutPlan { public description?: string) { } - totalWorkoutDuration() { + totalWorkoutDuration(): number { if (!this.exercises) return 0; let total = this.exercises.map((e) => e.duration).reduce((previous, current) => previous + current); diff --git a/trainer/src/components/workout-runner/workout-runner.ts b/trainer/src/components/workout-runner/workout-runner.ts index f24c573..b619126 100644 --- a/trainer/src/components/workout-runner/workout-runner.ts +++ b/trainer/src/components/workout-runner/workout-runner.ts @@ -12,7 +12,7 @@ export class WorkoutRunner { restExercise: ExercisePlan; currentExerciseIndex: number; currentExercise: ExercisePlan; - exerciseRunningDuration: number + exerciseRunningDuration: number; constructor() { this.workoutPlan = this.buildWorkout(); @@ -25,7 +25,7 @@ export class WorkoutRunner { start() { this.workoutTimeRemaining = this.workoutPlan.totalWorkoutDuration(); this.currentExerciseIndex = 0; - this.startExercise(this.workoutPlan.exercises[0]); + this.startExercise(this.workoutPlan.exercises[this.currentExerciseIndex]); } startExercise(exercisePlan: ExercisePlan) { @@ -45,7 +45,7 @@ export class WorkoutRunner { else { this.exerciseRunningDuration++; } - }, 1000, this.currentExercise.duration); + }, 1000); } getNextExercise(): ExercisePlan { From ebe7bc26523492e83f132713ed1e540d2779c0f3 Mon Sep 17 00:00:00 2001 From: chandermani Date: Thu, 19 Nov 2015 07:45:38 +0530 Subject: [PATCH 03/35] Fixed 2.1 checkpoint code. --- trainer/src/components/workout-runner/workout-runner.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/trainer/src/components/workout-runner/workout-runner.ts b/trainer/src/components/workout-runner/workout-runner.ts index b619126..e144c99 100644 --- a/trainer/src/components/workout-runner/workout-runner.ts +++ b/trainer/src/components/workout-runner/workout-runner.ts @@ -36,6 +36,9 @@ export class WorkoutRunner { clearInterval(intervalId); let next: ExercisePlan = this.getNextExercise(); if (next) { + if (next !== this.restExercise) { + this.currentExerciseIndex++; + } this.startExercise(next); } else { @@ -51,8 +54,7 @@ export class WorkoutRunner { getNextExercise(): ExercisePlan { let nextExercise: ExercisePlan = null; if (this.currentExercise === this.restExercise) { - this.currentExerciseIndex++; - nextExercise = this.workoutPlan.exercises[this.currentExerciseIndex]; + nextExercise = this.workoutPlan.exercises[this.currentExerciseIndex + 1]; } else if (this.currentExerciseIndex < this.workoutPlan.exercises.length - 1) { nextExercise = this.restExercise; From 02c1d3f637a6e5502eab29d98dd29dbf4817e9b3 Mon Sep 17 00:00:00 2001 From: chandermani Date: Thu, 19 Nov 2015 09:39:48 +0530 Subject: [PATCH 04/35] Fixed checkpoint2.2 code. --- trainer/package.json | 4 +-- .../src/components/workout-runner/model.ts | 8 +----- .../workout-runner/workout-runner.tpl.html | 4 ++- .../workout-runner/workout-runner.ts | 26 +++++++++---------- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/trainer/package.json b/trainer/package.json index 4ed0005..8cff0f2 100644 --- a/trainer/package.json +++ b/trainer/package.json @@ -15,9 +15,9 @@ "del": "^1.2.0", "gulp": "^3.9.0", "gulp-typescript": "^2.8.0", - "gulp-sourcemaps": "^1.6.0" + "gulp-sourcemaps": "^1.6.0", "open": "0.0.5", - "serve-static": "^1.10.0", + "serve-static": "^1.10.0" }, "dependencies": { "angular2": "2.0.0-alpha.44", diff --git a/trainer/src/components/workout-runner/model.ts b/trainer/src/components/workout-runner/model.ts index db7933e..d48a705 100644 --- a/trainer/src/components/workout-runner/model.ts +++ b/trainer/src/components/workout-runner/model.ts @@ -30,11 +30,5 @@ export class Exercise { public image: string, public nameSound?: string, public procedure?: string, - public related?: ExerciseRelated) { - } -} - -export class ExerciseRelated { - constructor(public videos: string[]) { - } + public videos?: Array) { } } diff --git a/trainer/src/components/workout-runner/workout-runner.tpl.html b/trainer/src/components/workout-runner/workout-runner.tpl.html index f73119f..5491c63 100644 --- a/trainer/src/components/workout-runner/workout-runner.tpl.html +++ b/trainer/src/components/workout-runner/workout-runner.tpl.html @@ -5,7 +5,9 @@

{{currentExercise.exercise.title}}

-
+

Time Remaining: {{currentExercise.duration-exerciseRunningDuration}}

diff --git a/trainer/src/components/workout-runner/workout-runner.ts b/trainer/src/components/workout-runner/workout-runner.ts index e144c99..f3172cb 100644 --- a/trainer/src/components/workout-runner/workout-runner.ts +++ b/trainer/src/components/workout-runner/workout-runner.ts @@ -1,5 +1,5 @@ import {Component, NgStyle} from 'angular2/angular2'; -import {WorkoutPlan, ExercisePlan, Exercise, ExerciseRelated} from './model' +import {WorkoutPlan, ExercisePlan, Exercise} from './model' @Component({ selector: 'workout-runner', @@ -78,7 +78,7 @@ export class WorkoutRunner { While in air, bring your legs out to the side about shoulder width or slightly wider. As you are moving your legs outward, you should raise your arms up over your head; arms should be slightly bent throughout the entire in-air movement. Your feet should land shoulder width or wider as your hands meet above your head with arms slightly bent`, - new ExerciseRelated(["//www.youtube.com/embed/dmYwZH_BNd0", "//www.youtube.com/embed/BABOdJ-2Z6o", "//www.youtube.com/embed/c4DAnQ6DtF8"])), + ["dmYwZH_BNd0", "BABOdJ-2Z6o", "c4DAnQ6DtF8"]), 30)); workout.exercises.push( @@ -91,7 +91,7 @@ export class WorkoutRunner { "", `Place your back against a wall with your feet shoulder width apart and a little ways out from the wall. Then, keeping your back against the wall, lower your hips until your knees form right angles.`, - new ExerciseRelated(["//www.youtube.com/embed/y-wV4Venusw", "//www.youtube.com/embed/MMV3v4ap4ro"])), + ["y-wV4Venusw", "MMV3v4ap4ro"]), 30)); workout.exercises.push( @@ -105,7 +105,7 @@ export class WorkoutRunner { `Lie prone on the ground with hands placed as wide or slightly wider than shoulder width. Keeping the body straight, lower body to the ground by bending arms at the elbows. Raise body up off the ground by extending the arms.`, - new ExerciseRelated(["//www.youtube.com/embed/Eh00_rniF8E", "//www.youtube.com/embed/ZWdBqFLNljc", "//www.youtube.com/embed/UwRLWMcOdwI", "//www.youtube.com/embed/ynPwl6qyUNM", "//www.youtube.com/embed/OicNTT2xzMI"])), + ["Eh00_rniF8E", "ZWdBqFLNljc", "UwRLWMcOdwI", "ynPwl6qyUNM", "OicNTT2xzMI"]), 30)); workout.exercises.push( @@ -122,7 +122,7 @@ export class WorkoutRunner { Gently pull your abdominals inward. Curl up and forward so that your head, neck, and shoulder blades lift off the floor. Hold for a moment at the top of the movement and then lower slowly back down.`, - new ExerciseRelated(["//www.youtube.com/embed/Xyd_fa5zoEU", "//www.youtube.com/embed/MKmrqcoCZ-M"])), + ["Xyd_fa5zoEU", "MKmrqcoCZ-M"]), 30)); workout.exercises.push( @@ -137,7 +137,7 @@ export class WorkoutRunner { Stand with your feet about hip width apart, arms at your sides. Step up onto the seat with one foot, pressing down while bringing your other foot up next to it. Step back with the leading foot and bring the trailing foot down to finish one step-up.`, - new ExerciseRelated(["//www.youtube.com/embed/aajhW7DD1EA"])), + ["aajhW7DD1EA"]), 30)); workout.exercises.push( @@ -153,7 +153,7 @@ export class WorkoutRunner { Sit back and down like you're sitting into a chair. Keep your head facing straight as your upper body bends forward a bit. Rather than allowing your back to round, let your lower back arch slightly as you go down. Lower down so your thighs are parallel to the floor, with your knees over your ankles. Press your weight back into your heels. Keep your body tight, and push through your heels to bring yourself back to the starting position.`, - new ExerciseRelated(["//www.youtube.com/embed/QKKZ9AGYTi4", "//www.youtube.com/embed/UXJrBgI2RxA"])), + ["QKKZ9AGYTi4", "UXJrBgI2RxA"]), 30)); workout.exercises.push( @@ -168,7 +168,7 @@ export class WorkoutRunner { Place your hands edges of the chair. Your palms should be down, fingertips pointing towards the floor. Without moving your legs, bring your glutes forward off the chair. Steadily lower yourself. When your elbows form 90 degrees angles, push yourself back up to starting position.`, - new ExerciseRelated(["//www.youtube.com/embed/tKjcgfu44sI", "//www.youtube.com/embed/jox1rb5krQI"])), + ["tKjcgfu44sI", "jox1rb5krQI"]), 30)); workout.exercises.push( @@ -183,7 +183,7 @@ export class WorkoutRunner { Bend your elbows 90 degrees and rest your weight on your forearms. Your elbows should be directly beneath your shoulders, and your body should form a straight line from head to feet. Hold this position.`, - new ExerciseRelated(["//www.youtube.com/embed/pSHjTRCQxIw", "//www.youtube.com/embed/TvxNkmjdhMM"])), + ["pSHjTRCQxIw", "TvxNkmjdhMM"]), 30)); workout.exercises.push( @@ -196,7 +196,7 @@ export class WorkoutRunner { "", `Start standing with feet hip-width apart. Do inplace jog with your knees lifting as much as possible towards your chest.`, - new ExerciseRelated(["//www.youtube.com/embed/OAJ_J3EZkdY", "//www.youtube.com/embed/8opcQdC-V-U"])), + ["OAJ_J3EZkdY", "8opcQdC-V-U"]), 30)); workout.exercises.push( @@ -209,7 +209,7 @@ export class WorkoutRunner { "", `Start standing with feet hip-width apart. Do inplace jog with your knees lifting as much as possible towards your chest.`, - new ExerciseRelated(["//www.youtube.com/embed/Z2n58m2i4jg"])), + ["Z2n58m2i4jg"]), 30)); workout.exercises.push( @@ -222,7 +222,7 @@ export class WorkoutRunner { "", `Assume the classic pushup position, but as you come up, rotate your body so your right arm lifts up and extends overhead. Return to the starting position, lower yourself, then push up and rotate till your left hand points toward the ceiling.`, - new ExerciseRelated(["//www.youtube.com/embed/qHQ_E-f5278"])), + ["qHQ_E-f5278"]), 30)); workout.exercises.push( @@ -237,7 +237,7 @@ export class WorkoutRunner { Your elbow should be directly under your shoulder. With your abdominals gently contracted, lift your hips off the floor, maintaining the line. Keep your hips square and your neck in line with your spine. Hold the position.`, - new ExerciseRelated(["//www.youtube.com/embed/wqzrb67Dwf8", "//www.youtube.com/embed/_rdfjFSFKMY"])), + ["wqzrb67Dwf8", "_rdfjFSFKMY"]), 30)); return workout; From dc49f374d037695daff2a6f7aef5088062b54c03 Mon Sep 17 00:00:00 2001 From: chandermani Date: Sat, 5 Dec 2015 20:21:17 +0530 Subject: [PATCH 05/35] Removed platform directive as refence in component. --- trainer/src/components/app/app.ts | 1 - trainer/src/components/workout-runner/workout-runner.ts | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/trainer/src/components/app/app.ts b/trainer/src/components/app/app.ts index e1351c0..8165035 100644 --- a/trainer/src/components/app/app.ts +++ b/trainer/src/components/app/app.ts @@ -6,5 +6,4 @@ import {WorkoutRunner} from '../workout-runner/workout-runner'; template: `` }) export class TrainerApp { - name: string = 'World'; } diff --git a/trainer/src/components/workout-runner/workout-runner.ts b/trainer/src/components/workout-runner/workout-runner.ts index f3172cb..5c2eafc 100644 --- a/trainer/src/components/workout-runner/workout-runner.ts +++ b/trainer/src/components/workout-runner/workout-runner.ts @@ -3,8 +3,7 @@ import {WorkoutPlan, ExercisePlan, Exercise} from './model' @Component({ selector: 'workout-runner', - templateUrl: '/src/components/workout-runner/workout-runner.tpl.html', - directives:[NgStyle] + templateUrl: '/src/components/workout-runner/workout-runner.tpl.html' }) export class WorkoutRunner { workoutPlan: WorkoutPlan; From f59a303e2723978c6ad994c33239c76549e7e27f Mon Sep 17 00:00:00 2001 From: chandermani Date: Tue, 8 Dec 2015 08:02:28 +0530 Subject: [PATCH 06/35] Added nav bar and fixed container style --- trainer/index.html | 11 ++++++++++- trainer/static/css/app.css | 18 +++++++++++------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/trainer/index.html b/trainer/index.html index 174563f..a0c72f2 100644 --- a/trainer/index.html +++ b/trainer/index.html @@ -12,7 +12,16 @@ - Loading... + +
+ Loading... +
diff --git a/trainer/static/css/app.css b/trainer/static/css/app.css index 3324018..d2a0954 100644 --- a/trainer/static/css/app.css +++ b/trainer/static/css/app.css @@ -81,6 +81,10 @@ input[type="checkbox"].input-validation-error { /*styles for left nav bar - end*/ /*styles for container - start*/ +.container.app-container{ + width:100%; + max-width:100%; +} .workout-display-div { text-align: center; padding: 40px; @@ -132,13 +136,13 @@ input[type="checkbox"].input-validation-error { width:100%; height:100%; opacity:0; /*Comment this line to try our mouse event based pause and resume. */ - z-index:10; - + z-index:10; + } /*Comment this style to try our mouse event based pause and resume. */ #pause-overlay:hover { - opacity:.8; + opacity:.8; } #pause-overlay .pause{ font-size:120pt; @@ -153,16 +157,16 @@ input[type="checkbox"].input-validation-error { } #play-video-overlay { - position:absolute; + position:absolute; top:0px; width:100%; height:100%; opacity:0; - z-index:10; - + z-index:10; + } #play-video-overlay:hover { - opacity:.6; + opacity:.6; } #play-video-overlay .video { font-size:80pt; From 4394205ed5bf358367506fc5f74015e32e694754 Mon Sep 17 00:00:00 2001 From: chandermani Date: Thu, 10 Dec 2015 09:14:39 +0530 Subject: [PATCH 07/35] Remove NgStyle import. --- trainer/src/components/workout-runner/workout-runner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trainer/src/components/workout-runner/workout-runner.ts b/trainer/src/components/workout-runner/workout-runner.ts index 5c2eafc..d55f543 100644 --- a/trainer/src/components/workout-runner/workout-runner.ts +++ b/trainer/src/components/workout-runner/workout-runner.ts @@ -1,4 +1,4 @@ -import {Component, NgStyle} from 'angular2/angular2'; +import {Component} from 'angular2/angular2'; import {WorkoutPlan, ExercisePlan, Exercise} from './model' @Component({ From a6d6f7da5ecf242393a59d47823ece2ce4753fd0 Mon Sep 17 00:00:00 2001 From: chandermani Date: Sun, 13 Dec 2015 20:01:57 +0530 Subject: [PATCH 08/35] Added audio reference to exercise data. --- .../workout-runner/workout-runner.ts | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/trainer/src/components/workout-runner/workout-runner.ts b/trainer/src/components/workout-runner/workout-runner.ts index d55f543..456f24c 100644 --- a/trainer/src/components/workout-runner/workout-runner.ts +++ b/trainer/src/components/workout-runner/workout-runner.ts @@ -71,7 +71,7 @@ export class WorkoutRunner { "Jumping Jacks", "A jumping jack or star jump, also called side-straddle hop is a physical jumping exercise.", "JumpingJacks.png", - "", + "jumpingjacks.wav", `Assume an erect position, with feet together and arms at your side. Slightly bend your knees, and propel yourself a few inches into the air. While in air, bring your legs out to the side about shoulder width or slightly wider. @@ -87,7 +87,7 @@ export class WorkoutRunner { "Wall Sit", "A wall sit, also known as a Roman Chair, is an exercise done to strengthen the quadriceps muscles.", "wallsit.png", - "", + "wallsit.wav", `Place your back against a wall with your feet shoulder width apart and a little ways out from the wall. Then, keeping your back against the wall, lower your hips until your knees form right angles.`, ["y-wV4Venusw", "MMV3v4ap4ro"]), @@ -100,7 +100,7 @@ export class WorkoutRunner { "Push up", "A push-up is a common exercise performed in a prone position by raising and lowering the body using the arms", "pushup.png", - "", + "pushups.wav", `Lie prone on the ground with hands placed as wide or slightly wider than shoulder width. Keeping the body straight, lower body to the ground by bending arms at the elbows. Raise body up off the ground by extending the arms.`, @@ -114,7 +114,7 @@ export class WorkoutRunner { "Abdominal Crunches", "The basic crunch is a abdominal exercise in a strength-training program.", "crunches.png", - "", + "crunches.wav", `Lie on your back with your knees bent and feet flat on the floor, hip-width apart. Place your hands behind your head so your thumbs are behind your ears. Hold your elbows out to the sides but rounded slightly in. @@ -131,7 +131,7 @@ export class WorkoutRunner { "Step Up Onto Chair", "Step exercises are ideal for building muscle in your lower body.", "stepupontochair.png", - "", + "stepup.wav", `Position your chair in front of you. Stand with your feet about hip width apart, arms at your sides. Step up onto the seat with one foot, pressing down while bringing your other foot up next to it. @@ -146,7 +146,7 @@ export class WorkoutRunner { "Squat", "The squat is a compound, full body exercise that trains primarily the muscles of the thighs, hips, buttocks and quads.", "squat.png", - "", + "squats.wav", `Stand with your head facing forward and your chest held up and out. Place your feet shoulder-width apart or little wider. Extend your hands straight out in front of you. Sit back and down like you're sitting into a chair. Keep your head facing straight as your upper body bends forward a bit. Rather than allowing your back to round, let your lower back arch slightly as you go down. @@ -162,7 +162,7 @@ export class WorkoutRunner { "Tricep Dips On Chair", "A body weight exercise that targets triceps.", "tricepdips.png", - "", + "tricepdips.wav", `Sit up on a chair. Your legs should be slightly extended, with your feet flat on the floor. Place your hands edges of the chair. Your palms should be down, fingertips pointing towards the floor. Without moving your legs, bring your glutes forward off the chair. @@ -177,7 +177,7 @@ export class WorkoutRunner { "Plank", "The plank (also called a front hold, hover, or abdominal bridge) is an isometric core strength exercise that involves maintaining a difficult position for extended periods of time.", "Plank.png", - "", + "plank.wav", `Get into pushup position on the floor. Bend your elbows 90 degrees and rest your weight on your forearms. Your elbows should be directly beneath your shoulders, and your body should form a straight line from head to feet. @@ -192,7 +192,7 @@ export class WorkoutRunner { "High Knees", "A form exercise that develops strength and endurance of the hip flexors and quads and stretches the hip extensors.", "highknees.png", - "", + "highknees.wav", `Start standing with feet hip-width apart. Do inplace jog with your knees lifting as much as possible towards your chest.`, ["OAJ_J3EZkdY", "8opcQdC-V-U"]), @@ -205,7 +205,7 @@ export class WorkoutRunner { "Lunges", "Lunges are a good exercise for strengthening, sculpting and building several muscles/muscle groups, including the quadriceps (or thighs), the gluteus maximus (or buttocks) as well as the hamstrings.", "lunges.png", - "", + "lunge.wav", `Start standing with feet hip-width apart. Do inplace jog with your knees lifting as much as possible towards your chest.`, ["Z2n58m2i4jg"]), @@ -218,7 +218,7 @@ export class WorkoutRunner { "Pushup And Rotate", "A variation of pushup that requires you to rotate.", "pushupnrotate.png", - "", + "pushupandrotate.wav", `Assume the classic pushup position, but as you come up, rotate your body so your right arm lifts up and extends overhead. Return to the starting position, lower yourself, then push up and rotate till your left hand points toward the ceiling.`, ["qHQ_E-f5278"]), @@ -231,7 +231,7 @@ export class WorkoutRunner { "Side Plank", "A variation to Plank done using one hand only.", "sideplank.png", - "", + "sideplank.wav", `Lie on your side, in a straight line from head to feet, resting on your forearm. Your elbow should be directly under your shoulder. With your abdominals gently contracted, lift your hips off the floor, maintaining the line. From b4a975e3098a849088e3d153ab08a7d5c01b801c Mon Sep 17 00:00:00 2001 From: chandermani Date: Mon, 14 Dec 2015 09:09:19 +0530 Subject: [PATCH 09/35] Fixed readme and package urls --- trainer/README.md | 13 +++++++++++++ trainer/package.json | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/trainer/README.md b/trainer/README.md index eb6a127..e71f751 100644 --- a/trainer/README.md +++ b/trainer/README.md @@ -1,3 +1,16 @@ # Personal Trainer Personal Trainer built using Angular2 and TypeScript + +## Install + +Clone this repo and execute in your favourite shell: + +* `npm i -g gulp` to install gulp globally (if you don't have it installed already) +* `npm install` to install local npm dependencies + +## Play + +After completing installation type in your favourite shell: + +* `gulp play` to start the app in a new browser window. App files are observed and will be re-transpiled on each change. diff --git a/trainer/package.json b/trainer/package.json index 8cff0f2..00c2735 100644 --- a/trainer/package.json +++ b/trainer/package.json @@ -4,12 +4,12 @@ "description": "Angular 2 implementation of Personal Trainer in TypeScript", "repository": { "type": "git", - "url": "git+https://github.com/chandermani/angularjsbyexample.git" + "url": "git+https://github.com/chandermani/angular2byexample.git" }, "bugs": { - "url": "https://github.com/chandermani/angularjsbyexample/issues" + "url": "https://github.com/chandermani/angular2byexample/issues" }, - "homepage": "https://github.com/chandermani/angularjsbyexample#readme", + "homepage": "https://github.com/chandermani/angular2byexample.git#readme", "devDependencies": { "connect": "^3.4.0", "del": "^1.2.0", From 28f1ec4c521b53e7bb6e3666adaa7d96a49ed7fc Mon Sep 17 00:00:00 2001 From: chandermani Date: Tue, 15 Dec 2015 07:07:40 +0530 Subject: [PATCH 10/35] Bumped Angular package. --- trainer/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trainer/package.json b/trainer/package.json index 00c2735..9b30be3 100644 --- a/trainer/package.json +++ b/trainer/package.json @@ -20,7 +20,7 @@ "serve-static": "^1.10.0" }, "dependencies": { - "angular2": "2.0.0-alpha.44", + "angular2": "2.0.0-alpha.46", "es6-shim": "^0.33.6", "systemjs": "0.18.4" } From 8ad38c744283468e40562cb372ba74a30a773f8c Mon Sep 17 00:00:00 2001 From: chandermani Date: Thu, 17 Dec 2015 09:28:06 +0530 Subject: [PATCH 11/35] Upgraded to angular beta. --- trainer/index.html | 2 ++ trainer/package.json | 5 +++-- trainer/src/bootstrap.ts | 2 +- trainer/src/components/app/app.ts | 2 +- .../src/components/workout-runner/workout-runner.tpl.html | 2 +- trainer/src/components/workout-runner/workout-runner.ts | 6 +++--- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/trainer/index.html b/trainer/index.html index a0c72f2..5456c5a 100644 --- a/trainer/index.html +++ b/trainer/index.html @@ -31,6 +31,8 @@

7 Minute Workout

//configure system loader System.config({defaultJSExtensions: true}); + + - + diff --git a/trainer/package.json b/trainer/package.json index 5e1df26..c3ef467 100644 --- a/trainer/package.json +++ b/trainer/package.json @@ -11,13 +11,14 @@ }, "homepage": "https://github.com/chandermani/angular2byexample.git#readme", "devDependencies": { - "connect": "^3.4.0", "del": "^1.2.0", "gulp": "^3.9.0", - "gulp-typescript": "^2.8.0", + "gulp-connect": "^3.1.0", "gulp-sourcemaps": "^1.6.0", - "open": "0.0.5", - "serve-static": "^1.10.0" + "gulp-typescript": "^2.8.0", + "gulp-watch": "^4.3.5", + "gulp-webserver": "^0.9.1", + "open": "0.0.5" }, "dependencies": { "angular2": "2.0.0-beta.15", From 0d376c4ae837c00f6c8f7d2d52d76c9fa58b7742 Mon Sep 17 00:00:00 2001 From: chandermani Date: Thu, 21 Apr 2016 08:14:24 +0530 Subject: [PATCH 16/35] Adding back the missing reference to system.js --- trainer/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/trainer/package.json b/trainer/package.json index c3ef467..89b5ecd 100644 --- a/trainer/package.json +++ b/trainer/package.json @@ -26,5 +26,6 @@ "reflect-metadata": "0.1.2", "rxjs": "5.0.0-beta.2", "zone.js": "0.6.10", + "systemjs": "0.19.6" } } From cea28f48561046f094519fa9ba32de8bca017a6b Mon Sep 17 00:00:00 2001 From: chandermani Date: Mon, 9 May 2016 19:18:19 +0530 Subject: [PATCH 17/35] Upgraded to Angular 2 rc1 # Conflicts: # trainer/src/bootstrap.ts # trainer/src/components/app/app.ts --- trainer/.gitignore | 1 + trainer/index.html | 19 ++++---- trainer/package.json | 25 ++++++---- trainer/src/bootstrap.ts | 4 +- trainer/src/components/app/app.ts | 2 +- .../workout-runner/workout-runner.ts | 2 +- trainer/systemjs.config.js | 46 +++++++++++++++++++ trainer/typings.json | 5 ++ 8 files changed, 82 insertions(+), 22 deletions(-) create mode 100644 trainer/systemjs.config.js create mode 100644 trainer/typings.json diff --git a/trainer/.gitignore b/trainer/.gitignore index f06235c..c5ac28a 100644 --- a/trainer/.gitignore +++ b/trainer/.gitignore @@ -1,2 +1,3 @@ node_modules dist +typings/** \ No newline at end of file diff --git a/trainer/index.html b/trainer/index.html index 9972160..b426b77 100644 --- a/trainer/index.html +++ b/trainer/index.html @@ -16,19 +16,18 @@ Loading... - - + + + + + + + + - - - - diff --git a/trainer/package.json b/trainer/package.json index 89b5ecd..7a07866 100644 --- a/trainer/package.json +++ b/trainer/package.json @@ -15,17 +15,26 @@ "gulp": "^3.9.0", "gulp-connect": "^3.1.0", "gulp-sourcemaps": "^1.6.0", - "gulp-typescript": "^2.8.0", + "gulp-typescript": "^2.13.4", "gulp-watch": "^4.3.5", "gulp-webserver": "^0.9.1", - "open": "0.0.5" + "open": "0.0.5", + "typings": "^0.8.1" }, "dependencies": { - "angular2": "2.0.0-beta.15", - "es6-shim": "0.35.0", - "reflect-metadata": "0.1.2", - "rxjs": "5.0.0-beta.2", - "zone.js": "0.6.10", - "systemjs": "0.19.6" + "@angular/common": "2.0.0-rc.1", + "@angular/compiler": "2.0.0-rc.1", + "@angular/core": "2.0.0-rc.1", + "@angular/platform-browser": "2.0.0-rc.1", + "@angular/platform-browser-dynamic": "2.0.0-rc.1", + "es6-shim": "^0.35.0", + "reflect-metadata": "0.1.3", + "rxjs": "5.0.0-beta.6", + "systemjs": "0.19.26", + "zone.js": "^0.6.12" + }, + "scripts": { + "postinstall": "typings install", + "typings": "typings" } } diff --git a/trainer/src/bootstrap.ts b/trainer/src/bootstrap.ts index 8a2d698..9f6879d 100644 --- a/trainer/src/bootstrap.ts +++ b/trainer/src/bootstrap.ts @@ -1,4 +1,4 @@ -/// -import {bootstrap} from 'angular2/platform/browser'; +/// +import {bootstrap} from '@angular/platform-browser-dynamic'; import {TrainerApp} from './components/app/app'; bootstrap(TrainerApp); diff --git a/trainer/src/components/app/app.ts b/trainer/src/components/app/app.ts index 34ff484..4272dd4 100644 --- a/trainer/src/components/app/app.ts +++ b/trainer/src/components/app/app.ts @@ -1,4 +1,4 @@ -import {Component} from 'angular2/core'; +import {Component} from '@angular/core'; import {WorkoutRunner} from '../workout-runner/workout-runner'; @Component({ selector: 'trainer-app', diff --git a/trainer/src/components/workout-runner/workout-runner.ts b/trainer/src/components/workout-runner/workout-runner.ts index 27e9076..c1cc218 100644 --- a/trainer/src/components/workout-runner/workout-runner.ts +++ b/trainer/src/components/workout-runner/workout-runner.ts @@ -1,4 +1,4 @@ -import {Component,OnInit} from 'angular2/core'; +import {Component,OnInit} from '@angular/core'; import {WorkoutPlan, ExercisePlan, Exercise} from './model' @Component({ diff --git a/trainer/systemjs.config.js b/trainer/systemjs.config.js new file mode 100644 index 0000000..518d3ba --- /dev/null +++ b/trainer/systemjs.config.js @@ -0,0 +1,46 @@ +(function(global) { + + // map tells the System loader where to look for things + var map = { + 'app': 'dist', // 'dist', + 'rxjs': 'node_modules/rxjs', + 'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api', + '@angular': 'node_modules/@angular' + }; + + // packages tells the System loader how to load when no filename and/or no extension + var packages = { + 'app': { main:'bootstrap.js' ,defaultExtension: 'js' }, + 'rxjs': { defaultExtension: 'js' }, + 'angular2-in-memory-web-api': { defaultExtension: 'js' }, + }; + + var packageNames = [ + '@angular/common', + '@angular/compiler', + '@angular/core', + '@angular/http', + '@angular/platform-browser', + '@angular/platform-browser-dynamic', + '@angular/router', + '@angular/router-deprecated', + '@angular/testing', + '@angular/upgrade', + ]; + + // add package entries for angular packages in the form '@angular/common': { main: 'index.js', defaultExtension: 'js' } + packageNames.forEach(function(pkgName) { + packages[pkgName] = { main: 'index.js', defaultExtension: 'js' }; + }); + + var config = { + map: map, + packages: packages + } + + // filterSystemConfig - index.html's chance to modify config before we register it. + if (global.filterSystemConfig) { global.filterSystemConfig(config); } + + System.config(config); + +})(this); \ No newline at end of file diff --git a/trainer/typings.json b/trainer/typings.json new file mode 100644 index 0000000..2987eb3 --- /dev/null +++ b/trainer/typings.json @@ -0,0 +1,5 @@ +{ + "ambientDependencies": { + "es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654" + } +} From cd08a3e2ba5d56ca99d992d52bba15dccfc074a9 Mon Sep 17 00:00:00 2001 From: chandermani Date: Tue, 10 May 2016 09:25:18 +0530 Subject: [PATCH 18/35] Refactoring according to style guide. # Conflicts: # trainer/src/components/app/app.component.ts --- trainer/src/bootstrap.ts | 4 ++-- trainer/src/components/app/{app.ts => app.component.ts} | 6 +++--- .../{workout-runner.ts => workout-runner.component.ts} | 4 ++-- .../{workout-runner.tpl.html => workout-runner.html} | 0 trainer/src/tsconfig.json | 5 +---- 5 files changed, 8 insertions(+), 11 deletions(-) rename trainer/src/components/app/{app.ts => app.component.ts} (76%) rename trainer/src/components/workout-runner/{workout-runner.ts => workout-runner.component.ts} (98%) rename trainer/src/components/workout-runner/{workout-runner.tpl.html => workout-runner.html} (100%) diff --git a/trainer/src/bootstrap.ts b/trainer/src/bootstrap.ts index 9f6879d..0d90473 100644 --- a/trainer/src/bootstrap.ts +++ b/trainer/src/bootstrap.ts @@ -1,4 +1,4 @@ /// import {bootstrap} from '@angular/platform-browser-dynamic'; -import {TrainerApp} from './components/app/app'; -bootstrap(TrainerApp); +import {TrainerAppComponent} from './components/app/app.component'; +bootstrap(TrainerAppComponent); diff --git a/trainer/src/components/app/app.ts b/trainer/src/components/app/app.component.ts similarity index 76% rename from trainer/src/components/app/app.ts rename to trainer/src/components/app/app.component.ts index 4272dd4..13afbb5 100644 --- a/trainer/src/components/app/app.ts +++ b/trainer/src/components/app/app.component.ts @@ -1,8 +1,8 @@ import {Component} from '@angular/core'; -import {WorkoutRunner} from '../workout-runner/workout-runner'; +import {WorkoutRunnerComponent} from '../workout-runner/workout-runner.component'; @Component({ selector: 'trainer-app', - directives:[WorkoutRunner], + directives:[WorkoutRunnerComponent], template: `