2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2018-12-12 05:06:05 +01:00
|
|
|
<template>
|
2023-11-28 03:03:13 +01:00
|
|
|
<MkA v-user-preview="canonical" :class="[$style.root, { [$style.isMe]: isMe }]" :to="url" :style="{ background: bgCss }">
|
2023-10-21 06:31:16 +02:00
|
|
|
<img :class="$style.icon" :src="avatarUrl" alt="">
|
2023-01-14 12:31:48 +01:00
|
|
|
<span>
|
2023-06-01 10:19:46 +02:00
|
|
|
<span>@{{ username }}</span>
|
2023-04-01 06:42:40 +02:00
|
|
|
<span v-if="(host != localHost) || defaultStore.state.showFullAcct" :class="$style.host">@{{ toUnicode(host) }}</span>
|
2018-12-12 05:06:05 +01:00
|
|
|
</span>
|
2020-10-24 18:21:41 +02:00
|
|
|
</MkA>
|
2018-12-12 05:06:05 +01:00
|
|
|
</template>
|
|
|
|
|
2022-06-24 03:34:36 +02:00
|
|
|
<script lang="ts" setup>
|
2021-10-31 12:19:49 +01:00
|
|
|
import { toUnicode } from 'punycode';
|
2023-10-21 06:31:16 +02:00
|
|
|
import { computed } from 'vue';
|
2022-06-24 03:34:36 +02:00
|
|
|
import tinycolor from 'tinycolor2';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { host as localHost } from '@/config.js';
|
|
|
|
import { $i } from '@/account.js';
|
|
|
|
import { defaultStore } from '@/store.js';
|
2023-10-21 06:31:16 +02:00
|
|
|
import { getStaticImageUrl } from '@/scripts/media-proxy.js';
|
2018-12-12 05:06:05 +01:00
|
|
|
|
2022-06-24 03:34:36 +02:00
|
|
|
const props = defineProps<{
|
|
|
|
username: string;
|
|
|
|
host: string;
|
2023-11-28 03:01:37 +01:00
|
|
|
first?: boolean;
|
2022-06-24 03:34:36 +02:00
|
|
|
}>();
|
2021-10-31 12:19:49 +01:00
|
|
|
|
2022-06-24 03:34:36 +02:00
|
|
|
const canonical = props.host === localHost ? `@${props.username}` : `@${props.username}@${toUnicode(props.host)}`;
|
2021-10-31 12:19:49 +01:00
|
|
|
|
2022-06-24 03:34:36 +02:00
|
|
|
const url = `/${canonical}`;
|
2021-10-31 12:19:49 +01:00
|
|
|
|
2022-06-24 03:34:36 +02:00
|
|
|
const isMe = $i && (
|
|
|
|
`@${props.username}@${toUnicode(props.host)}` === `@${$i.username}@${toUnicode(localHost)}`.toLowerCase()
|
|
|
|
);
|
2021-10-31 12:19:49 +01:00
|
|
|
|
2022-06-24 03:34:36 +02:00
|
|
|
const bg = tinycolor(getComputedStyle(document.documentElement).getPropertyValue(isMe ? '--mentionMe' : '--mention'));
|
|
|
|
bg.setAlpha(0.1);
|
|
|
|
const bgCss = bg.toRgbString();
|
2023-10-21 06:31:16 +02:00
|
|
|
|
|
|
|
const avatarUrl = computed(() => defaultStore.state.disableShowingAnimatedImages
|
|
|
|
? getStaticImageUrl(`/avatar/@${props.username}@${props.host}`)
|
|
|
|
: `/avatar/@${props.username}@${props.host}`,
|
|
|
|
);
|
2018-12-12 05:06:05 +01:00
|
|
|
</script>
|
|
|
|
|
2023-01-14 12:31:48 +01:00
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2021-10-31 12:19:49 +01:00
|
|
|
display: inline-block;
|
|
|
|
padding: 4px 8px 4px 4px;
|
2023-10-31 19:44:34 +01:00
|
|
|
border-radius: var(--radius-ellipse);
|
2020-01-29 20:37:25 +01:00
|
|
|
color: var(--mention);
|
2020-06-04 15:19:08 +02:00
|
|
|
|
|
|
|
&.isMe {
|
|
|
|
color: var(--mentionMe);
|
|
|
|
}
|
2023-01-14 12:31:48 +01:00
|
|
|
}
|
2018-12-12 05:06:05 +01:00
|
|
|
|
2023-11-28 03:01:37 +01:00
|
|
|
.root + .root {
|
|
|
|
position: relative;
|
|
|
|
margin-inline: -20px 0;
|
|
|
|
box-shadow: -4px 0 0 var(--panel), -15px 0 15px var(--panel);
|
|
|
|
overflow: clip;
|
|
|
|
isolation: isolate;
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
content: "";
|
|
|
|
position: absolute;
|
|
|
|
inset: 0;
|
|
|
|
background: var(--panel);
|
|
|
|
z-index: -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
content: "";
|
|
|
|
position: absolute;
|
|
|
|
inset: 0;
|
|
|
|
background: var(--panel);
|
|
|
|
z-index: -1;
|
|
|
|
background: inherit;
|
|
|
|
}
|
|
|
|
|
|
|
|
span {
|
|
|
|
display: inline-block;
|
|
|
|
white-space: nowrap;
|
|
|
|
max-width: 3em;
|
|
|
|
mask: linear-gradient(to right, #000 20%, rgba(0, 0, 0, 0.4));
|
|
|
|
}
|
|
|
|
|
|
|
|
+ .root {
|
|
|
|
margin-inline: -10px 0;
|
|
|
|
padding-inline-end: 0;
|
|
|
|
box-shadow: -4px 0 0 var(--panel);
|
|
|
|
|
|
|
|
span {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-14 12:31:48 +01:00
|
|
|
.icon {
|
|
|
|
width: 1.5em;
|
|
|
|
height: 1.5em;
|
|
|
|
object-fit: cover;
|
|
|
|
margin: 0 0.2em 0 0;
|
|
|
|
vertical-align: bottom;
|
2023-10-31 19:44:34 +01:00
|
|
|
border-radius: var(--radius-full);
|
2023-01-14 12:31:48 +01:00
|
|
|
}
|
2021-10-24 14:02:50 +02:00
|
|
|
|
2023-01-14 12:31:48 +01:00
|
|
|
.host {
|
|
|
|
opacity: 0.5;
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
2018-12-12 05:06:05 +01:00
|
|
|
</style>
|