2020-01-29 11:37:25 -08:00
|
|
|
<template>
|
2020-05-10 00:22:39 -07:00
|
|
|
<div class="wrpstxzv" :class="{ children }" v-size="[{ max: 450 }]">
|
2020-01-29 11:37:25 -08:00
|
|
|
<div class="main">
|
2020-05-10 00:22:39 -07:00
|
|
|
<mk-avatar class="avatar" :user="note.user"/>
|
2020-01-29 11:37:25 -08:00
|
|
|
<div class="body">
|
2020-05-10 00:22:39 -07:00
|
|
|
<x-note-header class="header" :note="note" :mini="true"/>
|
|
|
|
<div class="body">
|
|
|
|
<p v-if="note.cw != null" class="cw">
|
|
|
|
<mfm v-if="note.cw != ''" class="text" :text="note.cw" :author="note.user" :i="$store.state.i" :custom-emojis="note.emojis" />
|
|
|
|
<x-cw-button v-model="showContent" :note="note"/>
|
|
|
|
</p>
|
|
|
|
<div class="content" v-show="note.cw == null || showContent">
|
|
|
|
<x-sub-note-content class="text" :note="note"/>
|
|
|
|
</div>
|
2020-01-29 11:37:25 -08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-05-10 00:22:39 -07:00
|
|
|
<x-sub v-for="reply in replies" :key="reply.id" :note="reply" class="reply" :detail="true" :children="true"/>
|
2020-01-29 11:37:25 -08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import XNoteHeader from './note-header.vue';
|
|
|
|
import XSubNoteContent from './sub-note-content.vue';
|
|
|
|
import XCwButton from './cw-button.vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
2020-05-10 00:22:39 -07:00
|
|
|
name: 'x-sub',
|
|
|
|
|
2020-01-29 11:37:25 -08:00
|
|
|
components: {
|
|
|
|
XNoteHeader,
|
|
|
|
XSubNoteContent,
|
|
|
|
XCwButton,
|
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
note: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
},
|
2020-05-10 00:22:39 -07:00
|
|
|
detail: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
children: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false
|
|
|
|
},
|
2020-01-29 11:37:25 -08:00
|
|
|
// TODO
|
|
|
|
truncate: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2020-05-10 00:22:39 -07:00
|
|
|
showContent: false,
|
|
|
|
replies: [],
|
2020-01-29 11:37:25 -08:00
|
|
|
};
|
2020-05-10 00:22:39 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
if (this.detail) {
|
|
|
|
this.$root.api('notes/children', {
|
|
|
|
noteId: this.note.id,
|
|
|
|
limit: 5
|
|
|
|
}).then(replies => {
|
|
|
|
this.replies = replies;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2020-01-29 11:37:25 -08:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-03-20 03:19:28 -07:00
|
|
|
.wrpstxzv {
|
2020-01-29 11:37:25 -08:00
|
|
|
padding: 16px 32px;
|
|
|
|
font-size: 0.9em;
|
|
|
|
|
2020-03-20 05:58:04 -07:00
|
|
|
&.max-width_450px {
|
2020-01-29 11:37:25 -08:00
|
|
|
padding: 14px 16px;
|
|
|
|
}
|
|
|
|
|
2020-05-10 00:22:39 -07:00
|
|
|
&.children {
|
|
|
|
padding: 10px 0 0 16px;
|
|
|
|
font-size: 1em;
|
|
|
|
|
|
|
|
&.max-width_450px {
|
|
|
|
padding: 10px 0 0 8px;
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
> .main {
|
2020-05-10 00:22:39 -07:00
|
|
|
display: flex;
|
2020-01-29 11:37:25 -08:00
|
|
|
|
2020-05-10 00:22:39 -07:00
|
|
|
> .avatar {
|
|
|
|
flex-shrink: 0;
|
|
|
|
display: block;
|
|
|
|
margin: 0 8px 0 0;
|
|
|
|
width: 38px;
|
|
|
|
height: 38px;
|
|
|
|
border-radius: 8px;
|
2020-01-29 11:37:25 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
> .body {
|
2020-05-10 00:22:39 -07:00
|
|
|
flex: 1;
|
|
|
|
min-width: 0;
|
|
|
|
|
|
|
|
> .header {
|
|
|
|
margin-bottom: 2px;
|
2020-01-29 11:37:25 -08:00
|
|
|
}
|
|
|
|
|
2020-05-10 00:22:39 -07:00
|
|
|
> .body {
|
|
|
|
> .cw {
|
|
|
|
cursor: default;
|
|
|
|
display: block;
|
2020-01-29 11:37:25 -08:00
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
2020-05-10 00:22:39 -07:00
|
|
|
overflow-wrap: break-word;
|
|
|
|
|
|
|
|
> .text {
|
|
|
|
margin-right: 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .content {
|
|
|
|
> .text {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-10 00:22:39 -07:00
|
|
|
|
|
|
|
> .reply {
|
|
|
|
border-left: solid 1px var(--divider);
|
|
|
|
margin-top: 10px;
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
}
|
|
|
|
</style>
|