misskey/src/client/app/common/views/components/welcome-timeline.vue

119 lines
2.2 KiB
Vue
Raw Normal View History

2018-03-16 19:33:36 +01:00
<template>
<div class="mk-welcome-timeline">
<div v-for="post in posts">
2018-03-27 09:51:12 +02:00
<router-link class="avatar-anchor" :to="`/@${getAcct(post.user)}`" v-user-preview="post.user.id">
2018-03-29 07:48:47 +02:00
<img class="avatar" :src="`${post.user.avatarUrl}?thumbnail&size=96`" alt="avatar"/>
2018-03-16 19:33:36 +01:00
</router-link>
<div class="body">
<header>
2018-03-27 09:51:12 +02:00
<router-link class="name" :to="`/@${getAcct(post.user)}`" v-user-preview="post.user.id">{{ post.user.name }}</router-link>
<span class="username">@{{ getAcct(post.user) }}</span>
2018-03-16 19:33:36 +01:00
<div class="info">
2018-03-27 09:51:12 +02:00
<router-link class="created-at" :to="`/@${getAcct(post.user)}/${post.id}`">
2018-03-29 07:48:47 +02:00
<mk-time :time="post.createdAt"/>
2018-03-16 19:33:36 +01:00
</router-link>
</div>
</header>
<div class="text">
2018-03-31 12:53:30 +02:00
<mk-post-html :html="post.textHtml"/>
2018-03-16 19:33:36 +01:00
</div>
</div>
</div>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
2018-03-27 09:51:12 +02:00
import getAcct from '../../../../../common/user/get-acct';
2018-03-16 19:33:36 +01:00
export default Vue.extend({
data() {
return {
fetching: true,
posts: []
};
},
mounted() {
this.fetch();
},
methods: {
2018-03-27 09:51:12 +02:00
getAcct,
2018-03-16 19:33:36 +01:00
fetch(cb?) {
this.fetching = true;
(this as any).api('posts', {
reply: false,
repost: false,
media: false,
poll: false,
bot: false
}).then(posts => {
this.posts = posts;
this.fetching = false;
});
}
}
});
</script>
<style lang="stylus" scoped>
.mk-welcome-timeline
background #fff
> div
padding 16px
overflow-wrap break-word
font-size .9em
color #4C4C4C
border-bottom 1px solid rgba(0, 0, 0, 0.05)
&:after
content ""
display block
clear both
> .avatar-anchor
display block
float left
position -webkit-sticky
position sticky
top 16px
> img
display block
2018-03-17 09:47:46 +01:00
width 42px
height 42px
2018-03-16 19:33:36 +01:00
border-radius 6px
> .body
float right
2018-03-17 09:47:46 +01:00
width calc(100% - 42px)
padding-left 12px
2018-03-16 19:33:36 +01:00
> header
display flex
align-items center
margin-bottom 4px
white-space nowrap
> .name
display block
margin 0 .5em 0 0
padding 0
overflow hidden
font-weight bold
text-overflow ellipsis
2018-03-17 15:01:17 +01:00
color #627079
2018-03-16 19:33:36 +01:00
> .username
margin 0 .5em 0 0
color #ccc
> .info
margin-left auto
font-size 0.9em
> .created-at
color #c0c0c0
</style>