2018-02-14 17:32:13 +02:00
|
|
|
<template>
|
2018-03-29 08:48:47 +03:00
|
|
|
<div class="header" :data-is-dark-background="user.bannerUrl != null">
|
2018-05-07 11:05:05 +03:00
|
|
|
<div class="banner-container" :style="style">
|
|
|
|
<div class="banner" ref="banner" :style="style" @click="onBannerClick"></div>
|
2018-04-18 13:47:56 +03:00
|
|
|
<div class="fade"></div>
|
2018-02-14 17:32:13 +02:00
|
|
|
<div class="title">
|
2018-04-09 12:52:29 +03:00
|
|
|
<p class="name">{{ user | userName }}</p>
|
2018-06-23 16:55:32 +03:00
|
|
|
<div>
|
2018-06-23 17:03:25 +03:00
|
|
|
<p v-if="user.isBot" title="%i18n:@is-bot%">%fa:robot%</p>
|
2018-06-23 16:55:32 +03:00
|
|
|
<p class="username"><mk-acct :user="user"/></p>
|
2018-06-23 17:03:25 +03:00
|
|
|
<p class="location" v-if="user.host === null && user.profile.location">%fa:map-marker% {{ user.profile.location }}</p>
|
|
|
|
<p class="birthday" v-if="user.host === null && user.profile.birthday">%fa:birthday-cake% {{ user.profile.birthday.replace('-', '年').replace('-', '月') + '日' }} ({{ age }}歳)</p>
|
2018-06-23 16:55:32 +03:00
|
|
|
</div>
|
2018-02-14 17:32:13 +02:00
|
|
|
</div>
|
2018-06-20 13:55:34 +03:00
|
|
|
</div>
|
|
|
|
<mk-avatar class="avatar" :user="user" :disable-preview="true"/>
|
|
|
|
<div class="body">
|
2018-06-23 16:55:32 +03:00
|
|
|
<div class="description">
|
|
|
|
<misskey-flavored-markdown v-if="user.description" :text="user.description" :i="$store.state.i"/>
|
|
|
|
</div>
|
|
|
|
<div class="status">
|
|
|
|
<span class="notes-count"><b>{{ user.notesCount | number }}</b>%i18n:@posts%</span>
|
|
|
|
<span class="following clickable" @click="showFollowing"><b>{{ user.followingCount | number }}</b>%i18n:@following%</span>
|
|
|
|
<span class="followers clickable" @click="showFollowers"><b>{{ user.followersCount | number }}</b>%i18n:@followers%</span>
|
|
|
|
</div>
|
2018-02-14 17:32:13 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-06-23 16:55:32 +03:00
|
|
|
import MkFollowingWindow from '../../components/following-window.vue';
|
|
|
|
import MkFollowersWindow from '../../components/followers-window.vue';
|
2018-02-14 17:32:13 +02:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
props: ['user'],
|
2018-05-07 11:05:05 +03:00
|
|
|
computed: {
|
|
|
|
style(): any {
|
|
|
|
if (this.user.bannerUrl == null) return {};
|
|
|
|
return {
|
2018-05-18 09:31:28 +03:00
|
|
|
backgroundColor: this.user.bannerColor && this.user.bannerColor.length == 3 ? `rgb(${ this.user.bannerColor.join(',') })` : null,
|
2018-05-07 11:05:05 +03:00
|
|
|
backgroundImage: `url(${ this.user.bannerUrl })`
|
|
|
|
};
|
|
|
|
}
|
|
|
|
},
|
2018-02-14 17:32:13 +02:00
|
|
|
mounted() {
|
2018-04-15 12:38:40 +03:00
|
|
|
if (this.user.bannerUrl) {
|
2018-06-20 19:46:35 +03:00
|
|
|
//window.addEventListener('load', this.onScroll);
|
|
|
|
//window.addEventListener('scroll', this.onScroll, { passive: true });
|
|
|
|
//window.addEventListener('resize', this.onScroll);
|
2018-04-15 12:38:40 +03:00
|
|
|
}
|
2018-02-14 17:32:13 +02:00
|
|
|
},
|
|
|
|
beforeDestroy() {
|
2018-04-15 12:38:40 +03:00
|
|
|
if (this.user.bannerUrl) {
|
2018-06-20 19:46:35 +03:00
|
|
|
//window.removeEventListener('load', this.onScroll);
|
|
|
|
//window.removeEventListener('scroll', this.onScroll);
|
|
|
|
//window.removeEventListener('resize', this.onScroll);
|
2018-04-15 12:38:40 +03:00
|
|
|
}
|
2018-02-14 17:32:13 +02:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onScroll() {
|
|
|
|
const banner = this.$refs.banner as any;
|
|
|
|
|
|
|
|
const top = window.scrollY;
|
|
|
|
|
|
|
|
const z = 1.25; // 奥行き(小さいほど奥)
|
|
|
|
const pos = -(top / z);
|
|
|
|
banner.style.backgroundPosition = `center calc(50% - ${pos}px)`;
|
|
|
|
|
|
|
|
const blur = top / 32
|
|
|
|
if (blur <= 10) banner.style.filter = `blur(${blur}px)`;
|
|
|
|
},
|
|
|
|
|
|
|
|
onBannerClick() {
|
2018-05-27 07:49:09 +03:00
|
|
|
if (!this.$store.getters.isSignedIn || this.$store.state.i.id != this.user.id) return;
|
2018-02-14 17:32:13 +02:00
|
|
|
|
2018-04-08 18:33:56 +03:00
|
|
|
(this as any).apis.updateBanner().then(i => {
|
2018-03-29 08:48:47 +03:00
|
|
|
this.user.bannerUrl = i.bannerUrl;
|
2018-02-14 17:32:13 +02:00
|
|
|
});
|
2018-06-23 16:55:32 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
showFollowing() {
|
|
|
|
(this as any).os.new(MkFollowingWindow, {
|
|
|
|
user: this.user
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
showFollowers() {
|
|
|
|
(this as any).os.new(MkFollowersWindow, {
|
|
|
|
user: this.user
|
|
|
|
});
|
|
|
|
},
|
2018-02-14 17:32:13 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-03-03 06:47:55 +02:00
|
|
|
@import '~const.styl'
|
|
|
|
|
2018-06-20 13:55:34 +03:00
|
|
|
root(isDark)
|
|
|
|
background isDark ? #282C37 : #fff
|
|
|
|
border 1px solid rgba(#000, 0.075)
|
|
|
|
border-radius 6px
|
2018-02-14 17:32:13 +02:00
|
|
|
overflow hidden
|
|
|
|
|
|
|
|
&[data-is-dark-background]
|
|
|
|
> .banner-container
|
|
|
|
> .banner
|
|
|
|
background-color #383838
|
|
|
|
|
2018-04-18 13:47:56 +03:00
|
|
|
> .fade
|
2018-04-29 02:51:17 +03:00
|
|
|
background linear-gradient(transparent, rgba(#000, 0.7))
|
2018-02-14 17:32:13 +02:00
|
|
|
|
|
|
|
> .title
|
|
|
|
color #fff
|
|
|
|
|
|
|
|
> .name
|
|
|
|
text-shadow 0 0 8px #000
|
|
|
|
|
|
|
|
> .banner-container
|
2018-06-20 13:55:34 +03:00
|
|
|
height 250px
|
2018-02-14 17:32:13 +02:00
|
|
|
overflow hidden
|
|
|
|
background-size cover
|
|
|
|
background-position center
|
|
|
|
|
|
|
|
> .banner
|
|
|
|
height 100%
|
2018-04-15 13:24:21 +03:00
|
|
|
background-color #bfccd0
|
2018-02-14 17:32:13 +02:00
|
|
|
background-size cover
|
|
|
|
background-position center
|
|
|
|
|
2018-04-18 13:47:56 +03:00
|
|
|
> .fade
|
|
|
|
position absolute
|
|
|
|
bottom 0
|
|
|
|
left 0
|
|
|
|
width 100%
|
|
|
|
height 78px
|
2018-02-14 17:32:13 +02:00
|
|
|
|
|
|
|
> .title
|
|
|
|
position absolute
|
2018-06-20 13:55:34 +03:00
|
|
|
bottom 0
|
2018-02-14 17:32:13 +02:00
|
|
|
left 0
|
|
|
|
width 100%
|
2018-06-20 13:55:34 +03:00
|
|
|
padding 0 0 8px 154px
|
2018-04-15 12:38:40 +03:00
|
|
|
color #5e6367
|
2018-02-14 17:32:13 +02:00
|
|
|
|
|
|
|
> .name
|
|
|
|
display block
|
|
|
|
margin 0
|
2018-06-20 13:55:34 +03:00
|
|
|
line-height 32px
|
2018-02-14 17:32:13 +02:00
|
|
|
font-weight bold
|
2018-06-20 13:55:34 +03:00
|
|
|
font-size 1.8em
|
2018-02-14 17:32:13 +02:00
|
|
|
|
2018-06-23 16:55:32 +03:00
|
|
|
> div
|
|
|
|
> *
|
|
|
|
display inline-block
|
|
|
|
margin 0 16px 0 0
|
|
|
|
line-height 20px
|
|
|
|
opacity 0.8
|
2018-02-14 17:32:13 +02:00
|
|
|
|
2018-06-20 13:55:34 +03:00
|
|
|
> .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)
|
|
|
|
|
|
|
|
> .body
|
|
|
|
padding 16px 16px 16px 154px
|
|
|
|
color isDark ? #c5ced6 : #555
|
|
|
|
|
2018-06-23 16:55:32 +03:00
|
|
|
> .status
|
|
|
|
margin-top 16px
|
|
|
|
padding-top 16px
|
|
|
|
border-top solid 1px rgba(#000, isDark ? 0.2 : 0.1)
|
|
|
|
font-size 80%
|
|
|
|
|
|
|
|
> *
|
|
|
|
display inline-block
|
|
|
|
padding-right 16px
|
|
|
|
margin-right 16px
|
|
|
|
|
|
|
|
&:not(:last-child)
|
|
|
|
border-right solid 1px rgba(#000, isDark ? 0.2 : 0.1)
|
|
|
|
|
|
|
|
&.clickable
|
|
|
|
cursor pointer
|
|
|
|
|
|
|
|
&:hover
|
|
|
|
color isDark ? #fff : #000
|
|
|
|
|
|
|
|
> b
|
|
|
|
margin-right 4px
|
|
|
|
font-size 1rem
|
|
|
|
font-weight bold
|
|
|
|
color $theme-color
|
|
|
|
|
2018-06-20 13:55:34 +03:00
|
|
|
.header[data-darkmode]
|
|
|
|
root(true)
|
|
|
|
|
|
|
|
.header:not([data-darkmode])
|
|
|
|
root(false)
|
2018-02-14 17:32:13 +02:00
|
|
|
|
|
|
|
</style>
|