1
0

AdminModalPost.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div class="mb-3">
  3. <div v-if="status.media_attachments && status.media_attachments.length" class="list-group-item" style="gap:1rem;overflow:hidden;">
  4. <div class="text-center text-muted small font-weight-bold mb-3">Reported Post Media</div>
  5. <div v-if="status.media_attachments && status.media_attachments.length" class="d-flex flex-grow-1" style="gap: 1rem;overflow-x:auto;">
  6. <template
  7. v-for="media in status.media_attachments">
  8. <img
  9. v-if="media.type === 'image'"
  10. :src="media.url"
  11. width="70"
  12. height="70"
  13. class="rounded"
  14. style="object-fit: cover;"
  15. @click="toggleLightbox"
  16. onerror="this.src='/storage/no-preview.png';this.error=null;" />
  17. <video
  18. v-else-if="media.type === 'video'"
  19. width="140"
  20. height="90"
  21. playsinline
  22. @click.prevent="toggleVideoLightbox($event, media.url)"
  23. class="rounded"
  24. >
  25. <source :src="media.url" :type="media.mime">
  26. </video>
  27. </template>
  28. </div>
  29. </div>
  30. <div class="list-group-item d-flex flex-row flex-grow-1" style="gap:1rem;">
  31. <div class="flex-grow-1">
  32. <div v-if="status && status.in_reply_to_id && status.parent && status.parent.account" class="mb-3">
  33. <template v-if="showInReplyTo">
  34. <div class="mt-n1 text-center text-muted small font-weight-bold mb-1">Reply to</div>
  35. <div class="media" style="gap: 1rem;">
  36. <img
  37. :src="status.parent.account.avatar"
  38. width="40"
  39. height="40"
  40. class="rounded-lg"
  41. onerror="this.onerror=null;this.src='/storage/avatars/default.jpg?v=0';">
  42. <div class="d-flex flex-column">
  43. <p class="font-weight-bold mb-0" style="font-size: 11px;">
  44. <a :href="`/i/web/profile/${status.parent.account.id}`" target="_blank">{{ status.parent.account.acct }}</a>
  45. </p>
  46. <admin-read-more :content="status.parent.content_text" />
  47. <p class="mb-1">
  48. <a :href="`/i/web/post/${status.parent.id}`" target="_blank" class="text-muted" style="font-size: 11px;">
  49. <i class="far fa-link mr-1"></i> {{ formatDate(status.parent.created_at)}}
  50. </a>
  51. </p>
  52. </div>
  53. </div>
  54. <hr class="my-1">
  55. </template>
  56. <a v-else class="btn btn-dark font-weight-bold btn-block btn-sm" href="#" @click.prevent="showInReplyTo = true">Show parent post</a>
  57. </div>
  58. <div>
  59. <div class="mt-n1 text-center text-muted small font-weight-bold mb-1">Reported Post</div>
  60. <div class="media" style="gap: 1rem;">
  61. <img
  62. :src="status.account.avatar"
  63. width="40"
  64. height="40"
  65. class="rounded-lg"
  66. onerror="this.onerror=null;this.src='/storage/avatars/default.jpg?v=0';">
  67. <div class="d-flex flex-column">
  68. <p class="font-weight-bold mb-0" style="font-size: 11px;">
  69. <a :href="`/i/web/profile/${status.account.id}`" target="_blank">{{ status.account.acct }}</a>
  70. </p>
  71. <template v-if="status && status.content_text && status.content_text.length">
  72. <admin-read-more :content="status.content_text" />
  73. </template>
  74. <template v-else>
  75. <admin-read-more content="EMPTY CAPTION" class="font-weight-bold text-muted" />
  76. </template>
  77. <p class="mb-0">
  78. <a :href="`/i/web/post/${status.id}`" target="_blank" class="text-muted" style="font-size: 11px;">
  79. <i class="far fa-link mr-1"></i> {{ formatDate(status.created_at)}}
  80. </a>
  81. </p>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </template>
  89. <script>
  90. import BigPicture from 'bigpicture';
  91. import AdminReadMore from './AdminReadMore.vue';
  92. export default {
  93. props: {
  94. status: {
  95. type: Object
  96. }
  97. },
  98. data() {
  99. return {
  100. showInReplyTo: false,
  101. }
  102. },
  103. components: {
  104. "admin-read-more": AdminReadMore
  105. },
  106. methods: {
  107. toggleLightbox(e) {
  108. BigPicture({
  109. el: e.target
  110. })
  111. },
  112. toggleVideoLightbox($event, src) {
  113. BigPicture({
  114. el: event.target,
  115. vidSrc: src
  116. })
  117. },
  118. formatDate(str) {
  119. let date = new Date(str);
  120. return new Intl.DateTimeFormat('default', {
  121. month: 'long',
  122. day: 'numeric',
  123. year: 'numeric',
  124. hour: 'numeric',
  125. minute: 'numeric'
  126. }).format(date);
  127. },
  128. }
  129. }
  130. </script>