summaryrefslogtreecommitdiff
path: root/src/client/pages/user/index.timeline.vue
blob: 9057d903961a3dec2a00355b952d21752131dd76 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<template>
<div class="yrzkoczt" v-sticky-container>
	<MkTab v-model="with_" class="tab">
		<option :value="null">{{ $ts.notes }}</option>
		<option value="replies">{{ $ts.notesAndReplies }}</option>
		<option value="files">{{ $ts.withFiles }}</option>
	</MkTab>
	<XNotes ref="timeline" :no-gap="true" :pagination="pagination" @before="$emit('before')" @after="e => $emit('after', e)"/>
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import XNotes from '@client/components/notes.vue';
import MkTab from '@client/components/tab.vue';
import * as os from '@client/os';

export default defineComponent({
	components: {
		XNotes,
		MkTab,
	},

	props: {
		user: {
			type: Object,
			required: true,
		},
	},

	watch: {
		user() {
			this.$refs.timeline.reload();
		},

		with_() {
			this.$refs.timeline.reload();
		},
	},

	data() {
		return {
			date: null,
			with_: null,
			pagination: {
				endpoint: 'users/notes',
				limit: 10,
				params: init => ({
					userId: this.user.id,
					includeReplies: this.with_ === 'replies',
					withFiles: this.with_ === 'files',
					untilDate: init ? undefined : (this.date ? this.date.getTime() : undefined),
				})
			}
		};
	},
});
</script>

<style lang="scss" scoped>
.yrzkoczt {
	> .tab {
		margin: calc(var(--margin) / 2) 0;
		padding: calc(var(--margin) / 2) 0;
		background: var(--bg);
	}
}

._fitSide_ .yrzkoczt {
	> .tab {
		padding-left: var(--margin);
		padding-right: var(--margin);
	}
}
</style>