2020-01-29 12:37:25 -07:00
|
|
|
<template>
|
2020-07-10 19:13:11 -06:00
|
|
|
<div class="mk-user-page" v-if="user" v-size="[{ max: 500 }]">
|
2020-01-29 12:37:25 -07:00
|
|
|
<portal to="title" v-if="user"><mk-user-name :user="user" :nowrap="false" class="name"/></portal>
|
|
|
|
<portal to="avatar" v-if="user"><mk-avatar class="avatar" :user="user" :disable-preview="true"/></portal>
|
2020-04-13 08:27:12 -06:00
|
|
|
|
2020-03-20 22:07:02 -06:00
|
|
|
<mk-remote-caution v-if="user.host != null" :href="user.url" style="margin-bottom: var(--margin)"/>
|
2020-04-13 08:27:12 -06:00
|
|
|
<div class="punished _panel" v-if="user.isSuspended"><fa :icon="faExclamationTriangle" style="margin-right: 8px;"/> {{ $t('userSuspended') }}</div>
|
|
|
|
<div class="punished _panel" v-if="user.isSilenced"><fa :icon="faExclamationTriangle" style="margin-right: 8px;"/> {{ $t('userSilenced') }}</div>
|
2020-03-20 03:58:17 -06:00
|
|
|
<div class="profile _panel" :key="user.id">
|
|
|
|
<div class="banner-container" :style="style">
|
|
|
|
<div class="banner" ref="banner" :style="style"></div>
|
|
|
|
<div class="fade"></div>
|
2020-01-29 12:37:25 -07:00
|
|
|
<div class="title">
|
2020-03-20 03:58:17 -06:00
|
|
|
<mk-user-name class="name" :user="user" :nowrap="true"/>
|
2020-01-29 12:37:25 -07:00
|
|
|
<div class="bottom">
|
|
|
|
<span class="username"><mk-acct :user="user" :detail="true" /></span>
|
2020-02-15 06:21:35 -07:00
|
|
|
<span v-if="user.isAdmin" :title="$t('isAdmin')" style="color: var(--badge);"><fa :icon="faBookmark"/></span>
|
|
|
|
<span v-if="!user.isAdmin && user.isModerator" :title="$t('isModerator')" style="color: var(--badge);"><fa :icon="farBookmark"/></span>
|
2020-01-29 12:37:25 -07:00
|
|
|
<span v-if="user.isLocked" :title="$t('isLocked')"><fa :icon="faLock"/></span>
|
|
|
|
<span v-if="user.isBot" :title="$t('isBot')"><fa :icon="faRobot"/></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-07-24 10:36:39 -06:00
|
|
|
<span class="followed" v-if="$store.getters.isSignedIn && $store.state.i.id != user.id && user.isFollowed" v-t="'followsYou'"></span>
|
2020-03-20 03:58:17 -06:00
|
|
|
<div class="actions" v-if="$store.getters.isSignedIn">
|
|
|
|
<button @click="menu" class="menu _button" ref="menu"><fa :icon="faEllipsisH"/></button>
|
|
|
|
<mk-follow-button v-if="$store.state.i.id != user.id" :user="user" :inline="true" :transparent="false" :full="true" class="koudoku"/>
|
2020-01-29 12:37:25 -07:00
|
|
|
</div>
|
2020-03-20 03:58:17 -06:00
|
|
|
</div>
|
|
|
|
<mk-avatar class="avatar" :user="user" :disable-preview="true"/>
|
|
|
|
<div class="title">
|
|
|
|
<mk-user-name :user="user" :nowrap="false" class="name"/>
|
|
|
|
<div class="bottom">
|
|
|
|
<span class="username"><mk-acct :user="user" :detail="true" /></span>
|
|
|
|
<span v-if="user.isAdmin" :title="$t('isAdmin')" style="color: var(--badge);"><fa :icon="faBookmark"/></span>
|
|
|
|
<span v-if="!user.isAdmin && user.isModerator" :title="$t('isModerator')" style="color: var(--badge);"><fa :icon="farBookmark"/></span>
|
|
|
|
<span v-if="user.isLocked" :title="$t('isLocked')"><fa :icon="faLock"/></span>
|
|
|
|
<span v-if="user.isBot" :title="$t('isBot')"><fa :icon="faRobot"/></span>
|
2020-01-29 12:37:25 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-03-20 03:58:17 -06:00
|
|
|
<div class="description">
|
|
|
|
<mfm v-if="user.description" :text="user.description" :is-note="false" :author="user" :i="$store.state.i" :custom-emojis="user.emojis"/>
|
2020-07-24 10:36:39 -06:00
|
|
|
<p v-else class="empty" v-t="'noAccountDescription'"></p>
|
2020-03-20 03:58:17 -06:00
|
|
|
</div>
|
|
|
|
<div class="fields system">
|
|
|
|
<dl class="field" v-if="user.location">
|
|
|
|
<dt class="name"><fa :icon="faMapMarker" fixed-width/> {{ $t('location') }}</dt>
|
|
|
|
<dd class="value">{{ user.location }}</dd>
|
|
|
|
</dl>
|
|
|
|
<dl class="field" v-if="user.birthday">
|
|
|
|
<dt class="name"><fa :icon="faBirthdayCake" fixed-width/> {{ $t('birthday') }}</dt>
|
|
|
|
<dd class="value">{{ user.birthday.replace('-', '/').replace('-', '/') }} ({{ $t('yearsOld', { age }) }})</dd>
|
|
|
|
</dl>
|
|
|
|
<dl class="field">
|
|
|
|
<dt class="name"><fa :icon="faCalendarAlt" fixed-width/> {{ $t('registeredDate') }}</dt>
|
|
|
|
<dd class="value">{{ new Date(user.createdAt).toLocaleString() }} (<mk-time :time="user.createdAt"/>)</dd>
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
<div class="fields" v-if="user.fields.length > 0">
|
|
|
|
<dl class="field" v-for="(field, i) in user.fields" :key="i">
|
|
|
|
<dt class="name">
|
|
|
|
<mfm :text="field.name" :plain="true" :custom-emojis="user.emojis" :colored="false"/>
|
|
|
|
</dt>
|
|
|
|
<dd class="value">
|
|
|
|
<mfm :text="field.value" :author="user" :i="$store.state.i" :custom-emojis="user.emojis" :colored="false"/>
|
|
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
</div>
|
2020-03-20 22:07:15 -06:00
|
|
|
<div class="status">
|
2020-03-20 03:58:17 -06:00
|
|
|
<router-link :to="user | userPage()" :class="{ active: $route.name === 'user' }">
|
|
|
|
<b>{{ user.notesCount | number }}</b>
|
2020-07-24 10:36:39 -06:00
|
|
|
<span v-t="'notes'"></span>
|
2020-03-20 03:58:17 -06:00
|
|
|
</router-link>
|
|
|
|
<router-link :to="user | userPage('following')" :class="{ active: $route.name === 'userFollowing' }">
|
|
|
|
<b>{{ user.followingCount | number }}</b>
|
2020-07-24 10:36:39 -06:00
|
|
|
<span v-t="'following'"></span>
|
2020-03-20 03:58:17 -06:00
|
|
|
</router-link>
|
|
|
|
<router-link :to="user | userPage('followers')" :class="{ active: $route.name === 'userFollowers' }">
|
|
|
|
<b>{{ user.followersCount | number }}</b>
|
2020-07-24 10:36:39 -06:00
|
|
|
<span v-t="'followers'"></span>
|
2020-03-20 03:58:17 -06:00
|
|
|
</router-link>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-01-29 12:37:25 -07:00
|
|
|
<router-view :user="user"></router-view>
|
|
|
|
<template v-if="$route.name == 'user'">
|
2020-03-20 09:21:33 -06:00
|
|
|
<div class="pins">
|
|
|
|
<x-note v-for="note in user.pinnedNotes" class="note" :note="note" :key="note.id" :detail="true" :pinned="true"/>
|
|
|
|
</div>
|
2020-01-29 12:37:25 -07:00
|
|
|
<mk-container :body-togglable="true" class="content">
|
|
|
|
<template #header><fa :icon="faImage"/>{{ $t('images') }}</template>
|
|
|
|
<div>
|
|
|
|
<x-photos :user="user" :key="user.id"/>
|
|
|
|
</div>
|
|
|
|
</mk-container>
|
|
|
|
<mk-container :body-togglable="true" class="content">
|
|
|
|
<template #header><fa :icon="faChartBar"/>{{ $t('activity') }}</template>
|
|
|
|
<div style="padding:8px;">
|
|
|
|
<x-activity :user="user" :key="user.id"/>
|
|
|
|
</div>
|
|
|
|
</mk-container>
|
|
|
|
<x-user-timeline :user="user"/>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
<div v-else-if="error">
|
|
|
|
<mk-error @retry="fetch()"/>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2020-04-13 08:27:12 -06:00
|
|
|
import { faExclamationTriangle, faEllipsisH, faRobot, faLock, faBookmark, faChartBar, faImage, faBirthdayCake, faMapMarker } from '@fortawesome/free-solid-svg-icons';
|
2020-01-30 13:09:52 -07:00
|
|
|
import { faCalendarAlt, faBookmark as farBookmark } from '@fortawesome/free-regular-svg-icons';
|
2020-01-29 12:37:25 -07:00
|
|
|
import * as age from 's-age';
|
|
|
|
import XUserTimeline from './index.timeline.vue';
|
|
|
|
import XUserMenu from '../../components/user-menu.vue';
|
|
|
|
import XNote from '../../components/note.vue';
|
2020-01-30 19:35:18 -07:00
|
|
|
import MkFollowButton from '../../components/follow-button.vue';
|
2020-01-29 12:37:25 -07:00
|
|
|
import MkContainer from '../../components/ui/container.vue';
|
2020-03-20 22:07:02 -06:00
|
|
|
import MkRemoteCaution from '../../components/remote-caution.vue';
|
2020-01-29 12:37:25 -07:00
|
|
|
import Progress from '../../scripts/loading';
|
|
|
|
import parseAcct from '../../../misc/acct/parse';
|
2020-07-10 19:13:11 -06:00
|
|
|
import { getScrollPosition } from '../../scripts/scroll';
|
2020-01-29 12:37:25 -07:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
components: {
|
|
|
|
XUserTimeline,
|
|
|
|
XNote,
|
2020-01-30 19:35:18 -07:00
|
|
|
MkFollowButton,
|
2020-01-29 12:37:25 -07:00
|
|
|
MkContainer,
|
2020-03-20 22:07:02 -06:00
|
|
|
MkRemoteCaution,
|
2020-01-29 12:37:25 -07:00
|
|
|
XPhotos: () => import('./index.photos.vue').then(m => m.default),
|
|
|
|
XActivity: () => import('./index.activity.vue').then(m => m.default),
|
|
|
|
},
|
|
|
|
|
|
|
|
metaInfo() {
|
|
|
|
return {
|
|
|
|
title: (this.user ? '@' + Vue.filter('acct')(this.user).replace('@', ' | ') : null) as string
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
user: null,
|
|
|
|
error: null,
|
|
|
|
parallaxAnimationId: null,
|
2020-04-13 08:27:12 -06:00
|
|
|
faExclamationTriangle, faEllipsisH, faRobot, faLock, faBookmark, farBookmark, faChartBar, faImage, faBirthdayCake, faMapMarker, faCalendarAlt
|
2020-01-29 12:37:25 -07:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
style(): any {
|
|
|
|
if (this.user.bannerUrl == null) return {};
|
|
|
|
return {
|
|
|
|
backgroundImage: `url(${ this.user.bannerUrl })`
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
age(): number {
|
|
|
|
return age(this.user.birthday);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
$route: 'fetch'
|
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
this.fetch();
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
window.requestAnimationFrame(this.parallaxLoop);
|
|
|
|
this.$once('hook:beforeDestroy', () => {
|
|
|
|
window.cancelAnimationFrame(this.parallaxAnimationId);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
fetch() {
|
|
|
|
Progress.start();
|
|
|
|
this.$root.api('users/show', parseAcct(this.$route.params.user)).then(user => {
|
|
|
|
this.user = user;
|
|
|
|
}).catch(e => {
|
|
|
|
this.error = e;
|
|
|
|
}).finally(() => {
|
|
|
|
Progress.done();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
menu() {
|
|
|
|
this.$root.new(XUserMenu, {
|
|
|
|
source: this.$refs.menu,
|
|
|
|
user: this.user
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
parallaxLoop() {
|
|
|
|
this.parallaxAnimationId = window.requestAnimationFrame(this.parallaxLoop);
|
|
|
|
this.parallax();
|
|
|
|
},
|
|
|
|
|
|
|
|
parallax() {
|
|
|
|
const banner = this.$refs.banner as any;
|
|
|
|
if (banner == null) return;
|
|
|
|
|
2020-07-10 19:13:11 -06:00
|
|
|
const top = getScrollPosition(this.$el);
|
2020-01-29 12:37:25 -07:00
|
|
|
|
|
|
|
if (top < 0) return;
|
|
|
|
|
|
|
|
const z = 1.75; // 奥行き(小さいほど奥)
|
|
|
|
const pos = -(top / z);
|
|
|
|
banner.style.backgroundPosition = `center calc(50% - ${pos}px)`;
|
|
|
|
},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.mk-user-page {
|
2020-04-13 08:27:12 -06:00
|
|
|
> .punished {
|
|
|
|
font-size: 0.8em;
|
|
|
|
padding: 16px;
|
|
|
|
}
|
|
|
|
|
2020-01-29 12:37:25 -07:00
|
|
|
> .profile {
|
|
|
|
position: relative;
|
|
|
|
margin-bottom: var(--margin);
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
> .banner-container {
|
|
|
|
position: relative;
|
|
|
|
height: 250px;
|
|
|
|
overflow: hidden;
|
|
|
|
background-size: cover;
|
|
|
|
background-position: center;
|
|
|
|
|
|
|
|
> .banner {
|
|
|
|
height: 100%;
|
|
|
|
background-color: #4c5e6d;
|
|
|
|
background-size: cover;
|
|
|
|
background-position: center;
|
|
|
|
box-shadow: 0 0 128px rgba(0, 0, 0, 0.5) inset;
|
2020-02-15 01:44:26 -07:00
|
|
|
will-change: background-position;
|
2020-01-29 12:37:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
> .fade {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 78px;
|
|
|
|
background: linear-gradient(transparent, rgba(#000, 0.7));
|
|
|
|
}
|
|
|
|
|
|
|
|
> .followed {
|
|
|
|
position: absolute;
|
|
|
|
top: 12px;
|
|
|
|
left: 12px;
|
2020-02-06 01:28:45 -07:00
|
|
|
padding: 4px 8px;
|
2020-01-29 12:37:25 -07:00
|
|
|
color: #fff;
|
|
|
|
background: rgba(0, 0, 0, 0.7);
|
2020-02-06 01:28:45 -07:00
|
|
|
font-size: 0.7em;
|
|
|
|
border-radius: 6px;
|
2020-01-29 12:37:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
> .actions {
|
|
|
|
position: absolute;
|
|
|
|
top: 12px;
|
|
|
|
right: 12px;
|
|
|
|
-webkit-backdrop-filter: blur(8px);
|
|
|
|
backdrop-filter: blur(8px);
|
|
|
|
background: rgba(0, 0, 0, 0.2);
|
|
|
|
padding: 8px;
|
|
|
|
border-radius: 24px;
|
|
|
|
|
|
|
|
> .menu {
|
|
|
|
vertical-align: bottom;
|
|
|
|
height: 31px;
|
|
|
|
width: 31px;
|
|
|
|
color: #fff;
|
|
|
|
text-shadow: 0 0 8px #000;
|
|
|
|
font-size: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .koudoku {
|
|
|
|
margin-left: 4px;
|
|
|
|
vertical-align: bottom;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .title {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
padding: 0 0 8px 154px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
color: #fff;
|
|
|
|
|
|
|
|
> .name {
|
|
|
|
display: block;
|
|
|
|
margin: 0;
|
|
|
|
line-height: 32px;
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: 1.8em;
|
|
|
|
text-shadow: 0 0 8px #000;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .bottom {
|
|
|
|
> * {
|
|
|
|
display: inline-block;
|
|
|
|
margin-right: 16px;
|
|
|
|
line-height: 20px;
|
|
|
|
opacity: 0.8;
|
|
|
|
|
|
|
|
&.username {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .title {
|
|
|
|
display: none;
|
|
|
|
text-align: center;
|
|
|
|
padding: 50px 8px 16px 8px;
|
|
|
|
font-weight: bold;
|
|
|
|
border-bottom: solid 1px var(--divider);
|
|
|
|
|
|
|
|
> .bottom {
|
|
|
|
> * {
|
|
|
|
display: inline-block;
|
|
|
|
margin-right: 8px;
|
|
|
|
opacity: 0.8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .avatar {
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
|
|
|
top: 170px;
|
|
|
|
left: 16px;
|
|
|
|
z-index: 2;
|
|
|
|
width: 120px;
|
|
|
|
height: 120px;
|
|
|
|
box-shadow: 1px 1px 3px rgba(#000, 0.2);
|
|
|
|
}
|
|
|
|
|
|
|
|
> .description {
|
|
|
|
padding: 24px 24px 24px 154px;
|
2020-02-14 11:57:43 -07:00
|
|
|
font-size: 0.95em;
|
2020-01-29 12:37:25 -07:00
|
|
|
|
|
|
|
> .empty {
|
|
|
|
margin: 0;
|
|
|
|
opacity: 0.5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .fields {
|
|
|
|
padding: 24px;
|
2020-02-14 11:57:43 -07:00
|
|
|
font-size: 0.9em;
|
2020-01-29 12:37:25 -07:00
|
|
|
border-top: solid 1px var(--divider);
|
|
|
|
|
|
|
|
> .field {
|
|
|
|
display: flex;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
&:not(:last-child) {
|
|
|
|
margin-bottom: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .name {
|
|
|
|
width: 30%;
|
|
|
|
overflow: hidden;
|
|
|
|
white-space: nowrap;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
font-weight: bold;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .value {
|
|
|
|
width: 70%;
|
|
|
|
overflow: hidden;
|
|
|
|
white-space: nowrap;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.system > .field > .name {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .status {
|
|
|
|
display: flex;
|
|
|
|
padding: 24px;
|
|
|
|
border-top: solid 1px var(--divider);
|
|
|
|
|
|
|
|
> a {
|
|
|
|
flex: 1;
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
> b {
|
|
|
|
display: block;
|
|
|
|
line-height: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> span {
|
|
|
|
font-size: 70%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .pins {
|
|
|
|
> .note {
|
|
|
|
margin-bottom: var(--margin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .content {
|
|
|
|
margin-bottom: var(--margin);
|
|
|
|
}
|
2020-07-10 19:13:11 -06:00
|
|
|
|
|
|
|
&.max-width_500px {
|
|
|
|
> .profile {
|
|
|
|
> .banner-container {
|
|
|
|
height: 140px;
|
|
|
|
|
|
|
|
> .fade {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .title {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .title {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .avatar {
|
|
|
|
top: 90px;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
width: 92px;
|
|
|
|
height: 92px;
|
|
|
|
margin: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .description {
|
|
|
|
padding: 16px;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .fields {
|
|
|
|
padding: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .status {
|
|
|
|
padding: 16px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 12:37:25 -07:00
|
|
|
}
|
|
|
|
</style>
|