2018-02-15 03:33:34 -06:00
|
|
|
<template>
|
2018-02-22 02:32:58 -06:00
|
|
|
<mk-ui>
|
2018-02-22 02:06:19 -06:00
|
|
|
<span slot="header" v-if="!fetching">%fa:user% {{ user.name }}</span>
|
2018-02-22 02:32:58 -06:00
|
|
|
<main v-if="!fetching">
|
2018-02-15 03:33:34 -06:00
|
|
|
<header>
|
|
|
|
<div class="banner" :style="user.banner_url ? `background-image: url(${user.banner_url}?thumbnail&size=1024)` : ''"></div>
|
|
|
|
<div class="body">
|
|
|
|
<div class="top">
|
|
|
|
<a class="avatar">
|
|
|
|
<img :src="`${user.avatar_url}?thumbnail&size=200`" alt="avatar"/>
|
|
|
|
</a>
|
2018-02-17 21:35:18 -06:00
|
|
|
<mk-follow-button v-if="os.isSignedIn && os.i.id != user.id" :user="user"/>
|
2018-02-15 03:33:34 -06:00
|
|
|
</div>
|
|
|
|
<div class="title">
|
|
|
|
<h1>{{ user.name }}</h1>
|
2018-03-27 02:51:12 -05:00
|
|
|
<span class="username">@{{ acct }}</span>
|
2018-02-15 03:33:34 -06:00
|
|
|
<span class="followed" v-if="user.is_followed">%i18n:mobile.tags.mk-user.follows-you%</span>
|
|
|
|
</div>
|
|
|
|
<div class="description">{{ user.description }}</div>
|
|
|
|
<div class="info">
|
2018-03-27 02:51:12 -05:00
|
|
|
<p class="location" v-if="user.host === null && user.account.profile.location">
|
2018-03-25 10:19:07 -05:00
|
|
|
%fa:map-marker%{{ user.account.profile.location }}
|
2018-02-15 03:33:34 -06:00
|
|
|
</p>
|
2018-03-27 02:51:12 -05:00
|
|
|
<p class="birthday" v-if="user.host === null && user.account.profile.birthday">
|
2018-03-25 10:19:07 -05:00
|
|
|
%fa:birthday-cake%{{ user.account.profile.birthday.replace('-', '年').replace('-', '月') + '日' }} ({{ age }}歳)
|
2018-02-15 03:33:34 -06:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div class="status">
|
2018-02-21 06:08:03 -06:00
|
|
|
<a>
|
2018-02-26 11:17:10 -06:00
|
|
|
<b>{{ user.posts_count | number }}</b>
|
2018-02-15 03:33:34 -06:00
|
|
|
<i>%i18n:mobile.tags.mk-user.posts%</i>
|
|
|
|
</a>
|
2018-03-27 02:51:12 -05:00
|
|
|
<a :href="`@${acct}/following`">
|
2018-02-26 11:17:10 -06:00
|
|
|
<b>{{ user.following_count | number }}</b>
|
2018-02-15 03:33:34 -06:00
|
|
|
<i>%i18n:mobile.tags.mk-user.following%</i>
|
|
|
|
</a>
|
2018-03-27 02:51:12 -05:00
|
|
|
<a :href="`@${acct}/followers`">
|
2018-02-26 11:17:10 -06:00
|
|
|
<b>{{ user.followers_count | number }}</b>
|
2018-02-15 03:33:34 -06:00
|
|
|
<i>%i18n:mobile.tags.mk-user.followers%</i>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-03-26 01:56:31 -05:00
|
|
|
</header>
|
|
|
|
<nav>
|
|
|
|
<div class="nav-container">
|
2018-02-15 03:33:34 -06:00
|
|
|
<a :data-is-active=" page == 'home' " @click="page = 'home'">%i18n:mobile.tags.mk-user.overview%</a>
|
|
|
|
<a :data-is-active=" page == 'posts' " @click="page = 'posts'">%i18n:mobile.tags.mk-user.timeline%</a>
|
|
|
|
<a :data-is-active=" page == 'media' " @click="page = 'media'">%i18n:mobile.tags.mk-user.media%</a>
|
2018-03-26 01:56:31 -05:00
|
|
|
</div>
|
|
|
|
</nav>
|
2018-02-15 03:33:34 -06:00
|
|
|
<div class="body">
|
2018-02-22 02:32:58 -06:00
|
|
|
<x-home v-if="page == 'home'" :user="user"/>
|
2018-02-15 03:33:34 -06:00
|
|
|
<mk-user-timeline v-if="page == 'posts'" :user="user"/>
|
|
|
|
<mk-user-timeline v-if="page == 'media'" :user="user" with-media/>
|
|
|
|
</div>
|
2018-02-22 02:32:58 -06:00
|
|
|
</main>
|
2018-02-15 03:33:34 -06:00
|
|
|
</mk-ui>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-02-22 07:03:44 -06:00
|
|
|
import * as age from 's-age';
|
2018-03-27 02:51:12 -05:00
|
|
|
import getAcct from '../../../../../common/user/get-acct';
|
|
|
|
import getAcct from '../../../../../common/user/parse-acct';
|
2018-02-15 22:11:54 -06:00
|
|
|
import Progress from '../../../common/scripts/loading';
|
2018-02-22 02:32:58 -06:00
|
|
|
import XHome from './user/home.vue';
|
2018-02-15 03:33:34 -06:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-02-22 02:32:58 -06:00
|
|
|
components: {
|
|
|
|
XHome
|
|
|
|
},
|
2018-02-15 03:33:34 -06:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
fetching: true,
|
2018-02-22 17:07:30 -06:00
|
|
|
user: null,
|
|
|
|
page: 'home'
|
2018-02-15 03:33:34 -06:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2018-03-27 02:51:12 -05:00
|
|
|
acct() {
|
|
|
|
return this.getAcct(this.user);
|
|
|
|
},
|
2018-02-15 03:33:34 -06:00
|
|
|
age(): number {
|
2018-03-25 10:19:07 -05:00
|
|
|
return age(this.user.account.profile.birthday);
|
2018-02-15 03:33:34 -06:00
|
|
|
}
|
|
|
|
},
|
2018-02-22 02:06:19 -06:00
|
|
|
watch: {
|
|
|
|
$route: 'fetch'
|
|
|
|
},
|
2018-02-22 06:23:10 -06:00
|
|
|
created() {
|
|
|
|
this.fetch();
|
|
|
|
},
|
2018-02-15 03:33:34 -06:00
|
|
|
mounted() {
|
2018-02-15 22:11:54 -06:00
|
|
|
document.documentElement.style.background = '#313a42';
|
2018-02-22 02:06:19 -06:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
fetch() {
|
|
|
|
Progress.start();
|
|
|
|
|
2018-03-27 02:51:12 -05:00
|
|
|
(this as any).api('users/show', parseAcct(this.$route.params.user)).then(user => {
|
2018-02-22 02:06:19 -06:00
|
|
|
this.user = user;
|
|
|
|
this.fetching = false;
|
2018-02-15 22:11:54 -06:00
|
|
|
|
2018-02-22 02:06:19 -06:00
|
|
|
Progress.done();
|
|
|
|
document.title = user.name + ' | Misskey';
|
|
|
|
});
|
|
|
|
}
|
2018-02-15 03:33:34 -06:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2018-02-22 02:32:58 -06:00
|
|
|
<style lang="stylus" scoped>
|
2018-03-02 22:47:55 -06:00
|
|
|
@import '~const.styl'
|
|
|
|
|
2018-02-22 02:32:58 -06:00
|
|
|
main
|
2018-02-15 03:33:34 -06:00
|
|
|
> header
|
|
|
|
|
|
|
|
> .banner
|
|
|
|
padding-bottom 33.3%
|
|
|
|
background-color #1b1b1b
|
|
|
|
background-size cover
|
|
|
|
background-position center
|
|
|
|
|
|
|
|
> .body
|
|
|
|
padding 12px
|
|
|
|
margin 0 auto
|
|
|
|
max-width 600px
|
|
|
|
|
|
|
|
> .top
|
|
|
|
&:after
|
|
|
|
content ''
|
|
|
|
display block
|
|
|
|
clear both
|
|
|
|
|
|
|
|
> .avatar
|
|
|
|
display block
|
|
|
|
float left
|
|
|
|
width 25%
|
|
|
|
height 40px
|
|
|
|
|
|
|
|
> img
|
|
|
|
display block
|
|
|
|
position absolute
|
|
|
|
left -2px
|
|
|
|
bottom -2px
|
|
|
|
width 100%
|
2018-02-22 02:32:58 -06:00
|
|
|
border 3px solid #313a42
|
2018-02-15 03:33:34 -06:00
|
|
|
border-radius 6px
|
|
|
|
|
|
|
|
@media (min-width 500px)
|
|
|
|
left -4px
|
|
|
|
bottom -4px
|
|
|
|
border 4px solid #313a42
|
|
|
|
border-radius 12px
|
|
|
|
|
2018-02-16 12:01:00 -06:00
|
|
|
> .mk-follow-button
|
2018-02-15 03:33:34 -06:00
|
|
|
float right
|
|
|
|
height 40px
|
|
|
|
|
|
|
|
> .title
|
|
|
|
margin 8px 0
|
|
|
|
|
|
|
|
> h1
|
|
|
|
margin 0
|
|
|
|
line-height 22px
|
|
|
|
font-size 20px
|
|
|
|
color #fff
|
|
|
|
|
|
|
|
> .username
|
|
|
|
display inline-block
|
|
|
|
line-height 20px
|
|
|
|
font-size 16px
|
|
|
|
font-weight bold
|
|
|
|
color #657786
|
|
|
|
|
|
|
|
> .followed
|
|
|
|
margin-left 8px
|
|
|
|
padding 2px 4px
|
|
|
|
font-size 12px
|
|
|
|
color #657786
|
|
|
|
background #f8f8f8
|
|
|
|
border-radius 4px
|
|
|
|
|
|
|
|
> .description
|
|
|
|
margin 8px 0
|
|
|
|
color #fff
|
|
|
|
|
|
|
|
> .info
|
|
|
|
margin 8px 0
|
|
|
|
|
|
|
|
> p
|
|
|
|
display inline
|
|
|
|
margin 0 16px 0 0
|
|
|
|
color #a9b9c1
|
|
|
|
|
|
|
|
> i
|
|
|
|
margin-right 4px
|
|
|
|
|
|
|
|
> .status
|
|
|
|
> a
|
|
|
|
color #657786
|
|
|
|
|
|
|
|
&:not(:last-child)
|
|
|
|
margin-right 16px
|
|
|
|
|
|
|
|
> b
|
|
|
|
margin-right 4px
|
|
|
|
font-size 16px
|
|
|
|
color #fff
|
|
|
|
|
|
|
|
> i
|
|
|
|
font-size 14px
|
|
|
|
|
2018-03-26 01:56:31 -05:00
|
|
|
> nav
|
|
|
|
position sticky
|
|
|
|
top 48px
|
|
|
|
box-shadow 0 4px 4px rgba(0, 0, 0, 0.3)
|
|
|
|
background-color #313a42
|
|
|
|
z-index 1
|
|
|
|
> .nav-container
|
2018-02-15 03:33:34 -06:00
|
|
|
display flex
|
|
|
|
justify-content center
|
|
|
|
margin 0 auto
|
|
|
|
max-width 600px
|
|
|
|
|
|
|
|
> a
|
|
|
|
display block
|
|
|
|
flex 1 1
|
|
|
|
text-align center
|
|
|
|
line-height 52px
|
|
|
|
font-size 14px
|
|
|
|
text-decoration none
|
|
|
|
color #657786
|
|
|
|
border-bottom solid 2px transparent
|
|
|
|
|
|
|
|
&[data-is-active]
|
|
|
|
font-weight bold
|
|
|
|
color $theme-color
|
|
|
|
border-color $theme-color
|
|
|
|
|
|
|
|
> .body
|
|
|
|
padding 8px
|
|
|
|
|
|
|
|
@media (min-width 500px)
|
|
|
|
padding 16px
|
|
|
|
|
|
|
|
</style>
|