iceshrimp/src/client/app/common/views/deck/deck.mentions-column.vue

77 lines
1.5 KiB
Vue
Raw Normal View History

2018-09-16 23:15:02 +09:00
<template>
<x-column :name="name" :column="column" :is-stacked="isStacked">
2019-02-18 11:13:56 +09:00
<template #header><fa icon="at"/>{{ name }}</template>
2018-09-16 23:15:02 +09:00
2019-05-21 08:10:37 +09:00
<x-notes ref="timeline" :pagination="pagination" @inited="() => $emit('loaded')"/>
2018-09-16 23:15:02 +09:00
</x-column>
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
2018-09-16 23:15:02 +09:00
import XColumn from './deck.column.vue';
2019-05-21 08:10:37 +09:00
import XNotes from './deck.notes.vue';
2018-09-16 23:15:02 +09:00
export default Vue.extend({
i18n: i18n(),
2019-05-21 08:10:37 +09:00
2018-09-16 23:15:02 +09:00
components: {
XColumn,
2019-05-21 08:10:37 +09:00
XNotes
2018-09-16 23:15:02 +09:00
},
props: {
column: {
type: Object,
required: true
},
isStacked: {
type: Boolean,
required: true
}
},
2019-05-21 08:10:37 +09:00
data() {
return {
connection: null,
pagination: {
endpoint: 'notes/mentions',
limit: 10,
params: init => ({
untilDate: init ? undefined : (this.date ? this.date.getTime() : undefined),
includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
})
}
};
},
2018-09-16 23:15:02 +09:00
computed: {
name(): string {
if (this.column.name) return this.column.name;
return this.$t('@deck.mentions');
2018-09-16 23:15:02 +09:00
}
},
2019-05-21 08:10:37 +09:00
mounted() {
this.connection = this.$root.stream.useSharedConnection('main');
this.connection.on('mention', this.onNote);
},
beforeDestroy() {
this.connection.dispose();
},
methods: {
2019-05-21 08:10:37 +09:00
onNote(note) {
(this.$refs.timeline as any).prepend(note);
},
focus() {
2019-05-21 08:10:37 +09:00
this.$refs.timeline.focus();
2018-10-21 16:18:02 +09:00
}
}
2018-09-16 23:15:02 +09:00
});
</script>