2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2023-04-08 09:01:42 +09:00
|
|
|
<transition
|
|
|
|
:name="$store.state.animation ? 'popup' : ''"
|
|
|
|
appear
|
|
|
|
@after-leave="emit('closed')"
|
|
|
|
>
|
|
|
|
<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">
|
|
|
|
<div
|
|
|
|
class="banner"
|
|
|
|
:style="
|
|
|
|
user.bannerUrl
|
|
|
|
? `background-image: url(${user.bannerUrl})`
|
|
|
|
: ''
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<span
|
|
|
|
v-if="$i && $i.id != user.id && user.isFollowed"
|
|
|
|
class="followed"
|
|
|
|
>{{ i18n.ts.followsYou }}</span
|
|
|
|
>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
2023-04-08 09:01:42 +09:00
|
|
|
<MkAvatar
|
|
|
|
class="avatar"
|
|
|
|
:user="user"
|
|
|
|
:disable-preview="true"
|
|
|
|
:show-indicator="true"
|
|
|
|
/>
|
|
|
|
<div class="title">
|
|
|
|
<MkA class="name" :to="userPage(user)"
|
|
|
|
><MkUserName :user="user" :nowrap="false"
|
|
|
|
/></MkA>
|
|
|
|
<p class="username"><MkAcct :user="user" /></p>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
2023-05-01 05:27:27 +09:00
|
|
|
<div
|
|
|
|
class="description"
|
|
|
|
:class="{ collapsed: isLong && collapsed }"
|
|
|
|
>
|
2023-04-08 09:01:42 +09:00
|
|
|
<Mfm
|
|
|
|
v-if="user.description"
|
|
|
|
:text="user.description"
|
|
|
|
:author="user"
|
|
|
|
:i="$i"
|
|
|
|
:custom-emojis="user.emojis"
|
|
|
|
/>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
2023-05-02 12:32:18 +09:00
|
|
|
<XShowMoreButton
|
|
|
|
v-if="isLong"
|
|
|
|
v-model="collapsed"
|
|
|
|
></XShowMoreButton>
|
2023-04-27 21:16:25 +09:00
|
|
|
<div v-if="user.fields.length > 0" class="fields">
|
|
|
|
<dl
|
|
|
|
v-for="(field, i) in user.fields"
|
|
|
|
:key="i"
|
|
|
|
class="field"
|
|
|
|
>
|
|
|
|
<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="$i"
|
|
|
|
:custom-emojis="user.emojis"
|
|
|
|
:colored="false"
|
|
|
|
/>
|
|
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
</div>
|
2023-04-08 09:01:42 +09:00
|
|
|
<div class="status">
|
|
|
|
<div>
|
|
|
|
<p>{{ i18n.ts.notes }}</p>
|
|
|
|
<span>{{ user.notesCount }}</span>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<p>{{ i18n.ts.following }}</p>
|
|
|
|
<span>{{ user.followingCount }}</span>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<p>{{ i18n.ts.followers }}</p>
|
|
|
|
<span>{{ user.followersCount }}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<MkFollowButton
|
|
|
|
v-if="$i && user.id != $i.id"
|
|
|
|
class="koudoku-button"
|
|
|
|
:user="user"
|
|
|
|
mini
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div v-else>
|
|
|
|
<MkLoading />
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-04-08 09:01:42 +09:00
|
|
|
</transition>
|
2020-01-30 04:37:25 +09:00
|
|
|
</template>
|
|
|
|
|
2022-09-05 18:24:46 +09:00
|
|
|
<script lang="ts" setup>
|
2023-04-08 09:01:42 +09:00
|
|
|
import { onMounted } from "vue";
|
|
|
|
import * as Acct from "calckey-js/built/acct";
|
|
|
|
import type * as misskey from "calckey-js";
|
|
|
|
import MkFollowButton from "@/components/MkFollowButton.vue";
|
|
|
|
import { userPage } from "@/filters/user";
|
2023-05-02 13:09:48 +09:00
|
|
|
import XShowMoreButton from "@/components/MkShowMoreButton.vue";
|
2023-04-08 09:01:42 +09:00
|
|
|
import * as os from "@/os";
|
|
|
|
import { $i } from "@/account";
|
|
|
|
import { i18n } from "@/i18n";
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2022-09-05 18:24:46 +09:00
|
|
|
const props = defineProps<{
|
|
|
|
showing: boolean;
|
|
|
|
q: string;
|
|
|
|
source: HTMLElement;
|
|
|
|
}>();
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2022-09-05 18:24:46 +09:00
|
|
|
const emit = defineEmits<{
|
2023-04-08 09:01:42 +09:00
|
|
|
(ev: "closed"): void;
|
|
|
|
(ev: "mouseover"): void;
|
|
|
|
(ev: "mouseleave"): void;
|
2022-09-05 18:24:46 +09:00
|
|
|
}>();
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2023-04-08 09:01:42 +09:00
|
|
|
const zIndex = os.claimZIndex("middle");
|
2022-09-05 18:24:46 +09:00
|
|
|
let user = $ref<misskey.entities.UserDetailed | null>(null);
|
|
|
|
let top = $ref(0);
|
|
|
|
let left = $ref(0);
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2023-04-27 21:16:25 +09:00
|
|
|
let isLong = $ref(false);
|
|
|
|
let collapsed = $ref(!isLong);
|
|
|
|
|
2022-09-05 18:24:46 +09:00
|
|
|
onMounted(() => {
|
2023-04-08 09:01:42 +09:00
|
|
|
if (typeof props.q === "object") {
|
2022-09-05 18:24:46 +09:00
|
|
|
user = props.q;
|
2023-05-01 05:27:27 +09:00
|
|
|
isLong =
|
|
|
|
user.description.split("\n").length > 9 ||
|
|
|
|
user.description.length > 400;
|
2022-09-05 18:24:46 +09:00
|
|
|
} else {
|
2023-04-08 09:01:42 +09:00
|
|
|
const query = props.q.startsWith("@")
|
|
|
|
? Acct.parse(props.q.substr(1))
|
|
|
|
: { userId: props.q };
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2023-04-08 09:01:42 +09:00
|
|
|
os.api("users/show", query).then((res) => {
|
2022-09-05 18:24:46 +09:00
|
|
|
if (!props.showing) return;
|
|
|
|
user = res;
|
2023-05-01 05:27:27 +09:00
|
|
|
isLong =
|
|
|
|
user.description.split("\n").length > 9 ||
|
|
|
|
user.description.length > 400;
|
2022-09-05 18:24:46 +09:00
|
|
|
});
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-09-05 18:24:46 +09:00
|
|
|
const rect = props.source.getBoundingClientRect();
|
2023-04-08 09:01:42 +09:00
|
|
|
const x =
|
|
|
|
rect.left + props.source.offsetWidth / 2 - 300 / 2 + window.pageXOffset;
|
2022-09-05 18:24:46 +09:00
|
|
|
const y = rect.top + props.source.offsetHeight + window.pageYOffset;
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2022-09-05 18:24:46 +09:00
|
|
|
top = y;
|
|
|
|
left = x;
|
2020-01-30 04:37:25 +09:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2023-04-08 09:01:42 +09:00
|
|
|
.popup-enter-active,
|
|
|
|
.popup-leave-active {
|
2020-01-30 04:37:25 +09:00
|
|
|
transition: opacity 0.3s, transform 0.3s !important;
|
|
|
|
}
|
2023-04-08 09:01:42 +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;
|
2022-11-10 07:11:22 +09:00
|
|
|
> .followed {
|
2023-04-08 09:01:42 +09:00
|
|
|
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;
|
2022-11-10 07:11:22 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
content: "";
|
|
|
|
background-image: var(--blur, inherit);
|
|
|
|
position: fixed;
|
|
|
|
inset: 0;
|
|
|
|
background-size: cover;
|
|
|
|
background-position: center;
|
|
|
|
pointer-events: none;
|
2023-04-08 09:01:42 +09:00
|
|
|
opacity: 0.1;
|
2022-11-10 07:11:22 +09:00
|
|
|
filter: var(--blur, blur(10px));
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
}
|
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);
|
2023-04-27 21:16:25 +09:00
|
|
|
&.collapsed {
|
|
|
|
position: relative;
|
|
|
|
max-height: calc(9em + 50px);
|
|
|
|
mask: linear-gradient(black calc(100% - 64px), transparent);
|
|
|
|
-webkit-mask: linear-gradient(
|
|
|
|
black calc(100% - 64px),
|
|
|
|
transparent
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
:deep(.fade) {
|
|
|
|
position: relative;
|
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
margin-top: -2.5em;
|
|
|
|
z-index: 2;
|
|
|
|
> span {
|
|
|
|
display: inline-block;
|
|
|
|
background: var(--panel);
|
|
|
|
padding: 0.4em 1em;
|
|
|
|
font-size: 0.8em;
|
|
|
|
border-radius: 999px;
|
|
|
|
box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
|
|
|
|
}
|
|
|
|
&:hover {
|
|
|
|
> span {
|
|
|
|
background: var(--panelHighlight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
:deep(.showLess) {
|
|
|
|
width: 100%;
|
|
|
|
margin-top: 1em;
|
|
|
|
position: sticky;
|
|
|
|
bottom: var(--stickyBottom);
|
|
|
|
|
|
|
|
> span {
|
|
|
|
display: inline-block;
|
|
|
|
background: var(--panel);
|
|
|
|
padding: 6px 10px;
|
|
|
|
font-size: 0.8em;
|
|
|
|
border-radius: 999px;
|
|
|
|
box-shadow: 0 0 7px 7px var(--bg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .fields {
|
|
|
|
padding: 0 16px;
|
2023-05-01 05:27:27 +09:00
|
|
|
font-size: 0.8em;
|
2023-04-27 21:16:25 +09:00
|
|
|
margin-top: 1em;
|
|
|
|
|
|
|
|
> .field {
|
|
|
|
display: flex;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
&:not(:last-child) {
|
|
|
|
margin-bottom: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
:deep(span) {
|
|
|
|
white-space: nowrap !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .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;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
}
|
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);
|
2023-05-23 10:16:55 +09:00
|
|
|
:deep(span) {
|
2023-04-27 21:16:25 +09:00
|
|
|
white-space: nowrap;
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
}
|
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>
|