2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2022-01-25 23:18:21 +09:00
|
|
|
<transition :name="$store.state.animation ? 'popup' : ''" appear @after-leave="$emit('closed')">
|
2021-12-16 10:57:07 +09:00
|
|
|
<div v-if="showing" class="fxxzrfni _popup _shadow" :style="{ zIndex, top: top + 'px', left: left + 'px' }" @mouseover="() => { $emit('mouseover'); }" @mouseleave="() => { $emit('mouseleave'); }">
|
2020-10-17 20:12:00 +09:00
|
|
|
<div v-if="fetched" class="info">
|
|
|
|
<div class="banner" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl})` : ''"></div>
|
2021-04-17 23:52:54 +09:00
|
|
|
<MkAvatar class="avatar" :user="user" :disable-preview="true" :show-indicator="true"/>
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="title">
|
2020-10-25 01:21:41 +09:00
|
|
|
<MkA class="name" :to="userPage(user)"><MkUserName :user="user" :nowrap="false"/></MkA>
|
2020-10-17 20:12:00 +09:00
|
|
|
<p class="username"><MkAcct :user="user"/></p>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="description">
|
2020-12-19 10:55:52 +09:00
|
|
|
<Mfm v-if="user.description" :text="user.description" :author="user" :i="$i" :custom-emojis="user.emojis"/>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="status">
|
|
|
|
<div>
|
2020-12-26 10:47:36 +09:00
|
|
|
<p>{{ $ts.notes }}</p><span>{{ user.notesCount }}</span>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
|
|
|
<div>
|
2020-12-26 10:47:36 +09:00
|
|
|
<p>{{ $ts.following }}</p><span>{{ user.followingCount }}</span>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
|
|
|
<div>
|
2020-12-26 10:47:36 +09:00
|
|
|
<p>{{ $ts.followers }}</p><span>{{ user.followersCount }}</span>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
2021-11-19 19:36:12 +09:00
|
|
|
<MkFollowButton v-if="$i && user.id != $i.id" class="koudoku-button" :user="user" mini/>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
|
|
|
<div v-else>
|
|
|
|
<MkLoading/>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</transition>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 20:12:00 +09:00
|
|
|
import { defineComponent } from 'vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import * as Acct from 'misskey-js/built/acct';
|
2020-01-31 11:35:18 +09:00
|
|
|
import MkFollowButton from './follow-button.vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import { userPage } from '@/filters/user';
|
|
|
|
import * as os from '@/os';
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
export default defineComponent({
|
2020-01-30 04:37:25 +09:00
|
|
|
components: {
|
2020-01-31 11:35:18 +09:00
|
|
|
MkFollowButton
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
2020-10-17 20:12:00 +09:00
|
|
|
showing: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
q: {
|
|
|
|
type: String,
|
2020-01-30 04:37:25 +09:00
|
|
|
required: true
|
|
|
|
},
|
|
|
|
source: {
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
emits: ['closed', 'mouseover', 'mouseleave'],
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
data() {
|
|
|
|
return {
|
2020-10-17 20:12:00 +09:00
|
|
|
user: null,
|
|
|
|
fetched: false,
|
2020-01-30 04:37:25 +09:00
|
|
|
top: 0,
|
|
|
|
left: 0,
|
2021-12-18 12:14:27 +09:00
|
|
|
zIndex: os.claimZIndex('middle'),
|
2020-01-30 04:37:25 +09:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
2020-10-17 20:12:00 +09:00
|
|
|
if (typeof this.q == 'object') {
|
|
|
|
this.user = this.q;
|
|
|
|
this.fetched = true;
|
2020-01-30 04:37:25 +09:00
|
|
|
} else {
|
2020-10-17 20:12:00 +09:00
|
|
|
const query = this.q.startsWith('@') ?
|
2021-11-12 02:02:25 +09:00
|
|
|
Acct.parse(this.q.substr(1)) :
|
2020-10-17 20:12:00 +09:00
|
|
|
{ userId: this.q };
|
|
|
|
|
|
|
|
os.api('users/show', query).then(user => {
|
|
|
|
if (!this.showing) return;
|
|
|
|
this.user = user;
|
|
|
|
this.fetched = true;
|
2020-01-30 04:37:25 +09:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
const rect = this.source.getBoundingClientRect();
|
|
|
|
const x = ((rect.left + (this.source.offsetWidth / 2)) - (300 / 2)) + window.pageXOffset;
|
|
|
|
const y = rect.top + this.source.offsetHeight + window.pageYOffset;
|
|
|
|
|
|
|
|
this.top = y;
|
|
|
|
this.left = x;
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2020-10-17 20:12:00 +09:00
|
|
|
userPage
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.popup-enter-active, .popup-leave-active {
|
|
|
|
transition: opacity 0.3s, transform 0.3s !important;
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
.popup-enter-from, .popup-leave-to {
|
2020-01-30 04:37:25 +09:00
|
|
|
opacity: 0;
|
|
|
|
transform: scale(0.9);
|
|
|
|
}
|
|
|
|
|
|
|
|
.fxxzrfni {
|
|
|
|
position: absolute;
|
|
|
|
width: 300px;
|
2021-03-02 22:57:16 +09:00
|
|
|
overflow: hidden;
|
2020-10-17 20:12:00 +09:00
|
|
|
transform-origin: center top;
|
|
|
|
|
|
|
|
> .info {
|
|
|
|
> .banner {
|
|
|
|
height: 84px;
|
|
|
|
background-color: rgba(0, 0, 0, 0.1);
|
|
|
|
background-size: cover;
|
|
|
|
background-position: center;
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
> .avatar {
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
|
|
|
top: 62px;
|
|
|
|
left: 13px;
|
|
|
|
z-index: 2;
|
|
|
|
width: 58px;
|
|
|
|
height: 58px;
|
|
|
|
border: solid 3px var(--face);
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
> .title {
|
|
|
|
display: block;
|
|
|
|
padding: 8px 0 8px 82px;
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
> .name {
|
|
|
|
display: inline-block;
|
|
|
|
margin: 0;
|
|
|
|
font-weight: bold;
|
|
|
|
line-height: 16px;
|
|
|
|
word-break: break-all;
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
> .username {
|
|
|
|
display: block;
|
|
|
|
margin: 0;
|
|
|
|
line-height: 16px;
|
|
|
|
font-size: 0.8em;
|
2020-10-27 18:11:41 +09:00
|
|
|
color: var(--fg);
|
2020-10-17 20:12:00 +09:00
|
|
|
opacity: 0.7;
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
> .description {
|
|
|
|
padding: 0 16px;
|
2020-01-30 04:37:25 +09:00
|
|
|
font-size: 0.8em;
|
2020-10-27 18:11:41 +09:00
|
|
|
color: var(--fg);
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
> .status {
|
|
|
|
padding: 8px 16px;
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
> div {
|
|
|
|
display: inline-block;
|
|
|
|
width: 33%;
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
> p {
|
|
|
|
margin: 0;
|
|
|
|
font-size: 0.7em;
|
2020-10-27 18:11:41 +09:00
|
|
|
color: var(--fg);
|
2020-10-17 20:12:00 +09:00
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
> span {
|
|
|
|
font-size: 1em;
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
> .koudoku-button {
|
|
|
|
position: absolute;
|
|
|
|
top: 8px;
|
|
|
|
right: 8px;
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|