2022-06-21 10:55:38 +02:00
|
|
|
<template>
|
2023-05-19 20:45:29 +02:00
|
|
|
<MkA
|
2023-05-19 19:02:41 +02:00
|
|
|
class="user-card-mini"
|
2023-04-08 02:01:42 +02:00
|
|
|
:class="[
|
|
|
|
$style.root,
|
|
|
|
{ yellow: user.isSilenced, red: user.isSuspended, gray: false },
|
|
|
|
]"
|
2023-07-25 01:55:57 +02:00
|
|
|
:to="props.showAboutPage ? `/user-info/${user.id}` : userPage(user)"
|
2023-04-08 02:01:42 +02:00
|
|
|
>
|
|
|
|
<MkAvatar
|
|
|
|
class="avatar"
|
|
|
|
:user="user"
|
|
|
|
:disable-link="true"
|
|
|
|
:show-indicator="true"
|
|
|
|
/>
|
|
|
|
<div class="body">
|
|
|
|
<span class="name"><MkUserName class="name" :user="user" /></span>
|
|
|
|
<span class="sub"
|
|
|
|
><span class="acct _monospace">@{{ acct(user) }}</span></span
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
<MkMiniChart v-if="chartValues" class="chart" :src="chartValues" />
|
2023-05-19 20:45:29 +02:00
|
|
|
</MkA>
|
2022-06-21 10:55:38 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-07-03 00:18:30 +02:00
|
|
|
import * as misskey from "firefish-js";
|
2023-04-08 02:01:42 +02:00
|
|
|
import MkMiniChart from "@/components/MkMiniChart.vue";
|
|
|
|
import * as os from "@/os";
|
2023-05-19 20:45:29 +02:00
|
|
|
import { acct, userPage } from "@/filters/user";
|
2022-06-21 10:55:38 +02:00
|
|
|
|
2023-05-20 00:41:59 +02:00
|
|
|
const props = withDefaults(
|
|
|
|
defineProps<{
|
2023-05-19 20:28:36 +02:00
|
|
|
user: misskey.entities.User;
|
|
|
|
withChart?: boolean;
|
2023-07-25 01:55:57 +02:00
|
|
|
showAboutPage?: boolean;
|
2023-05-19 20:28:36 +02:00
|
|
|
}>(),
|
|
|
|
{
|
|
|
|
withChart: true,
|
2023-07-25 01:55:57 +02:00
|
|
|
showAboutPage: false,
|
2023-07-06 03:28:27 +02:00
|
|
|
},
|
2023-05-19 20:28:36 +02:00
|
|
|
);
|
2022-06-21 10:55:38 +02:00
|
|
|
|
2022-06-26 08:55:51 +02:00
|
|
|
let chartValues = $ref<number[] | null>(null);
|
2022-06-21 10:55:38 +02:00
|
|
|
|
2023-05-19 20:28:36 +02:00
|
|
|
if (props.withChart) {
|
|
|
|
os.apiGet("charts/user/notes", {
|
|
|
|
userId: props.user.id,
|
|
|
|
limit: 16 + 1,
|
|
|
|
span: "day",
|
|
|
|
}).then((res) => {
|
|
|
|
// 今日のぶんの値はまだ途中の値であり、それも含めると大抵の場合前日よりも下降しているようなグラフになってしまうため今日は弾く
|
|
|
|
res.inc.splice(0, 1);
|
|
|
|
chartValues = res.inc;
|
|
|
|
});
|
|
|
|
}
|
2022-06-21 10:55:38 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
|
|
|
$bodyTitleHieght: 18px;
|
|
|
|
$bodyInfoHieght: 16px;
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 16px;
|
|
|
|
background: var(--panel);
|
|
|
|
border-radius: 8px;
|
2023-05-20 00:41:59 +02:00
|
|
|
transition: background 0.2s;
|
2022-06-21 10:55:38 +02:00
|
|
|
|
2022-06-22 16:40:53 +02:00
|
|
|
> :global(.avatar) {
|
2022-06-21 10:55:38 +02:00
|
|
|
display: block;
|
|
|
|
width: ($bodyTitleHieght + $bodyInfoHieght);
|
|
|
|
height: ($bodyTitleHieght + $bodyInfoHieght);
|
2022-06-22 16:40:53 +02:00
|
|
|
margin-right: 12px;
|
2022-06-21 10:55:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
> :global(.body) {
|
|
|
|
flex: 1;
|
|
|
|
overflow: hidden;
|
|
|
|
font-size: 0.9em;
|
|
|
|
color: var(--fg);
|
|
|
|
padding-right: 8px;
|
|
|
|
|
2022-06-22 16:40:53 +02:00
|
|
|
> :global(.name) {
|
2022-06-21 10:55:38 +02:00
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
line-height: $bodyTitleHieght;
|
|
|
|
}
|
|
|
|
|
|
|
|
> :global(.sub) {
|
2022-06-23 06:39:28 +02:00
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
font-size: 95%;
|
2022-06-21 10:55:38 +02:00
|
|
|
opacity: 0.7;
|
|
|
|
line-height: $bodyInfoHieght;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
2023-07-25 01:55:57 +02:00
|
|
|
|
|
|
|
// > :global(.moderation) {
|
|
|
|
// display: flex;
|
|
|
|
// gap: 1rem;
|
|
|
|
// margin-right: 1rem;
|
|
|
|
// }
|
2022-06-21 10:55:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
> :global(.chart) {
|
|
|
|
height: 30px;
|
|
|
|
}
|
|
|
|
|
2023-05-20 00:41:59 +02:00
|
|
|
&:hover,
|
|
|
|
&:focus {
|
2023-05-19 20:45:29 +02:00
|
|
|
background: var(--panelHighlight);
|
|
|
|
}
|
|
|
|
|
2022-06-21 10:55:38 +02:00
|
|
|
&:global(.yellow) {
|
|
|
|
--c: rgb(255 196 0 / 15%);
|
2023-04-08 02:01:42 +02:00
|
|
|
background-image: linear-gradient(
|
|
|
|
45deg,
|
|
|
|
var(--c) 16.67%,
|
|
|
|
transparent 16.67%,
|
|
|
|
transparent 50%,
|
|
|
|
var(--c) 50%,
|
|
|
|
var(--c) 66.67%,
|
|
|
|
transparent 66.67%,
|
|
|
|
transparent 100%
|
|
|
|
);
|
2022-06-21 10:55:38 +02:00
|
|
|
background-size: 16px 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:global(.red) {
|
|
|
|
--c: rgb(255 0 0 / 15%);
|
2023-04-08 02:01:42 +02:00
|
|
|
background-image: linear-gradient(
|
|
|
|
45deg,
|
|
|
|
var(--c) 16.67%,
|
|
|
|
transparent 16.67%,
|
|
|
|
transparent 50%,
|
|
|
|
var(--c) 50%,
|
|
|
|
var(--c) 66.67%,
|
|
|
|
transparent 66.67%,
|
|
|
|
transparent 100%
|
|
|
|
);
|
2022-06-21 10:55:38 +02:00
|
|
|
background-size: 16px 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:global(.gray) {
|
|
|
|
--c: var(--bg);
|
2023-04-08 02:01:42 +02:00
|
|
|
background-image: linear-gradient(
|
|
|
|
45deg,
|
|
|
|
var(--c) 16.67%,
|
|
|
|
transparent 16.67%,
|
|
|
|
transparent 50%,
|
|
|
|
var(--c) 50%,
|
|
|
|
var(--c) 66.67%,
|
|
|
|
transparent 66.67%,
|
|
|
|
transparent 100%
|
|
|
|
);
|
2022-06-21 10:55:38 +02:00
|
|
|
background-size: 16px 16px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|