2018-02-15 03:33:34 -06:00
|
|
|
<template>
|
2018-02-22 02:32:58 -06:00
|
|
|
<mk-ui>
|
2018-07-24 09:43:14 -05:00
|
|
|
<template slot="header" v-if="!fetching"><img :src="user.avatarUrl" alt="">{{ user | userName }}</template>
|
2018-09-28 00:26:20 -05:00
|
|
|
<main v-if="!fetching">
|
2018-11-08 12:44:35 -06:00
|
|
|
<div class="is-suspended" v-if="user.isSuspended"><p><fa icon="exclamation-triangle"/> {{ $t('is-suspended') }}</p></div>
|
|
|
|
<div class="is-remote" v-if="user.host != null"><p><fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}<a :href="user.url || user.uri" target="_blank">{{ $t('@.view-on-remote') }}</a></p></div>
|
2018-02-15 03:33:34 -06:00
|
|
|
<header>
|
2018-05-07 03:05:05 -05:00
|
|
|
<div class="banner" :style="style"></div>
|
2018-02-15 03:33:34 -06:00
|
|
|
<div class="body">
|
|
|
|
<div class="top">
|
|
|
|
<a class="avatar">
|
2018-05-06 04:04:37 -05:00
|
|
|
<img :src="user.avatarUrl" alt="avatar"/>
|
2018-02-15 03:33:34 -06:00
|
|
|
</a>
|
2018-11-05 10:40:11 -06:00
|
|
|
<button class="menu" ref="menu" @click="menu"><fa icon="ellipsis-h"/></button>
|
2018-05-26 23:49:09 -05:00
|
|
|
<mk-follow-button v-if="$store.getters.isSignedIn && $store.state.i.id != user.id" :user="user"/>
|
2018-02-15 03:33:34 -06:00
|
|
|
</div>
|
|
|
|
<div class="title">
|
2018-04-09 04:52:29 -05:00
|
|
|
<h1>{{ user | userName }}</h1>
|
2018-09-05 13:21:11 -05:00
|
|
|
<span class="username"><mk-acct :user="user" :detail="true" /></span>
|
2018-11-08 12:44:35 -06:00
|
|
|
<span class="followed" v-if="user.isFollowed">{{ $t('follows-you') }}</span>
|
2018-02-15 03:33:34 -06:00
|
|
|
</div>
|
2018-06-20 05:55:34 -05:00
|
|
|
<div class="description">
|
|
|
|
<misskey-flavored-markdown v-if="user.description" :text="user.description" :i="$store.state.i"/>
|
|
|
|
</div>
|
2018-02-15 03:33:34 -06:00
|
|
|
<div class="info">
|
2018-04-07 13:58:11 -05:00
|
|
|
<p class="location" v-if="user.host === null && user.profile.location">
|
2018-11-05 10:40:11 -06:00
|
|
|
<fa icon="map-marker"/>{{ user.profile.location }}
|
2018-02-15 03:33:34 -06:00
|
|
|
</p>
|
2018-04-07 13:58:11 -05:00
|
|
|
<p class="birthday" v-if="user.host === null && user.profile.birthday">
|
2018-11-09 09:28:50 -06:00
|
|
|
<fa icon="birthday-cake"/>{{ user.profile.birthday.replace('-', '年').replace('-', '月') + '日' }} ({{ $t('years-old', { age }) }})
|
2018-02-15 03:33:34 -06:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div class="status">
|
2018-02-21 06:08:03 -06:00
|
|
|
<a>
|
2018-04-07 12:30:37 -05:00
|
|
|
<b>{{ user.notesCount | number }}</b>
|
2018-11-08 12:44:35 -06:00
|
|
|
<i>{{ $t('notes') }}</i>
|
2018-02-15 03:33:34 -06:00
|
|
|
</a>
|
2018-04-09 05:23:52 -05:00
|
|
|
<a :href="user | userPage('following')">
|
2018-03-29 00:48:47 -05:00
|
|
|
<b>{{ user.followingCount | number }}</b>
|
2018-11-08 12:44:35 -06:00
|
|
|
<i>{{ $t('following') }}</i>
|
2018-02-15 03:33:34 -06:00
|
|
|
</a>
|
2018-04-09 05:23:52 -05:00
|
|
|
<a :href="user | userPage('followers')">
|
2018-03-29 00:48:47 -05:00
|
|
|
<b>{{ user.followersCount | number }}</b>
|
2018-11-08 12:44:35 -06:00
|
|
|
<i>{{ $t('followers') }}</i>
|
2018-02-15 03:33:34 -06:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-03-26 01:56:31 -05:00
|
|
|
</header>
|
|
|
|
<nav>
|
|
|
|
<div class="nav-container">
|
2018-11-08 12:44:35 -06:00
|
|
|
<a :data-active="page == 'home'" @click="page = 'home'"><fa icon="home"/> {{ $t('overview') }}</a>
|
|
|
|
<a :data-active="page == 'notes'" @click="page = 'notes'"><fa :icon="['far', 'comment-alt']"/> {{ $t('timeline') }}</a>
|
|
|
|
<a :data-active="page == 'media'" @click="page = 'media'"><fa icon="image"/> {{ $t('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-04-16 01:13:31 -05:00
|
|
|
<mk-user-timeline v-if="page == 'notes'" :user="user" key="tl"/>
|
|
|
|
<mk-user-timeline v-if="page == 'media'" :user="user" :with-media="true" key="media"/>
|
2018-02-15 03:33:34 -06:00
|
|
|
</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-11-08 12:44:35 -06:00
|
|
|
import i18n from '../../../i18n';
|
2018-02-22 07:03:44 -06:00
|
|
|
import * as age from 's-age';
|
2018-07-07 05:19:00 -05:00
|
|
|
import parseAcct from '../../../../../misc/acct/parse';
|
2018-02-15 22:11:54 -06:00
|
|
|
import Progress from '../../../common/scripts/loading';
|
2018-10-29 07:32:38 -05:00
|
|
|
import Menu from '../../../common/views/components/menu.vue';
|
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-11-08 12:44:35 -06:00
|
|
|
i18n: i18n('mobile/views/pages/user.vue'),
|
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,
|
2018-04-09 04:52:29 -05:00
|
|
|
page: 'home'
|
2018-02-15 03:33:34 -06:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
age(): number {
|
2018-04-07 13:58:11 -05:00
|
|
|
return age(this.user.profile.birthday);
|
2018-05-07 03:05:05 -05:00
|
|
|
},
|
|
|
|
style(): any {
|
|
|
|
if (this.user.bannerUrl == null) return {};
|
|
|
|
return {
|
2018-05-18 01:31:28 -05:00
|
|
|
backgroundColor: this.user.bannerColor && this.user.bannerColor.length == 3 ? `rgb(${ this.user.bannerColor.join(',') })` : null,
|
2018-05-07 03:05:05 -05:00
|
|
|
backgroundImage: `url(${ this.user.bannerUrl })`
|
|
|
|
};
|
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-22 02:06:19 -06:00
|
|
|
methods: {
|
|
|
|
fetch() {
|
|
|
|
Progress.start();
|
|
|
|
|
2018-11-08 17:13:34 -06:00
|
|
|
this.$root.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();
|
2018-11-08 17:26:32 -06:00
|
|
|
document.title = `${Vue.filter('userName')(this.user)} | ${this.$root.instanceName}`;
|
2018-02-22 02:06:19 -06:00
|
|
|
});
|
2018-10-29 07:32:38 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
menu() {
|
|
|
|
let menu = [{
|
2018-11-13 07:43:09 -06:00
|
|
|
icon: this.user.isMuted ? ['fas', 'eye'] : ['far', 'eye-slash'],
|
2018-11-08 12:44:35 -06:00
|
|
|
text: this.user.isMuted ? this.$t('unmute') : this.$t('mute'),
|
2018-10-29 07:32:38 -05:00
|
|
|
action: () => {
|
|
|
|
if (this.user.isMuted) {
|
2018-11-08 17:13:34 -06:00
|
|
|
this.$root.api('mute/delete', {
|
2018-10-29 07:32:38 -05:00
|
|
|
userId: this.user.id
|
|
|
|
}).then(() => {
|
|
|
|
this.user.isMuted = false;
|
|
|
|
}, () => {
|
|
|
|
alert('error');
|
|
|
|
});
|
|
|
|
} else {
|
2018-11-08 17:13:34 -06:00
|
|
|
this.$root.api('mute/create', {
|
2018-10-29 07:32:38 -05:00
|
|
|
userId: this.user.id
|
|
|
|
}).then(() => {
|
|
|
|
this.user.isMuted = true;
|
|
|
|
}, () => {
|
|
|
|
alert('error');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, {
|
2018-11-14 03:03:38 -06:00
|
|
|
icon: 'ban',
|
2018-11-08 12:44:35 -06:00
|
|
|
text: this.user.isBlocking ? this.$t('unblock') : this.$t('block'),
|
2018-10-29 07:32:38 -05:00
|
|
|
action: () => {
|
|
|
|
if (this.user.isBlocking) {
|
2018-11-08 17:13:34 -06:00
|
|
|
this.$root.api('blocking/delete', {
|
2018-10-29 07:32:38 -05:00
|
|
|
userId: this.user.id
|
|
|
|
}).then(() => {
|
|
|
|
this.user.isBlocking = false;
|
|
|
|
}, () => {
|
|
|
|
alert('error');
|
|
|
|
});
|
|
|
|
} else {
|
2018-11-08 17:13:34 -06:00
|
|
|
this.$root.api('blocking/create', {
|
2018-10-29 07:32:38 -05:00
|
|
|
userId: this.user.id
|
|
|
|
}).then(() => {
|
|
|
|
this.user.isBlocking = true;
|
|
|
|
}, () => {
|
|
|
|
alert('error');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
|
2018-11-08 17:13:34 -06:00
|
|
|
this.$root.new(Menu, {
|
2018-10-29 07:32:38 -05:00
|
|
|
source: this.$refs.menu,
|
|
|
|
compact: true,
|
|
|
|
items: menu
|
|
|
|
});
|
|
|
|
},
|
2018-02-15 03:33:34 -06:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2018-02-22 02:32:58 -06:00
|
|
|
<style lang="stylus" scoped>
|
2018-09-27 21:18:56 -05:00
|
|
|
main
|
|
|
|
$bg = var(--face)
|
2018-04-27 20:59:37 -05:00
|
|
|
|
2018-04-19 04:54:34 -05:00
|
|
|
> .is-suspended
|
2018-04-15 04:38:40 -05:00
|
|
|
> .is-remote
|
2018-04-19 04:54:34 -05:00
|
|
|
&.is-suspended
|
|
|
|
color #570808
|
|
|
|
background #ffdbdb
|
|
|
|
|
|
|
|
&.is-remote
|
|
|
|
color #573c08
|
|
|
|
background #fff0db
|
2018-04-15 04:38:40 -05:00
|
|
|
|
|
|
|
> p
|
|
|
|
margin 0 auto
|
2018-04-19 12:09:53 -05:00
|
|
|
padding 14px
|
|
|
|
max-width 600px
|
2018-04-18 02:25:33 -05:00
|
|
|
font-size 14px
|
2018-04-15 04:38:40 -05:00
|
|
|
|
|
|
|
> a
|
|
|
|
font-weight bold
|
|
|
|
|
2018-04-16 01:17:20 -05:00
|
|
|
@media (max-width 500px)
|
2018-04-19 12:09:53 -05:00
|
|
|
padding 12px
|
2018-04-16 01:17:20 -05:00
|
|
|
font-size 12px
|
|
|
|
|
2018-02-15 03:33:34 -06:00
|
|
|
> header
|
2018-04-27 20:59:37 -05:00
|
|
|
background $bg
|
2018-02-15 03:33:34 -06:00
|
|
|
|
|
|
|
> .banner
|
|
|
|
padding-bottom 33.3%
|
2018-09-27 21:18:56 -05:00
|
|
|
background-color rgba(0, 0, 0, 0.1)
|
2018-02-15 03:33:34 -06:00
|
|
|
background-size cover
|
|
|
|
background-position center
|
|
|
|
|
|
|
|
> .body
|
|
|
|
padding 12px
|
|
|
|
margin 0 auto
|
|
|
|
max-width 600px
|
|
|
|
|
|
|
|
> .top
|
2018-10-29 07:32:38 -05:00
|
|
|
display flex
|
2018-02-15 03:33:34 -06:00
|
|
|
|
|
|
|
> .avatar
|
|
|
|
display block
|
|
|
|
width 25%
|
|
|
|
height 40px
|
|
|
|
|
|
|
|
> img
|
|
|
|
display block
|
|
|
|
position absolute
|
|
|
|
left -2px
|
|
|
|
bottom -2px
|
|
|
|
width 100%
|
2018-04-27 20:59:37 -05:00
|
|
|
background $bg
|
|
|
|
border 3px solid $bg
|
2018-02-15 03:33:34 -06:00
|
|
|
border-radius 6px
|
|
|
|
|
|
|
|
@media (min-width 500px)
|
|
|
|
left -4px
|
|
|
|
bottom -4px
|
2018-04-27 20:59:37 -05:00
|
|
|
border 4px solid $bg
|
2018-02-15 03:33:34 -06:00
|
|
|
border-radius 12px
|
|
|
|
|
2018-10-29 07:32:38 -05:00
|
|
|
> .menu
|
|
|
|
margin 0 0 0 auto
|
|
|
|
padding 8px
|
|
|
|
margin-right 8px
|
|
|
|
font-size 18px
|
|
|
|
color var(--text)
|
2018-08-22 01:54:22 -05:00
|
|
|
|
2018-02-15 03:33:34 -06:00
|
|
|
> .title
|
|
|
|
margin 8px 0
|
|
|
|
|
|
|
|
> h1
|
|
|
|
margin 0
|
|
|
|
line-height 22px
|
|
|
|
font-size 20px
|
2018-09-27 21:18:56 -05:00
|
|
|
color var(--mobileUserPageName)
|
2018-02-15 03:33:34 -06:00
|
|
|
|
|
|
|
> .username
|
|
|
|
display inline-block
|
|
|
|
line-height 20px
|
|
|
|
font-size 16px
|
|
|
|
font-weight bold
|
2018-09-27 21:18:56 -05:00
|
|
|
color var(--mobileUserPageAcct)
|
2018-02-15 03:33:34 -06:00
|
|
|
|
|
|
|
> .followed
|
|
|
|
margin-left 8px
|
|
|
|
padding 2px 4px
|
|
|
|
font-size 12px
|
2018-09-27 21:18:56 -05:00
|
|
|
color var(--mobileUserPageFollowedFg)
|
|
|
|
background var(--mobileUserPageFollowedBg)
|
2018-02-15 03:33:34 -06:00
|
|
|
border-radius 4px
|
|
|
|
|
|
|
|
> .description
|
|
|
|
margin 8px 0
|
2018-09-27 21:18:56 -05:00
|
|
|
color var(--mobileUserPageDescription)
|
2018-02-15 03:33:34 -06:00
|
|
|
|
|
|
|
> .info
|
|
|
|
margin 8px 0
|
|
|
|
|
|
|
|
> p
|
|
|
|
display inline
|
|
|
|
margin 0 16px 0 0
|
2018-09-27 21:18:56 -05:00
|
|
|
color var(--text)
|
2018-02-15 03:33:34 -06:00
|
|
|
|
|
|
|
> i
|
|
|
|
margin-right 4px
|
|
|
|
|
|
|
|
> .status
|
|
|
|
> a
|
2018-09-27 21:18:56 -05:00
|
|
|
color var(--text)
|
2018-02-15 03:33:34 -06:00
|
|
|
|
|
|
|
&:not(:last-child)
|
|
|
|
margin-right 16px
|
|
|
|
|
|
|
|
> b
|
|
|
|
margin-right 4px
|
|
|
|
font-size 16px
|
2018-09-27 21:18:56 -05:00
|
|
|
color var(--mobileUserPageStatusHighlight)
|
2018-02-15 03:33:34 -06:00
|
|
|
|
|
|
|
> i
|
|
|
|
font-size 14px
|
|
|
|
|
2018-03-26 01:56:31 -05:00
|
|
|
> nav
|
2018-04-09 12:04:30 -05:00
|
|
|
position -webkit-sticky
|
2018-03-26 01:56:31 -05:00
|
|
|
position sticky
|
2018-04-27 07:06:28 -05:00
|
|
|
top 47px
|
2018-09-27 21:18:56 -05:00
|
|
|
box-shadow 0 4px 4px var(--mobileUserPageHeaderShadow)
|
2018-04-27 20:59:37 -05:00
|
|
|
background-color $bg
|
2018-08-19 12:05:57 -05:00
|
|
|
z-index 2
|
2018-04-09 12:04:30 -05:00
|
|
|
|
2018-03-26 01:56:31 -05:00
|
|
|
> .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
|
2018-04-27 20:59:37 -05:00
|
|
|
line-height 48px
|
|
|
|
font-size 12px
|
2018-02-15 03:33:34 -06:00
|
|
|
text-decoration none
|
2018-09-27 21:18:56 -05:00
|
|
|
color var(--text)
|
2018-02-15 03:33:34 -06:00
|
|
|
border-bottom solid 2px transparent
|
|
|
|
|
2018-04-27 20:59:37 -05:00
|
|
|
@media (min-width 400px)
|
|
|
|
line-height 52px
|
|
|
|
font-size 14px
|
|
|
|
|
2018-04-26 00:38:37 -05:00
|
|
|
&[data-active]
|
2018-02-15 03:33:34 -06:00
|
|
|
font-weight bold
|
2018-09-26 06:19:35 -05:00
|
|
|
color var(--primary)
|
|
|
|
border-color var(--primary)
|
2018-02-15 03:33:34 -06:00
|
|
|
|
|
|
|
> .body
|
2018-04-27 07:06:28 -05:00
|
|
|
max-width 680px
|
|
|
|
margin 0 auto
|
2018-02-15 03:33:34 -06:00
|
|
|
padding 8px
|
|
|
|
|
|
|
|
@media (min-width 500px)
|
|
|
|
padding 16px
|
|
|
|
|
2018-04-27 07:06:28 -05:00
|
|
|
@media (min-width 600px)
|
|
|
|
padding 32px
|
|
|
|
|
2018-02-15 03:33:34 -06:00
|
|
|
</style>
|