- Wiring up for lifeeeeee
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
"ionic-angular": "3.9.2",
|
||||
"ionic-swipe-all": "^1.2.0",
|
||||
"ionicons": "3.0.0",
|
||||
"moment": "^2.21.0",
|
||||
"rxjs": "5.5.2",
|
||||
"sw-toolbox": "3.6.0",
|
||||
"zone.js": "0.8.18"
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -24,9 +24,7 @@
|
||||
<ion-col>
|
||||
{{profile.details.name}}
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
23h ago
|
||||
</ion-col>
|
||||
<ion-col [innerHTML]="getLatestMessageTimestamp(profile.messages)"></ion-col>
|
||||
</ion-row>
|
||||
<ion-row nowrap>
|
||||
<ion-col [innerHTML]="getLatestMessage(profile.messages)"></ion-col>
|
||||
|
||||
@@ -5,6 +5,8 @@ import { ProfileService } from '../../services/profiles';
|
||||
import { ProfilePage } from '../profile/profile';
|
||||
import { ChatPage } from '../chat/chat';
|
||||
|
||||
import moment from 'moment';
|
||||
|
||||
@Component({
|
||||
selector: 'page-messages',
|
||||
templateUrl: 'messages.html',
|
||||
@@ -21,8 +23,11 @@ export class MessagesPage {
|
||||
}
|
||||
|
||||
getLatestMessage(messages) {
|
||||
var latest = Math.max.apply(Math, messages.map(function(o){ return o.order; }));
|
||||
return messages[latest].text != '' ? messages[latest].text : '<em>Picture</em>';
|
||||
return messages[(messages.length - 1)].text != '' ? messages[(messages.length - 1)].text : '<em>Picture</em>';
|
||||
}
|
||||
|
||||
getLatestMessageTimestamp(messages) {
|
||||
return moment(messages[(messages.length - 1)].timestamp).fromNow();
|
||||
}
|
||||
|
||||
interviewTapped(event, profile) {
|
||||
|
||||
@@ -19,7 +19,7 @@ export class ProfileService {
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
this.http.get('/assets/data/profiles.json')
|
||||
this.http.get('https://api.fitz.guru/urge/profiles')
|
||||
.map(res => res.json())
|
||||
.subscribe(data => {
|
||||
this.profiles = data;
|
||||
|
||||
Reference in New Issue
Block a user