summaryrefslogtreecommitdiff
path: root/src/client/app/desktop/views/deck/deck.featured-column.vue
blob: bd2e99ba48853fefd7348ad6367e5db58f1f7e27 (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
57
58
59
<template>
<x-column>
	<span slot="header">
		<fa :icon="faNewspaper"/>{{ $t('@.featured-notes') }}
	</span>

	<div>
		<x-notes ref="timeline" :more="null"/>
	</div>
</x-column>
</template>

<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
import XColumn from './deck.column.vue';
import XNotes from './deck.notes.vue';
import { faNewspaper } from '@fortawesome/free-solid-svg-icons';

export default Vue.extend({
	i18n: i18n(),

	components: {
		XColumn,
		XNotes,
	},

	data() {
		return {
			fetching: true,
			faNewspaper
		};
	},

	mounted() {
		this.fetch();
	},

	methods: {
		fetch() {
			this.fetching = true;

			(this.$refs.timeline as any).init(() => new Promise((res, rej) => {
				this.$root.api('notes/featured', {
					limit: 15,
				}).then(notes => {
					res(notes);
					this.fetching = false;
					this.$emit('loaded');
				}, rej);
			}));
		},

		focus() {
			this.$refs.timeline.focus();
		}
	}
});
</script>