2018-02-14 09:32:13 -06:00
|
|
|
<template>
|
2018-02-20 10:39:51 -06:00
|
|
|
<div class="profile">
|
2018-02-17 21:35:18 -06:00
|
|
|
<div class="friend-form" v-if="os.isSignedIn && os.i.id != user.id">
|
2018-02-14 09:32:13 -06:00
|
|
|
<mk-follow-button :user="user" size="big"/>
|
2018-04-14 11:04:40 -05:00
|
|
|
<p class="followed" v-if="user.isFollowed">%i18n:@follows-you%</p>
|
2018-04-26 02:10:01 -05:00
|
|
|
<p class="stalk" v-if="user.isFollowing">
|
|
|
|
<span v-if="user.isStalking">%i18n:@stalking% <a @click="unstalk">%fa:meh% %i18n:@unstalk%</a></span>
|
|
|
|
<span v-if="!user.isStalking"><a @click="stalk">%fa:user-secret% %i18n:@stalk%</a></span>
|
2018-04-18 22:43:25 -05:00
|
|
|
</p>
|
2018-02-14 09:32:13 -06:00
|
|
|
</div>
|
2018-04-26 02:10:01 -05:00
|
|
|
<div class="action-form">
|
|
|
|
<button class="mute ui" @click="user.isMuted ? unmute() : mute()">
|
|
|
|
<span v-if="user.isMuted">%fa:eye% %i18n:@unmute%</span>
|
|
|
|
<span v-if="!user.isMuted">%fa:eye-slash% %i18n:@mute%</span>
|
|
|
|
</button>
|
|
|
|
<button class="mute ui" @click="list">%fa:list% リストに追加</button>
|
|
|
|
</div>
|
2018-02-14 09:32:13 -06:00
|
|
|
<div class="description" v-if="user.description">{{ user.description }}</div>
|
2018-04-07 13:58:11 -05:00
|
|
|
<div class="birthday" v-if="user.host === null && user.profile.birthday">
|
|
|
|
<p>%fa:birthday-cake%{{ user.profile.birthday.replace('-', '年').replace('-', '月') + '日' }} ({{ age }}歳)</p>
|
2018-02-14 09:32:13 -06:00
|
|
|
</div>
|
2018-04-07 13:58:11 -05:00
|
|
|
<div class="twitter" v-if="user.host === null && user.twitter">
|
|
|
|
<p>%fa:B twitter%<a :href="`https://twitter.com/${user.twitter.screenName}`" target="_blank">@{{ user.twitter.screenName }}</a></p>
|
2018-02-14 09:32:13 -06:00
|
|
|
</div>
|
|
|
|
<div class="status">
|
2018-04-07 12:30:37 -05:00
|
|
|
<p class="notes-count">%fa:angle-right%<a>{{ user.notesCount }}</a><b>投稿</b></p>
|
2018-03-29 00:48:47 -05:00
|
|
|
<p class="following">%fa:angle-right%<a @click="showFollowing">{{ user.followingCount }}</a>人を<b>フォロー</b></p>
|
|
|
|
<p class="followers">%fa:angle-right%<a @click="showFollowers">{{ user.followersCount }}</a>人の<b>フォロワー</b></p>
|
2018-02-14 09:32:13 -06:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-02-22 08:05:05 -06:00
|
|
|
import * as age from 's-age';
|
2018-02-19 08:37:09 -06:00
|
|
|
import MkFollowingWindow from '../../components/following-window.vue';
|
|
|
|
import MkFollowersWindow from '../../components/followers-window.vue';
|
2018-04-26 02:10:01 -05:00
|
|
|
import MkUserListsWindow from '../../components/user-lists-window.vue';
|
2018-02-14 09:32:13 -06:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
props: ['user'],
|
|
|
|
computed: {
|
|
|
|
age(): number {
|
2018-04-07 13:58:11 -05:00
|
|
|
return age(this.user.profile.birthday);
|
2018-02-14 09:32:13 -06:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
showFollowing() {
|
2018-02-22 08:53:07 -06:00
|
|
|
(this as any).os.new(MkFollowingWindow, {
|
|
|
|
user: this.user
|
|
|
|
});
|
2018-02-14 09:32:13 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
showFollowers() {
|
2018-02-22 08:53:07 -06:00
|
|
|
(this as any).os.new(MkFollowersWindow, {
|
|
|
|
user: this.user
|
|
|
|
});
|
2018-02-14 09:32:13 -06:00
|
|
|
},
|
|
|
|
|
2018-04-18 22:43:25 -05:00
|
|
|
stalk() {
|
|
|
|
(this as any).api('following/stalk', {
|
|
|
|
userId: this.user.id
|
|
|
|
}).then(() => {
|
|
|
|
this.user.isStalking = true;
|
|
|
|
}, () => {
|
|
|
|
alert('error');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
unstalk() {
|
|
|
|
(this as any).api('following/unstalk', {
|
|
|
|
userId: this.user.id
|
|
|
|
}).then(() => {
|
|
|
|
this.user.isStalking = false;
|
|
|
|
}, () => {
|
|
|
|
alert('error');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2018-02-14 09:32:13 -06:00
|
|
|
mute() {
|
2018-02-17 21:35:18 -06:00
|
|
|
(this as any).api('mute/create', {
|
2018-03-29 00:48:47 -05:00
|
|
|
userId: this.user.id
|
2018-02-14 09:32:13 -06:00
|
|
|
}).then(() => {
|
2018-03-29 00:48:47 -05:00
|
|
|
this.user.isMuted = true;
|
2018-02-19 08:37:09 -06:00
|
|
|
}, () => {
|
2018-02-14 09:32:13 -06:00
|
|
|
alert('error');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
unmute() {
|
2018-02-17 21:35:18 -06:00
|
|
|
(this as any).api('mute/delete', {
|
2018-03-29 00:48:47 -05:00
|
|
|
userId: this.user.id
|
2018-02-14 09:32:13 -06:00
|
|
|
}).then(() => {
|
2018-03-29 00:48:47 -05:00
|
|
|
this.user.isMuted = false;
|
2018-02-19 08:37:09 -06:00
|
|
|
}, () => {
|
2018-02-14 09:32:13 -06:00
|
|
|
alert('error');
|
|
|
|
});
|
2018-04-26 02:10:01 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
list() {
|
|
|
|
const w = (this as any).os.new(MkUserListsWindow);
|
|
|
|
w.$once('choosen', async list => {
|
|
|
|
w.close();
|
|
|
|
await (this as any).api('users/lists/push', {
|
|
|
|
listId: list.id,
|
|
|
|
userId: this.user.id
|
|
|
|
});
|
|
|
|
(this as any).apis.dialog({
|
|
|
|
title: 'Done!',
|
|
|
|
text: `${this.user.name}を${list.title}に追加しました。`
|
|
|
|
});
|
|
|
|
});
|
2018-02-14 09:32:13 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-02-20 10:39:51 -06:00
|
|
|
.profile
|
2018-02-14 09:32:13 -06:00
|
|
|
background #fff
|
2018-04-28 18:51:17 -05:00
|
|
|
border solid 1px rgba(#000, 0.075)
|
2018-02-14 09:32:13 -06:00
|
|
|
border-radius 6px
|
|
|
|
|
|
|
|
> *:first-child
|
|
|
|
border-top none !important
|
|
|
|
|
|
|
|
> .friend-form
|
|
|
|
padding 16px
|
2018-04-26 02:10:01 -05:00
|
|
|
text-align center
|
2018-02-14 09:32:13 -06:00
|
|
|
border-top solid 1px #eee
|
|
|
|
|
|
|
|
> .followed
|
|
|
|
margin 12px 0 0 0
|
|
|
|
padding 0
|
|
|
|
text-align center
|
|
|
|
line-height 24px
|
|
|
|
font-size 0.8em
|
|
|
|
color #71afc7
|
|
|
|
background #eefaff
|
|
|
|
border-radius 4px
|
|
|
|
|
2018-04-26 02:10:01 -05:00
|
|
|
> .stalk
|
|
|
|
margin 12px 0 0 0
|
|
|
|
|
|
|
|
> .action-form
|
|
|
|
padding 16px
|
|
|
|
text-align center
|
|
|
|
border-top solid 1px #eee
|
|
|
|
|
|
|
|
> *
|
|
|
|
width 100%
|
|
|
|
|
|
|
|
&:not(:last-child)
|
|
|
|
margin-bottom 12px
|
|
|
|
|
2018-02-14 09:32:13 -06:00
|
|
|
> .description
|
|
|
|
padding 16px
|
|
|
|
color #555
|
|
|
|
border-top solid 1px #eee
|
|
|
|
|
|
|
|
> .birthday
|
|
|
|
padding 16px
|
|
|
|
color #555
|
|
|
|
border-top solid 1px #eee
|
|
|
|
|
|
|
|
> p
|
|
|
|
margin 0
|
|
|
|
|
|
|
|
> i
|
|
|
|
margin-right 8px
|
|
|
|
|
|
|
|
> .twitter
|
|
|
|
padding 16px
|
|
|
|
color #555
|
|
|
|
border-top solid 1px #eee
|
|
|
|
|
|
|
|
> p
|
|
|
|
margin 0
|
|
|
|
|
|
|
|
> i
|
|
|
|
margin-right 8px
|
|
|
|
|
|
|
|
> .status
|
|
|
|
padding 16px
|
|
|
|
color #555
|
|
|
|
border-top solid 1px #eee
|
|
|
|
|
|
|
|
> p
|
|
|
|
margin 8px 0
|
|
|
|
|
|
|
|
> i
|
|
|
|
margin-left 8px
|
|
|
|
margin-right 8px
|
|
|
|
|
|
|
|
</style>
|