ReportInfoItem.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <div class="universal-item report-info-item">
  3. <div class="item-icon">
  4. <profile-picture
  5. :avatar="createdBy.avatar"
  6. :name="createdBy.name ? createdBy.name : createdBy.username"
  7. v-if="createdBy.avatar"
  8. />
  9. <i class="material-icons" v-else>person_remove</i>
  10. </div>
  11. <div class="item-title-description">
  12. <h2
  13. class="item-title"
  14. :title="`Reported by ${
  15. createdBy.username ? createdBy.username : 'Deleted User'
  16. }`"
  17. >
  18. Reported by
  19. <router-link
  20. v-if="createdBy.username"
  21. :to="{
  22. path: `/u/${createdBy.username}`
  23. }"
  24. :title="createdBy._id"
  25. @click="closeModal('viewReport')"
  26. >
  27. {{ createdBy.username }}
  28. </router-link>
  29. <span v-else :title="createdBy._id">Deleted User</span>
  30. </h2>
  31. <h5 class="item-description">
  32. {{
  33. formatDistance(new Date(createdAt), new Date(), {
  34. addSuffix: true
  35. })
  36. }}
  37. </h5>
  38. </div>
  39. <div class="universal-item-actions">
  40. <slot name="actions" />
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. import { mapActions } from "vuex";
  46. import { formatDistance } from "date-fns";
  47. import ProfilePicture from "@/components/ProfilePicture.vue";
  48. export default {
  49. components: { ProfilePicture },
  50. props: {
  51. createdBy: { type: Object, default: () => {} },
  52. createdAt: { type: String, default: "" }
  53. },
  54. methods: {
  55. formatDistance,
  56. ...mapActions("modalVisibility", ["closeModal"])
  57. }
  58. };
  59. </script>
  60. <style lang="less" scoped>
  61. .night-mode {
  62. .report-info-item {
  63. background-color: var(--dark-grey) !important;
  64. border: 0 !important;
  65. }
  66. }
  67. .report-info-item {
  68. .item-icon {
  69. min-width: 45px;
  70. max-width: 45px;
  71. height: 45px;
  72. margin-right: 10px;
  73. :deep(.profile-picture.using-initials span) {
  74. font-size: calc(
  75. 45px / 5 * 2
  76. ); // 2/5th of .profile-picture height/width
  77. }
  78. .profile-picture,
  79. i {
  80. width: 45px;
  81. height: 45px;
  82. }
  83. i {
  84. font-size: 30px;
  85. display: flex;
  86. align-items: center;
  87. justify-content: center;
  88. }
  89. }
  90. .item-title-description {
  91. min-width: 0;
  92. }
  93. .item-title {
  94. font-size: 14px;
  95. margin: 0;
  96. }
  97. .item-description {
  98. font-size: 12px;
  99. line-height: 14px;
  100. text-transform: capitalize;
  101. margin: 0;
  102. }
  103. }
  104. </style>