2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2022-06-21 10:55:38 +02:00
|
|
|
<template>
|
2023-01-12 13:02:26 +01:00
|
|
|
<div v-adaptive-bg :class="[$style.root, { yellow: user.isSilenced, red: user.isSuspended, gray: false }]">
|
2023-01-16 06:18:11 +01:00
|
|
|
<MkAvatar class="avatar" :user="user" indicator/>
|
2022-06-21 10:55:38 +02:00
|
|
|
<div class="body">
|
2023-02-08 12:07:19 +01:00
|
|
|
<span class="name"><MkUserName class="name" :user="user"/></span>
|
2022-06-22 16:40:53 +02:00
|
|
|
<span class="sub"><span class="acct _monospace">@{{ acct(user) }}</span></span>
|
2022-06-21 10:55:38 +02:00
|
|
|
</div>
|
2022-06-26 08:54:07 +02:00
|
|
|
<MkMiniChart v-if="chartValues" class="chart" :src="chartValues"/>
|
2022-06-21 10:55:38 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-09-04 06:33:38 +02:00
|
|
|
import * as Misskey from 'misskey-js';
|
2023-01-19 02:29:30 +01:00
|
|
|
import { onMounted } from 'vue';
|
2022-08-30 17:24:33 +02:00
|
|
|
import MkMiniChart from '@/components/MkMiniChart.vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { acct } from '@/filters/user.js';
|
2022-06-21 10:55:38 +02:00
|
|
|
|
2023-01-19 02:29:30 +01:00
|
|
|
const props = withDefaults(defineProps<{
|
2023-09-04 06:33:38 +02:00
|
|
|
user: Misskey.entities.User;
|
2023-01-19 02:29:30 +01:00
|
|
|
withChart: boolean;
|
|
|
|
}>(), {
|
|
|
|
withChart: true,
|
|
|
|
});
|
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-01-19 02:29:30 +01:00
|
|
|
onMounted(() => {
|
|
|
|
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);
|
2023-10-01 01:20:20 +02:00
|
|
|
border-radius: 5px;
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> :global(.chart) {
|
|
|
|
height: 30px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:global(.yellow) {
|
|
|
|
--c: rgb(255 196 0 / 15%);
|
|
|
|
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%);
|
|
|
|
background-size: 16px 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:global(.red) {
|
|
|
|
--c: rgb(255 0 0 / 15%);
|
|
|
|
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%);
|
|
|
|
background-size: 16px 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:global(.gray) {
|
|
|
|
--c: var(--bg);
|
|
|
|
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%);
|
|
|
|
background-size: 16px 16px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|