|
- import { Component, OnInit } from '@angular/core';
- import { Location } from '@angular/common';
- import * as moment from 'moment';
-
- @Component({
- selector: 'app-chat-page',
- templateUrl: './chat-page.component.html',
- styleUrls: ['./chat-page.component.scss']
- })
- export class ChatPageComponent implements OnInit {
- selectedSegment: string = 'messages';
- selectedChat: any = null;
-
- chatList = [{
- user: {
- id: 1,
- name: 'Jordan Janardhan',
- imgUrl: 'https://c-sf.smule.com/rs-s79/arr/c1/0b/83a9328a-1469-4bfd-9e94-622f7ca7b1b5.jpg'
- },
- conversation: [{
- message: 'Hi, What\'s up!?',
- user: 1
- }, {
- message: 'Nothing, Was checking upon you!',
- user: 0
- }, {
- message: 'How you?',
- user: 1
- }, {
- message: 'All Good! you?',
- user: 0
- }, {
- message: 'Dont you feel sad?',
- user: 1
- }, {
- message: 'Why?',
- user: 0
- }, {
- message: 'Cause you flunked the quiz and probably will end up writing a lot of assignments',
- user: 1
- }, {
- message: 'Meh, I will game!',
- user: 0
- }, {
- message: 'Nice! Which game?',
- user: 1
- }, {
- message: 'WOW',
- user: 0
- }, {
- message: 'WOW?',
- user: 1
- }, {
- message: 'World of warcraft you newb!',
- user: 0
- }]
- }, {
- user: {
- id: 2,
- name: 'Sannidhi Mahajan',
- imgUrl: 'https://pbs.twimg.com/profile_images/416884752377843712/MW2qg7-f.jpeg'
- },
- conversation: [{
- message: 'Did you get to answer Today\'s Quiz?',
- user: 2
- }, {
- message: 'Yes!, wbu?',
- user: 0
- }, {
- message: 'I Flunked as usual',
- user: 0
- }, {
- message: 'Oh, tats sad! Learn to study daa',
- user: 2
- }, {
- message: 'I topped the class, hehe',
- user: 2
- }, {
- message: 'Did you get to answer Today\'s Quiz?',
- user: 2
- }, {
- message: 'Yes!, wbu?',
- user: 0
- }, {
- message: 'I Flunked as usual',
- user: 0
- }, {
- message: 'Oh, tats sad! Learn to study daa',
- user: 2
- }, {
- message: 'I topped the class, hehe',
- user: 2
- }]
- }];
-
- constructor(
- private location: Location
- ) { }
-
- ngOnInit(): void {
- }
-
- back() {
- this.location.back();
- }
-
- openChat(index: number) {
- this.selectedChat = this.chatList[index];
- }
-
- getChatEvent(e: boolean) {
- if (e) {
- this.selectedChat = null;
- }
- }
-
- getFormattedDate() {
- return moment().format('ddd, hh:MM a')
- }
-
- }
|