Angular LMS app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Deze repo is gearchiveerd. U kunt bestanden bekijken en het klonen, maar niet pushen of problemen/pull-requests openen.
 
 
 
 

122 regels
2.9 KiB

  1. import { Component, OnInit } from '@angular/core';
  2. import { Location } from '@angular/common';
  3. import * as moment from 'moment';
  4. @Component({
  5. selector: 'app-chat-page',
  6. templateUrl: './chat-page.component.html',
  7. styleUrls: ['./chat-page.component.scss']
  8. })
  9. export class ChatPageComponent implements OnInit {
  10. selectedSegment: string = 'messages';
  11. selectedChat: any = null;
  12. chatList = [{
  13. user: {
  14. id: 1,
  15. name: 'Jordan Janardhan',
  16. imgUrl: 'https://c-sf.smule.com/rs-s79/arr/c1/0b/83a9328a-1469-4bfd-9e94-622f7ca7b1b5.jpg'
  17. },
  18. conversation: [{
  19. message: 'Hi, What\'s up!?',
  20. user: 1
  21. }, {
  22. message: 'Nothing, Was checking upon you!',
  23. user: 0
  24. }, {
  25. message: 'How you?',
  26. user: 1
  27. }, {
  28. message: 'All Good! you?',
  29. user: 0
  30. }, {
  31. message: 'Dont you feel sad?',
  32. user: 1
  33. }, {
  34. message: 'Why?',
  35. user: 0
  36. }, {
  37. message: 'Cause you flunked the quiz and probably will end up writing a lot of assignments',
  38. user: 1
  39. }, {
  40. message: 'Meh, I will game!',
  41. user: 0
  42. }, {
  43. message: 'Nice! Which game?',
  44. user: 1
  45. }, {
  46. message: 'WOW',
  47. user: 0
  48. }, {
  49. message: 'WOW?',
  50. user: 1
  51. }, {
  52. message: 'World of warcraft you newb!',
  53. user: 0
  54. }]
  55. }, {
  56. user: {
  57. id: 2,
  58. name: 'Sannidhi Mahajan',
  59. imgUrl: 'https://pbs.twimg.com/profile_images/416884752377843712/MW2qg7-f.jpeg'
  60. },
  61. conversation: [{
  62. message: 'Did you get to answer Today\'s Quiz?',
  63. user: 2
  64. }, {
  65. message: 'Yes!, wbu?',
  66. user: 0
  67. }, {
  68. message: 'I Flunked as usual',
  69. user: 0
  70. }, {
  71. message: 'Oh, tats sad! Learn to study daa',
  72. user: 2
  73. }, {
  74. message: 'I topped the class, hehe',
  75. user: 2
  76. }, {
  77. message: 'Did you get to answer Today\'s Quiz?',
  78. user: 2
  79. }, {
  80. message: 'Yes!, wbu?',
  81. user: 0
  82. }, {
  83. message: 'I Flunked as usual',
  84. user: 0
  85. }, {
  86. message: 'Oh, tats sad! Learn to study daa',
  87. user: 2
  88. }, {
  89. message: 'I topped the class, hehe',
  90. user: 2
  91. }]
  92. }];
  93. constructor(
  94. private location: Location
  95. ) { }
  96. ngOnInit(): void {
  97. }
  98. back() {
  99. this.location.back();
  100. }
  101. openChat(index: number) {
  102. this.selectedChat = this.chatList[index];
  103. }
  104. getChatEvent(e: boolean) {
  105. if (e) {
  106. this.selectedChat = null;
  107. }
  108. }
  109. getFormattedDate() {
  110. return moment().format('ddd, hh:MM a')
  111. }
  112. }