summaryrefslogtreecommitdiff
path: root/src/client/app/desktop/views/components/sub-post-content.vue
blob: f13822331bdeedf7b7d89f7346fc803a05164a9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<template>
<div class="mk-sub-post-content">
	<div class="body">
		<a class="reply" v-if="post.replyId">%fa:reply%</a>
		<mk-post-html :ast="post.ast" :i="os.i"/>
		<a class="rp" v-if="post.repostId" :href="`/post:${post.repostId}`">RP: ...</a>
		<mk-url-preview v-for="url in urls" :url="url" :key="url"/>
	</div>
	<details v-if="post.media">
		<summary>({{ post.media.length }}つのメディア)</summary>
		<mk-media-list :media-list="post.media"/>
	</details>
	<details v-if="post.poll">
		<summary>投票</summary>
		<mk-poll :post="post"/>
	</details>
</div>
</template>

<script lang="ts">
import Vue from 'vue';

export default Vue.extend({
	props: ['post'],
	computed: {
		urls(): string[] {
			if (this.post.ast) {
				return this.post.ast
					.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
					.map(t => t.url);
			} else {
				return null;
			}
		}
	}
});
</script>

<style lang="stylus" scoped>
.mk-sub-post-content
	overflow-wrap break-word

	> .body
		> .reply
			margin-right 6px
			color #717171

		> .rp
			margin-left 4px
			font-style oblique
			color #a0bf46

	mk-poll
		font-size 80%

</style>