wip
This commit is contained in:
parent
55273807d2
commit
69a8e4f4b2
40 changed files with 356 additions and 303 deletions
|
|
@ -24,8 +24,8 @@ export default Vue.extend({
|
|||
(this as any).api('users/show', {
|
||||
username: this.username
|
||||
}).then(user => {
|
||||
this.fetching = false;
|
||||
this.user = user;
|
||||
this.fetching = false;
|
||||
|
||||
document.title = 'メッセージ: ' + this.user.name;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ export default Vue.extend({
|
|||
(this as any).api('posts/show', {
|
||||
post_id: this.postId
|
||||
}).then(post => {
|
||||
this.fetching = false;
|
||||
this.post = post;
|
||||
this.fetching = false;
|
||||
|
||||
Progress.done();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ export default Vue.extend({
|
|||
window.addEventListener('scroll', this.onScroll);
|
||||
|
||||
(this as any).api('posts/search', parse(this.query)).then(posts => {
|
||||
this.fetching = false;
|
||||
this.posts = posts;
|
||||
this.fetching = false;
|
||||
});
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ export default Vue.extend({
|
|||
iknow: true,
|
||||
limit: 16
|
||||
}).then(x => {
|
||||
this.fetching = false;
|
||||
this.users = x.users;
|
||||
this.fetching = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,16 +2,18 @@
|
|||
<div class="mk-user-friends">
|
||||
<p class="title">%fa:users%%i18n:desktop.tags.mk-user.frequently-replied-users.title%</p>
|
||||
<p class="initializing" v-if="fetching">%fa:spinner .pulse .fw%%i18n:desktop.tags.mk-user.frequently-replied-users.loading%<mk-ellipsis/></p>
|
||||
<div class="user" v-if="!fetching && users.length != 0" each={ _user in users }>
|
||||
<a class="avatar-anchor" href={ '/' + _user.username }>
|
||||
<img class="avatar" src={ _user.avatar_url + '?thumbnail&size=42' } alt="" v-user-preview={ _user.id }/>
|
||||
</a>
|
||||
<div class="body">
|
||||
<a class="name" href={ '/' + _user.username } v-user-preview={ _user.id }>{ _user.name }</a>
|
||||
<p class="username">@{ _user.username }</p>
|
||||
<template v-if="!fetching && users.length != 0">
|
||||
<div class="user" v-for="friend in users">
|
||||
<router-link class="avatar-anchor" to="`/${friend.username}`">
|
||||
<img class="avatar" :src="`${friend.avatar_url}?thumbnail&size=42`" alt="" v-user-preview="friend.id"/>
|
||||
</router-link>
|
||||
<div class="body">
|
||||
<router-link class="name" to="`/${friend.username}`" v-user-preview="friend.id">{{ friend.name }}</router-link>
|
||||
<p class="username">@{{ friend.username }}</p>
|
||||
</div>
|
||||
<mk-follow-button :user="friend"/>
|
||||
</div>
|
||||
<mk-follow-button user={ _user }/>
|
||||
</div>
|
||||
</template>
|
||||
<p class="empty" v-if="!fetching && users.length == 0">%i18n:desktop.tags.mk-user.frequently-replied-users.no-users%</p>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -31,8 +33,8 @@ export default Vue.extend({
|
|||
user_id: this.user.id,
|
||||
limit: 4
|
||||
}).then(docs => {
|
||||
this.fetching = false;
|
||||
this.users = docs.map(doc => doc.user);
|
||||
this.fetching = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
</main>
|
||||
<div>
|
||||
<div ref="right">
|
||||
<mk-calendar-widget @warp="warp" :start="new Date(user.created_at)"/>
|
||||
<mk-activity-widget :user="user"/>
|
||||
<mk-calendar @chosen="warp" :start="new Date(user.created_at)"/>
|
||||
<mk-activity :user="user"/>
|
||||
<mk-user-friends :user="user"/>
|
||||
<div class="nav"><mk-nav/></div>
|
||||
</div>
|
||||
|
|
@ -25,7 +25,20 @@
|
|||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import MkUserTimeline from './user-timeline.vue';
|
||||
import MkUserProfile from './user-profile.vue';
|
||||
import MkUserPhotos from './user-photos.vue';
|
||||
import MkUserFollowersYouKnow from './user-followers-you-know.vue';
|
||||
import MkUserFriends from './user-friends.vue';
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
'mk-user-timeline': MkUserTimeline,
|
||||
'mk-user-profile': MkUserProfile,
|
||||
'mk-user-photos': MkUserPhotos,
|
||||
'mk-user-followers-you-know': MkUserFollowersYouKnow,
|
||||
'mk-user-friends': MkUserFriends
|
||||
},
|
||||
props: ['user'],
|
||||
methods: {
|
||||
warp(date) {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
<p class="title">%fa:camera%%i18n:desktop.tags.mk-user.photos.title%</p>
|
||||
<p class="initializing" v-if="fetching">%fa:spinner .pulse .fw%%i18n:desktop.tags.mk-user.photos.loading%<mk-ellipsis/></p>
|
||||
<div class="stream" v-if="!fetching && images.length > 0">
|
||||
<div v-for="image in images" :key="image.id"
|
||||
class="img"
|
||||
<div v-for="image in images" class="img"
|
||||
:style="`background-image: url(${image.url}?thumbnail&size=256)`"
|
||||
></div>
|
||||
</div>
|
||||
|
|
@ -28,12 +27,12 @@ export default Vue.extend({
|
|||
with_media: true,
|
||||
limit: 9
|
||||
}).then(posts => {
|
||||
this.fetching = false;
|
||||
posts.forEach(post => {
|
||||
post.media.forEach(media => {
|
||||
if (this.images.length < 9) this.images.push(media);
|
||||
});
|
||||
});
|
||||
this.fetching = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<p>%fa:B twitter%<a :href="`https://twitter.com/${user.twitter.screen_name}`" target="_blank">@{{ user.twitter.screen_name }}</a></p>
|
||||
</div>
|
||||
<div class="status">
|
||||
<p class="posts-count">%fa:angle-right%<a>{{ user.posts_count }}</a><b>投稿</b></p>
|
||||
<p class="posts-count">%fa:angle-right%<a>{{ user.posts_count }}</a><b>投稿</b></p>
|
||||
<p class="following">%fa:angle-right%<a @click="showFollowing">{{ user.following_count }}</a>人を<b>フォロー</b></p>
|
||||
<p class="followers">%fa:angle-right%<a @click="showFollowers">{{ user.followers_count }}</a>人の<b>フォロワー</b></p>
|
||||
</div>
|
||||
|
|
@ -23,7 +23,9 @@
|
|||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
const age = require('s-age');
|
||||
import age from 's-age';
|
||||
import MkFollowingWindow from '../../components/following-window.vue';
|
||||
import MkFollowersWindow from '../../components/followers-window.vue';
|
||||
|
||||
export default Vue.extend({
|
||||
props: ['user'],
|
||||
|
|
@ -34,8 +36,7 @@ export default Vue.extend({
|
|||
},
|
||||
methods: {
|
||||
showFollowing() {
|
||||
document.body.appendChild(new MkUserFollowingWindow({
|
||||
|
||||
document.body.appendChild(new MkFollowingWindow({
|
||||
propsData: {
|
||||
user: this.user
|
||||
}
|
||||
|
|
@ -43,8 +44,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
showFollowers() {
|
||||
document.body.appendChild(new MkUserFollowersWindow({
|
||||
|
||||
document.body.appendChild(new MkFollowersWindow({
|
||||
propsData: {
|
||||
user: this.user
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ export default Vue.extend({
|
|||
user_id: this.user.id
|
||||
}).then(() => {
|
||||
this.user.is_muted = true;
|
||||
}, e => {
|
||||
}, () => {
|
||||
alert('error');
|
||||
});
|
||||
},
|
||||
|
|
@ -66,7 +66,7 @@ export default Vue.extend({
|
|||
user_id: this.user.id
|
||||
}).then(() => {
|
||||
this.user.is_muted = false;
|
||||
}, e => {
|
||||
}, () => {
|
||||
alert('error');
|
||||
});
|
||||
}
|
||||
|
|
|
|||
133
src/web/app/desktop/views/pages/user/user-timeline.vue
Normal file
133
src/web/app/desktop/views/pages/user/user-timeline.vue
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
<template>
|
||||
<div class="mk-user-timeline">
|
||||
<header>
|
||||
<span :data-is-active="mode == 'default'" @click="mode = 'default'">投稿</span>
|
||||
<span :data-is-active="mode == 'with-replies'" @click="mode = 'with-replies'">投稿と返信</span>
|
||||
</header>
|
||||
<div class="loading" v-if="fetching">
|
||||
<mk-ellipsis-icon/>
|
||||
</div>
|
||||
<p class="empty" v-if="empty">%fa:R comments%このユーザーはまだ何も投稿していないようです。</p>
|
||||
<mk-posts ref="timeline" :posts="posts">
|
||||
<div slot="footer">
|
||||
<template v-if="!moreFetching">%fa:moon%</template>
|
||||
<template v-if="moreFetching">%fa:spinner .pulse .fw%</template>
|
||||
</div>
|
||||
</mk-posts>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
export default Vue.extend({
|
||||
props: ['user'],
|
||||
data() {
|
||||
return {
|
||||
fetching: true,
|
||||
moreFetching: false,
|
||||
mode: 'default',
|
||||
unreadCount: 0,
|
||||
posts: [],
|
||||
date: null
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
mode() {
|
||||
this.fetch();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
empty(): boolean {
|
||||
return this.posts.length == 0;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
document.addEventListener('keydown', this.onDocumentKeydown);
|
||||
window.addEventListener('scroll', this.onScroll);
|
||||
|
||||
this.fetch(() => this.$emit('loaded'));
|
||||
},
|
||||
beforeDestroy() {
|
||||
document.removeEventListener('keydown', this.onDocumentKeydown);
|
||||
window.removeEventListener('scroll', this.onScroll);
|
||||
},
|
||||
methods: {
|
||||
onDocumentKeydown(e) {
|
||||
if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA') {
|
||||
if (e.which == 84) { // [t]
|
||||
(this.$refs.timeline as any).focus();
|
||||
}
|
||||
}
|
||||
},
|
||||
fetch(cb?) {
|
||||
(this as any).api('users/posts', {
|
||||
user_id: this.user.id,
|
||||
until_date: this.date ? this.date.getTime() : undefined,
|
||||
with_replies: this.mode == 'with-replies'
|
||||
}).then(posts => {
|
||||
this.posts = posts;
|
||||
this.fetching = false;
|
||||
if (cb) cb();
|
||||
});
|
||||
},
|
||||
more() {
|
||||
if (this.moreFetching || this.fetching || this.posts.length == 0) return;
|
||||
this.moreFetching = true;
|
||||
(this as any).api('users/posts', {
|
||||
user_id: this.user.id,
|
||||
with_replies: this.mode == 'with-replies',
|
||||
until_id: this.posts[this.posts.length - 1].id
|
||||
}).then(posts => {
|
||||
this.moreFetching = false;
|
||||
this.posts = this.posts.concat(posts);
|
||||
});
|
||||
},
|
||||
onScroll() {
|
||||
const current = window.scrollY + window.innerHeight;
|
||||
if (current > document.body.offsetHeight - 16/*遊び*/) {
|
||||
this.more();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.mk-user-timeline
|
||||
background #fff
|
||||
|
||||
> header
|
||||
padding 8px 16px
|
||||
border-bottom solid 1px #eee
|
||||
|
||||
> span
|
||||
margin-right 16px
|
||||
line-height 27px
|
||||
font-size 18px
|
||||
color #555
|
||||
|
||||
&:not([data-is-active])
|
||||
color $theme-color
|
||||
cursor pointer
|
||||
|
||||
&:hover
|
||||
text-decoration underline
|
||||
|
||||
> .loading
|
||||
padding 64px 0
|
||||
|
||||
> .empty
|
||||
display block
|
||||
margin 0 auto
|
||||
padding 32px
|
||||
max-width 400px
|
||||
text-align center
|
||||
color #999
|
||||
|
||||
> [data-fa]
|
||||
display block
|
||||
margin-bottom 16px
|
||||
font-size 3em
|
||||
color #ccc
|
||||
|
||||
</style>
|
||||
|
|
@ -35,8 +35,8 @@ export default Vue.extend({
|
|||
(this as any).api('users/show', {
|
||||
username: this.$route.params.user
|
||||
}).then(user => {
|
||||
this.fetching = false;
|
||||
this.user = user;
|
||||
this.fetching = false;
|
||||
Progress.done();
|
||||
document.title = user.name + ' | Misskey';
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue