2018-02-15 03:33:34 -06:00
|
|
|
<template>
|
2018-02-22 02:32:58 -06:00
|
|
|
<div class="root posts">
|
|
|
|
<p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:mobile.tags.mk-user-overview-posts.loading%<mk-ellipsis/></p>
|
|
|
|
<div v-if="!fetching && posts.length > 0">
|
2018-02-15 03:33:34 -06:00
|
|
|
<mk-post-card v-for="post in posts" :key="post.id" :post="post"/>
|
|
|
|
</div>
|
2018-02-22 02:32:58 -06:00
|
|
|
<p class="empty" v-if="!fetching && posts.length == 0">%i18n:mobile.tags.mk-user-overview-posts.no-posts%</p>
|
2018-02-15 03:33:34 -06:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
export default Vue.extend({
|
|
|
|
props: ['user'],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
fetching: true,
|
|
|
|
posts: []
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2018-02-17 21:35:18 -06:00
|
|
|
(this as any).api('users/posts', {
|
2018-03-29 00:48:47 -05:00
|
|
|
userId: this.user.id
|
2018-02-15 03:33:34 -06:00
|
|
|
}).then(posts => {
|
|
|
|
this.posts = posts;
|
2018-02-19 08:37:09 -06:00
|
|
|
this.fetching = false;
|
2018-02-15 03:33:34 -06:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-02-22 02:32:58 -06:00
|
|
|
.root.posts
|
2018-02-15 03:33:34 -06: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 02:32:58 -06:00
|
|
|
> .fetching
|
2018-02-15 03:33:34 -06:00
|
|
|
> .empty
|
|
|
|
margin 0
|
|
|
|
padding 16px
|
|
|
|
text-align center
|
|
|
|
color #aaa
|
|
|
|
|
|
|
|
> i
|
|
|
|
margin-right 4px
|
|
|
|
|
|
|
|
</style>
|