- Wiring up for lifeeeeee
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user