2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2020-10-17 13:12:00 +02:00
|
|
|
<div class="fcuexfpr">
|
2021-02-07 02:31:18 +01:00
|
|
|
<div v-if="note" class="note" v-anim>
|
2020-11-17 06:59:15 +01:00
|
|
|
<div class="_section" v-if="showNext">
|
2021-01-01 14:41:20 +01:00
|
|
|
<XNotes class="_content _noGap_" :pagination="next"/>
|
2020-10-17 13:12:00 +02:00
|
|
|
</div>
|
2020-02-09 19:55:33 +01:00
|
|
|
|
2020-11-17 06:59:15 +01:00
|
|
|
<div class="_section main">
|
|
|
|
<MkButton v-if="!showNext && hasNext" class="load next _content" @click="showNext = true"><Fa :icon="faChevronUp"/></MkButton>
|
|
|
|
<div class="_content _vMargin">
|
2020-10-19 08:05:29 +02:00
|
|
|
<MkRemoteCaution v-if="note.user.host != null" :href="note.url || note.uri" class="_vMargin"/>
|
2021-01-01 14:41:20 +01:00
|
|
|
<XNoteDetailed v-model:note="note" :key="note.id" class="_vMargin"/>
|
2020-10-17 13:12:00 +02:00
|
|
|
</div>
|
2020-11-17 06:59:15 +01:00
|
|
|
<div class="_content clips _vMargin" v-if="clips && clips.length > 0">
|
2020-12-26 02:47:36 +01:00
|
|
|
<div class="title">{{ $ts.clip }}</div>
|
2020-11-17 06:59:15 +01:00
|
|
|
<MkA v-for="item in clips" :key="item.id" :to="`/clips/${item.id}`" class="item _panel _vMargin">
|
|
|
|
<b>{{ item.name }}</b>
|
|
|
|
<div v-if="item.description" class="description">{{ item.description }}</div>
|
|
|
|
<div class="user">
|
|
|
|
<MkAvatar :user="item.user" class="avatar"/> <MkUserName :user="item.user" :nowrap="false"/>
|
|
|
|
</div>
|
|
|
|
</MkA>
|
|
|
|
</div>
|
|
|
|
<MkButton v-if="!showPrev && hasPrev" class="load prev _content" @click="showPrev = true"><Fa :icon="faChevronDown"/></MkButton>
|
2020-10-17 13:12:00 +02:00
|
|
|
</div>
|
2020-02-16 14:15:49 +01:00
|
|
|
|
2020-11-17 06:59:15 +01:00
|
|
|
<div class="_section" v-if="showPrev">
|
2021-01-01 14:41:20 +01:00
|
|
|
<XNotes class="_content _noGap_" :pagination="prev"/>
|
2020-10-17 13:12:00 +02:00
|
|
|
</div>
|
2020-03-21 04:32:40 +01:00
|
|
|
</div>
|
2020-07-11 03:13:11 +02:00
|
|
|
|
|
|
|
<div v-if="error">
|
2020-10-17 13:12:00 +02:00
|
|
|
<MkError @retry="fetch()"/>
|
2020-07-11 03:13:11 +02:00
|
|
|
</div>
|
2020-01-29 20:37:25 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 13:12:00 +02:00
|
|
|
import { computed, defineComponent } from 'vue';
|
2020-02-16 14:15:49 +01:00
|
|
|
import { faChevronUp, faChevronDown } from '@fortawesome/free-solid-svg-icons';
|
2020-10-17 13:12:00 +02:00
|
|
|
import XNote from '@/components/note.vue';
|
2021-01-01 14:41:20 +01:00
|
|
|
import XNoteDetailed from '@/components/note-detailed.vue';
|
2020-10-17 13:12:00 +02:00
|
|
|
import XNotes from '@/components/notes.vue';
|
|
|
|
import MkRemoteCaution from '@/components/remote-caution.vue';
|
|
|
|
import MkButton from '@/components/ui/button.vue';
|
|
|
|
import * as os from '@/os';
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2020-10-17 13:12:00 +02:00
|
|
|
export default defineComponent({
|
2020-01-29 20:37:25 +01:00
|
|
|
components: {
|
2020-02-16 14:15:49 +01:00
|
|
|
XNote,
|
2021-01-01 14:41:20 +01:00
|
|
|
XNoteDetailed,
|
2020-02-16 14:15:49 +01:00
|
|
|
XNotes,
|
2020-03-21 05:07:02 +01:00
|
|
|
MkRemoteCaution,
|
2020-10-17 13:12:00 +02:00
|
|
|
MkButton,
|
2020-01-29 20:37:25 +01:00
|
|
|
},
|
2020-10-24 18:21:41 +02:00
|
|
|
props: {
|
|
|
|
noteId: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
2020-01-29 20:37:25 +01:00
|
|
|
data() {
|
|
|
|
return {
|
2020-10-17 13:12:00 +02:00
|
|
|
INFO: computed(() => this.note ? {
|
2020-12-26 02:47:36 +01:00
|
|
|
title: this.$ts.note,
|
2020-11-03 12:36:12 +01:00
|
|
|
avatar: this.note.user,
|
2020-10-17 13:12:00 +02:00
|
|
|
} : null),
|
2020-01-29 20:37:25 +01:00
|
|
|
note: null,
|
2020-11-17 06:59:15 +01:00
|
|
|
clips: null,
|
2020-02-16 14:15:49 +01:00
|
|
|
hasPrev: false,
|
|
|
|
hasNext: false,
|
|
|
|
showPrev: false,
|
|
|
|
showNext: false,
|
2020-01-29 20:37:25 +01:00
|
|
|
error: null,
|
2020-02-16 14:15:49 +01:00
|
|
|
prev: {
|
|
|
|
endpoint: 'users/notes',
|
|
|
|
limit: 10,
|
|
|
|
params: init => ({
|
|
|
|
userId: this.note.userId,
|
|
|
|
untilId: this.note.id,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
next: {
|
|
|
|
reversed: true,
|
|
|
|
endpoint: 'users/notes',
|
|
|
|
limit: 10,
|
|
|
|
params: init => ({
|
|
|
|
userId: this.note.userId,
|
|
|
|
sinceId: this.note.id,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
faChevronUp, faChevronDown
|
2020-01-29 20:37:25 +01:00
|
|
|
};
|
|
|
|
},
|
|
|
|
watch: {
|
2020-10-24 18:21:41 +02:00
|
|
|
noteId: 'fetch'
|
2020-01-29 20:37:25 +01:00
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.fetch();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
fetch() {
|
2020-10-17 13:12:00 +02:00
|
|
|
os.api('notes/show', {
|
2020-10-24 18:21:41 +02:00
|
|
|
noteId: this.noteId
|
2020-01-29 20:37:25 +01:00
|
|
|
}).then(note => {
|
2020-02-16 14:15:49 +01:00
|
|
|
Promise.all([
|
2020-11-17 06:59:15 +01:00
|
|
|
os.api('notes/clips', {
|
|
|
|
noteId: note.id,
|
|
|
|
}),
|
2020-10-17 13:12:00 +02:00
|
|
|
os.api('users/notes', {
|
2020-02-16 14:15:49 +01:00
|
|
|
userId: note.userId,
|
|
|
|
untilId: note.id,
|
|
|
|
limit: 1,
|
|
|
|
}),
|
2020-10-17 13:12:00 +02:00
|
|
|
os.api('users/notes', {
|
2020-02-16 14:15:49 +01:00
|
|
|
userId: note.userId,
|
|
|
|
sinceId: note.id,
|
|
|
|
limit: 1,
|
|
|
|
}),
|
2020-11-17 06:59:15 +01:00
|
|
|
]).then(([clips, prev, next]) => {
|
|
|
|
this.clips = clips;
|
2020-02-16 14:15:49 +01:00
|
|
|
this.hasPrev = prev.length !== 0;
|
|
|
|
this.hasNext = next.length !== 0;
|
|
|
|
this.note = note;
|
|
|
|
});
|
2020-01-29 20:37:25 +01:00
|
|
|
}).catch(e => {
|
|
|
|
this.error = e;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2020-10-17 13:12:00 +02:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.fcuexfpr {
|
|
|
|
> .note {
|
2020-11-17 06:59:15 +01:00
|
|
|
> .main {
|
2020-10-17 13:12:00 +02:00
|
|
|
> .load {
|
|
|
|
min-width: 0;
|
|
|
|
border-radius: 999px;
|
2020-11-17 06:59:15 +01:00
|
|
|
|
|
|
|
&.next {
|
|
|
|
margin-bottom: var(--margin);
|
|
|
|
}
|
|
|
|
|
|
|
|
&.prev {
|
|
|
|
margin-top: var(--margin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .clips {
|
|
|
|
> .title {
|
|
|
|
font-weight: bold;
|
|
|
|
padding: 12px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .item {
|
|
|
|
display: block;
|
|
|
|
padding: 16px;
|
|
|
|
|
|
|
|
> .description {
|
|
|
|
padding: 8px 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .user {
|
|
|
|
$height: 32px;
|
|
|
|
padding-top: 16px;
|
|
|
|
border-top: solid 1px var(--divider);
|
|
|
|
line-height: $height;
|
|
|
|
|
|
|
|
> .avatar {
|
|
|
|
width: $height;
|
|
|
|
height: $height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|