summaryrefslogtreecommitdiff
path: root/src/client/app/mobile/views/pages/user/home.notes.vue
blob: 6483402a569a4ddd6354abc3fa53f148339dc781 (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
<template>
<div class="root notes">
	<p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:@loading%<mk-ellipsis/></p>
	<div v-if="!fetching && notes.length > 0">
		<mk-note-card v-for="note in notes" :key="note.id" :note="note"/>
	</div>
	<p class="empty" v-if="!fetching && notes.length == 0">%i18n:@no-notes%</p>
</div>
</template>

<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
	props: ['user'],
	data() {
		return {
			fetching: true,
			notes: []
		};
	},
	mounted() {
		(this as any).api('users/notes', {
			userId: this.user.id
		}).then(notes => {
			this.notes = notes;
			this.fetching = false;
		});
	}
});
</script>

<style lang="stylus" scoped>
.root.notes

	> div
		overflow-x scroll
		-webkit-overflow-scrolling touch
		white-space nowrap
		padding 8px

		> *
			vertical-align top

			&:not(:last-child)
				margin-right 8px

	> .fetching
	> .empty
		margin 0
		padding 16px
		text-align center
		color #aaa

		> i
			margin-right 4px

</style>