Skip to content

Commit 473ba02

Browse files
dotansimhadarkbasic
authored andcommitted
Step 2.7: Add stubs for chats objects
1 parent e113247 commit 473ba02

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

src/pages/chats/chats.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,64 @@
11
import { Component } from '@angular/core';
2+
import { Observable } from 'rxjs';
3+
import * as moment from 'moment';
24

35
@Component({
46
templateUrl: 'chats.html'
57
})
68
export class ChatsPage {
9+
chats: Observable<any[]>;
10+
711
constructor() {
12+
this.chats = this.findChats();
13+
}
814

15+
private findChats(): Observable<any[]> {
16+
return Observable.of([
17+
{
18+
_id: '0',
19+
title: 'Ethan Gonzalez',
20+
picture: 'https://randomuser.me/api/portraits/thumb/men/1.jpg',
21+
lastMessage: {
22+
content: 'You on your way?',
23+
createdAt: moment().subtract(1, 'hours').toDate()
24+
}
25+
},
26+
{
27+
_id: '1',
28+
title: 'Bryan Wallace',
29+
picture: 'https://randomuser.me/api/portraits/thumb/lego/1.jpg',
30+
lastMessage: {
31+
content: 'Hey, it\'s me',
32+
createdAt: moment().subtract(2, 'hours').toDate()
33+
}
34+
},
35+
{
36+
_id: '2',
37+
title: 'Avery Stewart',
38+
picture: 'https://randomuser.me/api/portraits/thumb/women/1.jpg',
39+
lastMessage: {
40+
content: 'I should buy a boat',
41+
createdAt: moment().subtract(1, 'days').toDate()
42+
}
43+
},
44+
{
45+
_id: '3',
46+
title: 'Katie Peterson',
47+
picture: 'https://randomuser.me/api/portraits/thumb/women/2.jpg',
48+
lastMessage: {
49+
content: 'Look at my mukluks!',
50+
createdAt: moment().subtract(4, 'days').toDate()
51+
}
52+
},
53+
{
54+
_id: '4',
55+
title: 'Ray Edwards',
56+
picture: 'https://randomuser.me/api/portraits/thumb/men/2.jpg',
57+
lastMessage: {
58+
content: 'This is wicked good ice cream.',
59+
createdAt: moment().subtract(2, 'weeks').toDate()
60+
}
61+
}
62+
]);
963
}
1064
}

0 commit comments

Comments
 (0)