2018-03-16 13:33:36 -05:00
|
|
|
<template>
|
|
|
|
<div class="mk-welcome-timeline">
|
2018-09-07 14:54:11 -05:00
|
|
|
<transition-group name="ldzpakcixzickvggyixyrhqwjaefknon" tag="div">
|
|
|
|
<div v-for="note in notes" :key="note.id">
|
|
|
|
<mk-avatar class="avatar" :user="note.user" target="_blank"/>
|
|
|
|
<div class="body">
|
|
|
|
<header>
|
2018-12-05 19:02:04 -06:00
|
|
|
<router-link class="name" :to="note.user | userPage" v-user-preview="note.user.id">
|
|
|
|
<misskey-flavored-markdown :text="note.user.name || note.user.username" :shouldBreak="false" :plainText="true" :custom-emojis="note.user.emojis"/>
|
|
|
|
</router-link>
|
2018-09-07 14:54:11 -05:00
|
|
|
<span class="username">@{{ note.user | acct }}</span>
|
|
|
|
<div class="info">
|
|
|
|
<router-link class="created-at" :to="note | notePage">
|
|
|
|
<mk-time :time="note.createdAt"/>
|
|
|
|
</router-link>
|
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
<div class="text">
|
2018-11-20 14:11:00 -06:00
|
|
|
<misskey-flavored-markdown v-if="note.text" :text="note.text" :author="note.user" :custom-emojis="note.emojis"/>
|
2018-03-16 13:33:36 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-09-07 14:54:11 -05:00
|
|
|
</transition-group>
|
2018-03-16 13:33:36 -05:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-06-22 04:32:21 -05:00
|
|
|
props: {
|
|
|
|
max: {
|
|
|
|
type: Number,
|
|
|
|
required: false,
|
|
|
|
default: undefined
|
|
|
|
}
|
|
|
|
},
|
2018-09-03 22:59:34 -05:00
|
|
|
|
2018-03-16 13:33:36 -05:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
fetching: true,
|
2018-09-03 22:59:34 -05:00
|
|
|
notes: [],
|
2018-10-06 21:06:17 -05:00
|
|
|
connection: null
|
2018-03-16 13:33:36 -05:00
|
|
|
};
|
|
|
|
},
|
2018-09-03 22:59:34 -05:00
|
|
|
|
2018-03-16 13:33:36 -05:00
|
|
|
mounted() {
|
|
|
|
this.fetch();
|
2018-09-03 22:59:34 -05:00
|
|
|
|
2018-11-08 17:13:34 -06:00
|
|
|
this.connection = this.$root.stream.useSharedConnection('localTimeline');
|
2018-09-03 22:59:34 -05:00
|
|
|
|
|
|
|
this.connection.on('note', this.onNote);
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeDestroy() {
|
2018-10-06 21:06:17 -05:00
|
|
|
this.connection.dispose();
|
2018-03-16 13:33:36 -05:00
|
|
|
},
|
2018-09-03 22:59:34 -05:00
|
|
|
|
2018-03-16 13:33:36 -05:00
|
|
|
methods: {
|
|
|
|
fetch(cb?) {
|
|
|
|
this.fetching = true;
|
2018-11-08 17:13:34 -06:00
|
|
|
this.$root.api('notes', {
|
2018-06-22 04:32:21 -05:00
|
|
|
limit: this.max,
|
2018-05-23 01:25:15 -05:00
|
|
|
local: true,
|
2018-03-16 13:33:36 -05:00
|
|
|
reply: false,
|
2018-04-07 12:30:37 -05:00
|
|
|
renote: false,
|
2018-09-05 05:32:46 -05:00
|
|
|
file: false,
|
2018-09-03 22:59:34 -05:00
|
|
|
poll: false
|
2018-04-07 12:30:37 -05:00
|
|
|
}).then(notes => {
|
|
|
|
this.notes = notes;
|
2018-03-16 13:33:36 -05:00
|
|
|
this.fetching = false;
|
|
|
|
});
|
2018-09-03 22:59:34 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
onNote(note) {
|
|
|
|
if (note.replyId != null) return;
|
|
|
|
if (note.renoteId != null) return;
|
|
|
|
if (note.poll != null) return;
|
|
|
|
|
|
|
|
this.notes.unshift(note);
|
|
|
|
},
|
2018-03-16 13:33:36 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-09-07 14:54:11 -05:00
|
|
|
.ldzpakcixzickvggyixyrhqwjaefknon-enter
|
|
|
|
.ldzpakcixzickvggyixyrhqwjaefknon-leave-to
|
|
|
|
opacity 0
|
|
|
|
transform translateY(-30px)
|
|
|
|
|
2018-09-27 20:14:58 -05:00
|
|
|
.mk-welcome-timeline
|
2018-09-26 06:28:13 -05:00
|
|
|
background var(--face)
|
2018-03-16 13:33:36 -05:00
|
|
|
|
|
|
|
> div
|
2018-09-07 14:54:11 -05:00
|
|
|
> *
|
|
|
|
transition transform .3s ease, opacity .3s ease
|
|
|
|
|
|
|
|
> div
|
|
|
|
padding 16px
|
|
|
|
overflow-wrap break-word
|
|
|
|
font-size .9em
|
2018-09-27 20:14:58 -05:00
|
|
|
color var(--noteText)
|
|
|
|
border-bottom 1px solid var(--faceDivider)
|
2018-09-07 14:54:11 -05:00
|
|
|
|
|
|
|
&:after
|
|
|
|
content ""
|
|
|
|
display block
|
|
|
|
clear both
|
|
|
|
|
|
|
|
> .avatar
|
|
|
|
display block
|
|
|
|
float left
|
|
|
|
position -webkit-sticky
|
|
|
|
position sticky
|
|
|
|
top 16px
|
|
|
|
width 42px
|
|
|
|
height 42px
|
|
|
|
border-radius 6px
|
|
|
|
|
|
|
|
> .body
|
|
|
|
float right
|
|
|
|
width calc(100% - 42px)
|
|
|
|
padding-left 12px
|
|
|
|
|
|
|
|
> 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-09-26 21:55:17 -05:00
|
|
|
color var(--noteHeaderName)
|
2018-09-07 14:54:11 -05:00
|
|
|
|
|
|
|
> .username
|
|
|
|
margin 0 .5em 0 0
|
2018-09-27 20:14:58 -05:00
|
|
|
color var(--noteHeaderAcct)
|
2018-09-07 14:54:11 -05:00
|
|
|
|
|
|
|
> .info
|
|
|
|
margin-left auto
|
|
|
|
font-size 0.9em
|
|
|
|
|
|
|
|
> .created-at
|
2018-09-27 20:14:58 -05:00
|
|
|
color var(--noteHeaderInfo)
|
2018-09-07 14:54:11 -05:00
|
|
|
|
|
|
|
> .text
|
|
|
|
text-align left
|
2018-06-14 23:08:56 -05:00
|
|
|
|
2018-03-16 13:33:36 -05:00
|
|
|
</style>
|