Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions android/app/src/main/assets/capacitor.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"cordova": {},
"server": {
"cleartext": true,
"url": "http://192.168.1.66:8100"
"url": "http://192.168.1.66:8100",
"cleartext": true
}
}
6 changes: 5 additions & 1 deletion capacitor.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@
"launchShowDuration": 0
}
},
"cordova": {}
"cordova": {},
"server": {
"url": "http://192.168.1.66:8100",
"cleartext": true
}
}
49 changes: 26 additions & 23 deletions src/app/home/home.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,51 @@
</ion-header>

<ion-content [fullscreen]="true">
<div *ngIf="user">
<ion-grid>
<ion-grid *ngIf="user">
<ion-grid class="time">
<ion-row>
<ion-col>
<div>
Time:
</div>
</ion-col>
<ion-col>
<b [chronometer]="chronometer"></b>
</ion-col>
</ion-row>
</ion-grid>

<ion-grid class="time">
<ion-row>
<ion-col>
<ion-text>Kcal</ion-text>
</ion-col>
<ion-col>
<ion-text>00</ion-text>
Time
</ion-col>
</ion-row>
</ion-grid>

<ion-grid>
<ion-row>
<ion-col>
<ion-text>Medium pace</ion-text>
<ion-col class="textCenter">
<ion-text class='calories'>{{ calories }}</ion-text>
</ion-col>
<ion-col>
<ion-text>00</ion-text>
<ion-col class="textCenter">
<ion-text>{{ avgrating }}</ion-text>
</ion-col>
<ion-col class="textCenter">
<ion-text>{{ distanceInMeters ? distanceInMeters : 00 }} km/h</ion-text>
</ion-col>
</ion-row>

<ion-row>
<ion-col>
<ion-text>Distance</ion-text>
<ion-col class="textCenter">
<ion-text>Kcal</ion-text>
</ion-col>

<ion-col>
<ion-text>{{ distanceInMeters ? distanceInMeters : 00 }}</ion-text>
<ion-text class="textCenter">Avg. Resting</ion-text>
</ion-col>

<ion-col class="textCenter">
<ion-text>Distance</ion-text>
</ion-col>
</ion-row>
</ion-grid>
</div>
</ion-grid>

<div #map id="map" [hidden]="!user"></div>

Expand All @@ -58,9 +65,5 @@
<ion-icon name="locate" slot="start"></ion-icon>
Stop Tracking
</ion-button>
<div>
{{ user.uid}}
</div>
</div>

</ion-content>
18 changes: 18 additions & 0 deletions src/app/home/home.page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,21 @@
width: 100%;
height: 60%;
}

.time {
display: flex;
align-content: center;
justify-content: center;
font-size: 35;
}

.dataHeader {
width: auto;
height: auto;
border-radius: 25;
background-color: red;
}

.textCenter {
text-align: center;
}
8 changes: 5 additions & 3 deletions src/app/home/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export class HomePage {
markerA = null;
markerB = null;
distanceInMeters = null;
calories = 0;
avgrating = 0;

constructor(private afAuth: AngularFireAuth, private afs: AngularFirestore) {
this.anonLogin();
Expand Down Expand Up @@ -56,7 +58,7 @@ export class HomePage {

// TODO: change this hardcoded value for: this.user.uid
this.locationsCollection = this.afs.collection(
`locations/${this.user.uid}/track`,
`locations/UU46w8P8ASfvMtUkbR8fsPm0F0k2/track`,
ref => ref.orderBy('timestamp')
);

Expand Down Expand Up @@ -115,12 +117,12 @@ export class HomePage {
title: 'Marker B'
});

let distanceInMeters = google.maps.geometry.spherical.computeDistanceBetween(
const distanceInMeters = google.maps.geometry.spherical.computeDistanceBetween(
this.markerA.getPosition(),
this.markerB.getPosition()
);

this.distanceInMeters = distanceInMeters;
this.distanceInMeters = distanceInMeters.toFixed() / 1000;
}

centerMap(locations) {
Expand Down