2023-07-27 08:31:52 +03:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2022-06-21 11:55:38 +03:00
|
|
|
<template>
|
2024-01-30 12:53:53 +02:00
|
|
|
<div v-adaptive-bg :class="[$style.root]">
|
|
|
|
<MkAvatar :class="$style.avatar" :user="user" indicator/>
|
|
|
|
<div :class="$style.body">
|
|
|
|
<span :class="$style.name"><MkUserName :user="user"/></span>
|
|
|
|
<span :class="$style.sub"><span class="_monospace">@{{ acct(user) }}</span></span>
|
2022-06-21 11:55:38 +03:00
|
|
|
</div>
|
2024-01-30 12:53:53 +02:00
|
|
|
<MkMiniChart v-if="chartValues" :class="$style.chart" :src="chartValues"/>
|
2022-06-21 11:55:38 +03:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-09-04 07:33:38 +03:00
|
|
|
import * as Misskey from 'misskey-js';
|
2023-12-07 07:42:09 +02:00
|
|
|
import { onMounted, ref } from 'vue';
|
2022-08-30 18:24:33 +03:00
|
|
|
import MkMiniChart from '@/components/MkMiniChart.vue';
|
2024-01-04 11:32:46 +02:00
|
|
|
import { misskeyApiGet } from '@/scripts/misskey-api.js';
|
2023-09-19 10:37:43 +03:00
|
|
|
import { acct } from '@/filters/user.js';
|
2022-06-21 11:55:38 +03:00
|
|
|
|
2023-01-19 03:29:30 +02:00
|
|
|
const props = withDefaults(defineProps<{
|
2023-09-04 07:33:38 +03:00
|
|
|
user: Misskey.entities.User;
|
2023-01-19 03:29:30 +02:00
|
|
|
withChart: boolean;
|
|
|
|
}>(), {
|
|
|
|
withChart: true,
|
|
|
|
});
|
2022-06-21 11:55:38 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const chartValues = ref<number[] | null>(null);
|
2022-06-21 11:55:38 +03:00
|
|
|
|
2023-01-19 03:29:30 +02:00
|
|
|
onMounted(() => {
|
|
|
|
if (props.withChart) {
|
2024-01-04 11:32:46 +02:00
|
|
|
misskeyApiGet('charts/user/notes', { userId: props.user.id, limit: 16 + 1, span: 'day' }).then(res => {
|
2023-01-19 03:29:30 +02:00
|
|
|
// 今日のぶんの値はまだ途中の値であり、それも含めると大抵の場合前日よりも下降しているようなグラフになってしまうため今日は弾く
|
|
|
|
res.inc.splice(0, 1);
|
2023-12-07 07:42:09 +02:00
|
|
|
chartValues.value = res.inc;
|
2023-01-19 03:29:30 +02:00
|
|
|
});
|
|
|
|
}
|
2022-06-21 11:55:38 +03:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
2024-01-30 12:53:53 +02:00
|
|
|
$bodyTitleHieght: 18px;
|
|
|
|
$bodyInfoHieght: 16px;
|
2022-06-21 11:55:38 +03:00
|
|
|
|
2024-01-30 12:53:53 +02:00
|
|
|
.root {
|
2022-06-21 11:55:38 +03:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 16px;
|
|
|
|
background: var(--panel);
|
|
|
|
border-radius: 8px;
|
2024-01-30 12:53:53 +02:00
|
|
|
}
|
2022-06-21 11:55:38 +03:00
|
|
|
|
2024-01-30 12:53:53 +02:00
|
|
|
.avatar {
|
|
|
|
display: block;
|
|
|
|
width: ($bodyTitleHieght + $bodyInfoHieght);
|
|
|
|
height: ($bodyTitleHieght + $bodyInfoHieght);
|
|
|
|
margin-right: 12px;
|
|
|
|
}
|
2022-06-21 11:55:38 +03:00
|
|
|
|
2024-01-30 12:53:53 +02:00
|
|
|
.body {
|
|
|
|
flex: 1;
|
|
|
|
overflow: hidden;
|
|
|
|
font-size: 0.9em;
|
|
|
|
color: var(--fg);
|
|
|
|
padding-right: 8px;
|
|
|
|
}
|
2022-06-21 11:55:38 +03:00
|
|
|
|
2024-01-30 12:53:53 +02:00
|
|
|
.name {
|
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
line-height: $bodyTitleHieght;
|
|
|
|
}
|
2022-06-21 11:55:38 +03:00
|
|
|
|
2024-01-30 12:53:53 +02:00
|
|
|
.sub {
|
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
font-size: 95%;
|
|
|
|
opacity: 0.7;
|
|
|
|
line-height: $bodyInfoHieght;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
2022-06-21 11:55:38 +03:00
|
|
|
|
2024-01-30 12:53:53 +02:00
|
|
|
.chart {
|
|
|
|
height: 30px;
|
2022-06-21 11:55:38 +03:00
|
|
|
}
|
|
|
|
</style>
|