2018-02-15 10:33:34 +01:00
|
|
|
<template>
|
2018-04-07 19:30:37 +02:00
|
|
|
<div class="root notes">
|
2018-11-13 14:45:28 +01:00
|
|
|
<p class="fetching" v-if="fetching"><fa icon="spinner" pulse fixed-width/>{{ $t('@.loading') }}<mk-ellipsis/></p>
|
2018-04-07 19:30:37 +02:00
|
|
|
<div v-if="!fetching && notes.length > 0">
|
|
|
|
<mk-note-card v-for="note in notes" :key="note.id" :note="note"/>
|
2018-02-15 10:33:34 +01:00
|
|
|
</div>
|
2018-11-08 19:44:35 +01:00
|
|
|
<p class="empty" v-if="!fetching && notes.length == 0">{{ $t('no-notes') }}</p>
|
2018-02-15 10:33:34 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-08 19:44:35 +01:00
|
|
|
import i18n from '../../../../i18n';
|
2018-02-15 10:33:34 +01:00
|
|
|
export default Vue.extend({
|
2018-11-08 19:44:35 +01:00
|
|
|
i18n: i18n('mobile/views/pages/user/home.notes.vue'),
|
2018-02-15 10:33:34 +01:00
|
|
|
props: ['user'],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
fetching: true,
|
2018-04-07 19:30:37 +02:00
|
|
|
notes: []
|
2018-02-15 10:33:34 +01:00
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2018-11-09 00:13:34 +01:00
|
|
|
this.$root.api('users/notes', {
|
2018-11-12 17:17:59 +01:00
|
|
|
userId: this.user.id,
|
|
|
|
untilDate: new Date().getTime() + 1000 * 86400 * 365
|
2018-04-07 19:30:37 +02:00
|
|
|
}).then(notes => {
|
|
|
|
this.notes = notes;
|
2018-02-19 15:37:09 +01:00
|
|
|
this.fetching = false;
|
2018-02-15 10:33:34 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-04-07 19:30:37 +02:00
|
|
|
.root.notes
|
2018-02-15 10:33:34 +01:00
|
|
|
|
|
|
|
> div
|
|
|
|
overflow-x scroll
|
|
|
|
-webkit-overflow-scrolling touch
|
|
|
|
white-space nowrap
|
|
|
|
padding 8px
|
|
|
|
|
|
|
|
> *
|
|
|
|
vertical-align top
|
|
|
|
|
|
|
|
&:not(:last-child)
|
|
|
|
margin-right 8px
|
|
|
|
|
2018-02-22 09:32:58 +01:00
|
|
|
> .fetching
|
2018-02-15 10:33:34 +01:00
|
|
|
> .empty
|
|
|
|
margin 0
|
|
|
|
padding 16px
|
|
|
|
text-align center
|
2019-02-06 09:51:33 +01:00
|
|
|
color var(--text)
|
2018-02-15 10:33:34 +01:00
|
|
|
|
|
|
|
> i
|
|
|
|
margin-right 4px
|
|
|
|
|
|
|
|
</style>
|