tweet-body.ts 881 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { Component, Input } from "@angular/core";
  2. /**
  3. * Generated class for the TweetBodyComponent component.
  4. *
  5. * See https://angular.io/api/core/Component for more info on Angular
  6. * Components.
  7. */
  8. @Component({
  9. selector: "tweet-body",
  10. templateUrl: "tweet-body.html"
  11. })
  12. export class TweetBodyComponent {
  13. @Input()
  14. data: any[];
  15. constructor() {}
  16. get status(): string {
  17. if (this.data["retweeted_status"]) {
  18. return this.data["retweeted_status"]["full_text"];
  19. } else {
  20. return this.data["full_text"];
  21. }
  22. }
  23. get entities() {
  24. if (this.data["retweeted_status"]) {
  25. return this.data["retweeted_status"]["entities"];
  26. } else {
  27. return this.data["entities"];
  28. }
  29. }
  30. get hasPhoto() {
  31. return (
  32. !this.data["private_tweet"] &&
  33. (this.entities["media"] && this.entities["media"][0]["type"] == "photo")
  34. );
  35. }
  36. }