2020-01-29 19:37:25 +00:00
|
|
|
<template>
|
2022-12-30 04:37:14 +00:00
|
|
|
<Transition :name="$store.state.animation ? 'popup' : ''" appear @after-leave="emit('closed')">
|
2022-09-05 09:24:46 +00:00
|
|
|
<div v-if="showing" class="fxxzrfni _popup _shadow" :style="{ zIndex, top: top + 'px', left: left + 'px' }" @mouseover="() => { emit('mouseover'); }" @mouseleave="() => { emit('mouseleave'); }">
|
|
|
|
<div v-if="user != null" class="info">
|
2022-08-13 05:26:51 +00:00
|
|
|
<div class="banner" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl})` : ''">
|
|
|
|
<span v-if="$i && $i.id != user.id && user.isFollowed" class="followed">{{ $ts.followsYou }}</span>
|
|
|
|
</div>
|
2023-01-16 05:18:11 +00:00
|
|
|
<MkAvatar class="avatar" :user="user" indicator/>
|
2020-10-17 11:12:00 +00:00
|
|
|
<div class="title">
|
2023-02-08 11:07:19 +00:00
|
|
|
<MkA class="name" :to="userPage(user)"><MkUserName :user="user" :nowrap="false"/></MkA>
|
2020-10-17 11:12:00 +00:00
|
|
|
<p class="username"><MkAcct :user="user"/></p>
|
2020-01-29 19:37:25 +00:00
|
|
|
</div>
|
2020-10-17 11:12:00 +00:00
|
|
|
<div class="description">
|
2022-12-29 01:14:44 +00:00
|
|
|
<Mfm v-if="user.description" :text="user.description" :author="user" :i="$i"/>
|
2020-01-29 19:37:25 +00:00
|
|
|
</div>
|
2020-10-17 11:12:00 +00:00
|
|
|
<div class="status">
|
|
|
|
<div>
|
2020-12-26 01:47:36 +00:00
|
|
|
<p>{{ $ts.notes }}</p><span>{{ user.notesCount }}</span>
|
2020-10-17 11:12:00 +00:00
|
|
|
</div>
|
|
|
|
<div>
|
2020-12-26 01:47:36 +00:00
|
|
|
<p>{{ $ts.following }}</p><span>{{ user.followingCount }}</span>
|
2020-10-17 11:12:00 +00:00
|
|
|
</div>
|
|
|
|
<div>
|
2020-12-26 01:47:36 +00:00
|
|
|
<p>{{ $ts.followers }}</p><span>{{ user.followersCount }}</span>
|
2020-10-17 11:12:00 +00:00
|
|
|
</div>
|
2020-01-29 19:37:25 +00:00
|
|
|
</div>
|
2023-02-11 03:55:22 +00:00
|
|
|
<button class="menu _button" @click="showMenu"><i class="ti ti-dots"></i></button>
|
2021-11-19 10:36:12 +00:00
|
|
|
<MkFollowButton v-if="$i && user.id != $i.id" class="koudoku-button" :user="user" mini/>
|
2020-10-17 11:12:00 +00:00
|
|
|
</div>
|
|
|
|
<div v-else>
|
|
|
|
<MkLoading/>
|
2020-01-29 19:37:25 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-12-30 04:37:14 +00:00
|
|
|
</Transition>
|
2020-01-29 19:37:25 +00:00
|
|
|
</template>
|
|
|
|
|
2022-09-05 09:24:46 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { onMounted } from 'vue';
|
2021-11-11 17:02:25 +00:00
|
|
|
import * as Acct from 'misskey-js/built/acct';
|
2022-09-05 09:24:46 +00:00
|
|
|
import * as misskey from 'misskey-js';
|
2022-08-30 15:24:33 +00:00
|
|
|
import MkFollowButton from '@/components/MkFollowButton.vue';
|
2021-11-11 17:02:25 +00:00
|
|
|
import { userPage } from '@/filters/user';
|
|
|
|
import * as os from '@/os';
|
2023-02-11 03:55:22 +00:00
|
|
|
import { getUserMenu } from '@/scripts/get-user-menu';
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2022-09-05 09:24:46 +00:00
|
|
|
const props = defineProps<{
|
|
|
|
showing: boolean;
|
|
|
|
q: string;
|
|
|
|
source: HTMLElement;
|
|
|
|
}>();
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2022-09-05 09:24:46 +00:00
|
|
|
const emit = defineEmits<{
|
|
|
|
(ev: 'closed'): void;
|
|
|
|
(ev: 'mouseover'): void;
|
|
|
|
(ev: 'mouseleave'): void;
|
|
|
|
}>();
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2022-09-05 09:24:46 +00:00
|
|
|
const zIndex = os.claimZIndex('middle');
|
|
|
|
let user = $ref<misskey.entities.UserDetailed | null>(null);
|
|
|
|
let top = $ref(0);
|
|
|
|
let left = $ref(0);
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2023-02-11 03:55:22 +00:00
|
|
|
function showMenu(ev: MouseEvent) {
|
|
|
|
os.popupMenu(getUserMenu(user), ev.currentTarget ?? ev.target);
|
|
|
|
}
|
|
|
|
|
2022-09-05 09:24:46 +00:00
|
|
|
onMounted(() => {
|
|
|
|
if (typeof props.q === 'object') {
|
|
|
|
user = props.q;
|
|
|
|
} else {
|
|
|
|
const query = props.q.startsWith('@') ?
|
|
|
|
Acct.parse(props.q.substr(1)) :
|
|
|
|
{ userId: props.q };
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2022-09-05 09:24:46 +00:00
|
|
|
os.api('users/show', query).then(res => {
|
|
|
|
if (!props.showing) return;
|
|
|
|
user = res;
|
|
|
|
});
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-09-05 09:24:46 +00:00
|
|
|
const rect = props.source.getBoundingClientRect();
|
|
|
|
const x = ((rect.left + (props.source.offsetWidth / 2)) - (300 / 2)) + window.pageXOffset;
|
|
|
|
const y = rect.top + props.source.offsetHeight + window.pageYOffset;
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2022-09-05 09:24:46 +00:00
|
|
|
top = y;
|
|
|
|
left = x;
|
2020-01-29 19:37:25 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.popup-enter-active, .popup-leave-active {
|
2023-02-12 05:31:00 +00:00
|
|
|
transition: opacity 0.15s, transform 0.15s !important;
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
.popup-enter-from, .popup-leave-to {
|
2020-01-29 19:37:25 +00:00
|
|
|
opacity: 0;
|
|
|
|
transform: scale(0.9);
|
|
|
|
}
|
|
|
|
|
|
|
|
.fxxzrfni {
|
|
|
|
position: absolute;
|
|
|
|
width: 300px;
|
2021-03-02 13:57:16 +00:00
|
|
|
overflow: hidden;
|
2020-10-17 11:12:00 +00:00
|
|
|
transform-origin: center top;
|
|
|
|
|
|
|
|
> .info {
|
|
|
|
> .banner {
|
|
|
|
height: 84px;
|
|
|
|
background-color: rgba(0, 0, 0, 0.1);
|
|
|
|
background-size: cover;
|
|
|
|
background-position: center;
|
2022-08-13 05:26:51 +00:00
|
|
|
> .followed {
|
|
|
|
position: absolute;
|
|
|
|
top: 12px;
|
|
|
|
left: 12px;
|
|
|
|
padding: 4px 8px;
|
|
|
|
color: #fff;
|
|
|
|
background: rgba(0, 0, 0, 0.7);
|
|
|
|
font-size: 0.7em;
|
|
|
|
border-radius: 6px;
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00: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-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
> .title {
|
|
|
|
display: block;
|
|
|
|
padding: 8px 0 8px 82px;
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
> .name {
|
|
|
|
display: inline-block;
|
|
|
|
margin: 0;
|
|
|
|
font-weight: bold;
|
|
|
|
line-height: 16px;
|
|
|
|
word-break: break-all;
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
> .username {
|
|
|
|
display: block;
|
|
|
|
margin: 0;
|
|
|
|
line-height: 16px;
|
|
|
|
font-size: 0.8em;
|
2020-10-27 09:11:41 +00:00
|
|
|
color: var(--fg);
|
2020-10-17 11:12:00 +00:00
|
|
|
opacity: 0.7;
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
> .description {
|
|
|
|
padding: 0 16px;
|
2020-01-29 19:37:25 +00:00
|
|
|
font-size: 0.8em;
|
2020-10-27 09:11:41 +00:00
|
|
|
color: var(--fg);
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
> .status {
|
|
|
|
padding: 8px 16px;
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
> div {
|
|
|
|
display: inline-block;
|
|
|
|
width: 33%;
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
> p {
|
|
|
|
margin: 0;
|
|
|
|
font-size: 0.7em;
|
2020-10-27 09:11:41 +00:00
|
|
|
color: var(--fg);
|
2020-10-17 11:12:00 +00:00
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
> span {
|
|
|
|
font-size: 1em;
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-11 03:55:22 +00:00
|
|
|
> .menu {
|
|
|
|
position: absolute;
|
|
|
|
top: 8px;
|
2023-02-12 05:25:34 +00:00
|
|
|
right: 44px;
|
|
|
|
padding: 6px;
|
|
|
|
background: var(--panel);
|
|
|
|
border-radius: 999px;
|
2023-02-11 03:55:22 +00:00
|
|
|
}
|
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
> .koudoku-button {
|
|
|
|
position: absolute;
|
|
|
|
top: 8px;
|
|
|
|
right: 8px;
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|