Show attachments in quoted posts
This commit is contained in:
parent
e3054904e9
commit
b364b167ad
2 changed files with 49 additions and 20 deletions
|
@ -58,12 +58,12 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<post-content :post="post"></post-content>
|
<post-content :post="post"></post-content>
|
||||||
<div class="post-attachment" v-if="post.media_attachments.length > 0">
|
<div class="post-attachments" v-if="post.media_attachments.length > 0">
|
||||||
<template v-for="attachment in post.media_attachments" :key="attachment.id">
|
<post-attachment
|
||||||
<img v-if="attachment.type === 'image'" :src="attachment.url">
|
v-for="attachment in post.media_attachments"
|
||||||
<video v-else-if="attachment.type === 'video'" :src="attachment.url" controls></video>
|
:attachment="attachment"
|
||||||
<a v-else :href="attachment.url">{{ attachment.url }}</a>
|
:key="attachment.id"
|
||||||
</template>
|
></post-attachment>
|
||||||
</div>
|
</div>
|
||||||
<a
|
<a
|
||||||
v-if="post.quote"
|
v-if="post.quote"
|
||||||
|
@ -81,6 +81,13 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<post-content :post="post.quote"></post-content>
|
<post-content :post="post.quote"></post-content>
|
||||||
|
<div class="quote-attachments" v-if="post.quote.media_attachments.length > 0">
|
||||||
|
<post-attachment
|
||||||
|
v-for="attachment in post.quote.media_attachments"
|
||||||
|
:attachment="attachment"
|
||||||
|
:key="attachment.id"
|
||||||
|
></post-attachment>
|
||||||
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<div class="post-footer">
|
<div class="post-footer">
|
||||||
<router-link
|
<router-link
|
||||||
|
@ -249,6 +256,7 @@ import {
|
||||||
import { ProfileWrapper } from "@/api/users"
|
import { ProfileWrapper } from "@/api/users"
|
||||||
import Avatar from "@/components/Avatar.vue"
|
import Avatar from "@/components/Avatar.vue"
|
||||||
import CryptoAddress from "@/components/CryptoAddress.vue"
|
import CryptoAddress from "@/components/CryptoAddress.vue"
|
||||||
|
import PostAttachment from "@/components/PostAttachment.vue"
|
||||||
import PostContent from "@/components/PostContent.vue"
|
import PostContent from "@/components/PostContent.vue"
|
||||||
import PostEditor from "@/components/PostEditor.vue"
|
import PostEditor from "@/components/PostEditor.vue"
|
||||||
import VisibilityIcon from "@/components/VisibilityIcon.vue"
|
import VisibilityIcon from "@/components/VisibilityIcon.vue"
|
||||||
|
@ -618,6 +626,11 @@ async function onMintToken() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post-attachments,
|
||||||
|
.quote-attachments {
|
||||||
|
padding: 0 $block-inner-padding $block-inner-padding;
|
||||||
|
}
|
||||||
|
|
||||||
.post-quote {
|
.post-quote {
|
||||||
border: 1px solid $separator-color;
|
border: 1px solid $separator-color;
|
||||||
border-radius: $block-border-radius;
|
border-radius: $block-border-radius;
|
||||||
|
@ -657,20 +670,6 @@ async function onMintToken() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-attachment {
|
|
||||||
padding: 0 $block-inner-padding $block-inner-padding;
|
|
||||||
word-wrap: break-word;
|
|
||||||
|
|
||||||
img {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
@include block-link;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.post-footer {
|
.post-footer {
|
||||||
@include post-icon;
|
@include post-icon;
|
||||||
|
|
||||||
|
|
30
src/components/PostAttachment.vue
Normal file
30
src/components/PostAttachment.vue
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<template>
|
||||||
|
<img v-if="attachment.type === 'image'" :src="attachment.url">
|
||||||
|
<video v-else-if="attachment.type === 'video'" :src="attachment.url" controls></video>
|
||||||
|
<a v-else :href="attachment.url">{{ attachment.url }}</a>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { Attachment } from "@/api/posts"
|
||||||
|
|
||||||
|
/* eslint-disable-next-line no-undef */
|
||||||
|
defineProps<{
|
||||||
|
attachment: Attachment,
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import "../styles/theme";
|
||||||
|
@import "../styles/mixins";
|
||||||
|
|
||||||
|
img {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
@include block-link;
|
||||||
|
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in a new issue