ReportInfoItem.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 class="item-title">
  13. Reported by
  14. <router-link
  15. v-if="createdBy.username"
  16. :to="{
  17. path: `/u/${createdBy.username}`
  18. }"
  19. :title="createdBy._id"
  20. @click="closeModal('viewReport')"
  21. >
  22. {{ createdBy.username }}
  23. </router-link>
  24. <span v-else :title="createdBy._id">Deleted User</span>
  25. </h2>
  26. <h5 class="item-description">
  27. {{
  28. formatDistance(new Date(createdAt), new Date(), {
  29. addSuffix: true
  30. })
  31. }}
  32. </h5>
  33. </div>
  34. <div class="universal-item-actions">
  35. <slot name="actions" />
  36. </div>
  37. </div>
  38. </template>
  39. <script>
  40. import { mapActions } from "vuex";
  41. import { formatDistance } from "date-fns";
  42. import ProfilePicture from "@/components/ProfilePicture.vue";
  43. export default {
  44. components: { ProfilePicture },
  45. props: {
  46. createdBy: { type: Object, default: () => {} },
  47. createdAt: { type: String, default: "" }
  48. },
  49. methods: {
  50. formatDistance,
  51. ...mapActions("modalVisibility", ["closeModal"])
  52. }
  53. };
  54. </script>
  55. <style lang="scss">
  56. .report-info-item .item-icon .profile-picture span {
  57. font-size: 25px;
  58. }
  59. </style>
  60. <style lang="scss" scoped>
  61. .night-mode {
  62. .report-info-item {
  63. background-color: var(--dark-grey-2) !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. .profile-picture,
  74. i {
  75. width: 45px;
  76. height: 45px;
  77. }
  78. i {
  79. font-size: 30px;
  80. display: flex;
  81. align-items: center;
  82. justify-content: center;
  83. }
  84. }
  85. .item-title {
  86. font-size: 14px;
  87. margin: 0;
  88. }
  89. .item-description {
  90. font-size: 12px;
  91. text-transform: capitalize;
  92. margin: 0;
  93. }
  94. }
  95. </style>