Initial commit

This commit is contained in:
2018-03-02 02:59:55 -05:00
parent 30518e56d4
commit 33cf657c70
34 changed files with 541 additions and 124 deletions

View File

@@ -0,0 +1,37 @@
<ion-header no-border>
<ion-row>
<ion-col text-center>
<button ion-button clear small>
Messages
</button>
</ion-col>
<ion-col text-center>
<button ion-button clear small>
Taps
</button>
</ion-col>
</ion-row>
</ion-header>
<ion-content no-padding>
<ion-list>
<ion-item no-padding *ngFor="let profile of profiles">
<ion-thumbnail item-start (tap)="profilePictureTapped($event, profile)">
<img [src]="profile.details.pic.thumb">
</ion-thumbnail>
<ion-grid (tap)="interviewTapped($event, profile)">
<ion-row nowrap justify-content-between>
<ion-col>
{{profile.details.name}}
</ion-col>
<ion-col>
23h ago
</ion-col>
</ion-row>
<ion-row nowrap>
<ion-col [innerHTML]="getLatestMessage(profile.messages)"></ion-col>
</ion-row>
</ion-grid>
</ion-item>
</ion-list>
</ion-content>

View File

@@ -0,0 +1,3 @@
page-messages {
}

View File

@@ -0,0 +1,39 @@
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { ProfileService } from '../../services/profiles';
import { ProfilePage } from '../profile/profile';
import { ChatPage } from '../chat/chat';
@Component({
selector: 'page-messages',
templateUrl: 'messages.html',
providers: [ ProfileService ]
})
export class MessagesPage {
profiles: any;
constructor(public navCtrl: NavController, public profileService: ProfileService) {
profileService.load().then((data) => {
this.profiles = data;
});
}
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>';
}
interviewTapped(event, profile) {
this.navCtrl.push(ChatPage, {
profile: profile
});
}
profilePictureTapped(event, profile) {
this.navCtrl.push(ProfilePage, {
profile: profile
});
}
}