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>
|
2024-01-30 11:53:53 +01: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 10:55:38 +02:00
|
|
|
</div>
|
2024-01-30 11:53:53 +01:00
|
|
|
<MkMiniChart v-if="chartValues" :class="$style.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-12-07 06:42:09 +01:00
|
|
|
import { onMounted, ref } from 'vue';
|
2022-08-30 17:24:33 +02:00
|
|
|
import MkMiniChart from '@/components/MkMiniChart.vue';
|
2024-01-04 10:32:46 +01:00
|
|
|
import { misskeyApiGet } from '@/scripts/misskey-api.js';
|
2023-09-19 09:37:43 +02:00
|
|
|
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
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const 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) {
|
2024-01-04 10:32:46 +01:00
|
|
|
misskeyApiGet('charts/user/notes', { userId: props.user.id, limit: 16 + 1, span: 'day' }).then(res => {
|
2023-01-19 02:29:30 +01:00
|
|
|
// 今日のぶんの値はまだ途中の値であり、それも含めると大抵の場合前日よりも下降しているようなグラフになってしまうため今日は弾く
|
|
|
|
res.inc.splice(0, 1);
|
2023-12-07 06:42:09 +01:00
|
|
|
chartValues.value = res.inc;
|
2023-01-19 02:29:30 +01:00
|
|
|
});
|
|
|
|
}
|
2022-06-21 10:55:38 +02:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
2024-01-30 11:53:53 +01:00
|
|
|
$bodyTitleHieght: 18px;
|
|
|
|
$bodyInfoHieght: 16px;
|
2022-06-21 10:55:38 +02:00
|
|
|
|
2024-01-30 11:53:53 +01:00
|
|
|
.root {
|
2022-06-21 10:55:38 +02:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 16px;
|
|
|
|
background: var(--panel);
|
2023-10-31 19:44:34 +01:00
|
|
|
border-radius: var(--radius-sm);
|
2024-01-30 11:53:53 +01:00
|
|
|
}
|
2022-06-21 10:55:38 +02:00
|
|
|
|
2024-01-30 11:53:53 +01:00
|
|
|
.avatar {
|
|
|
|
display: block;
|
|
|
|
width: ($bodyTitleHieght + $bodyInfoHieght);
|
|
|
|
height: ($bodyTitleHieght + $bodyInfoHieght);
|
|
|
|
margin-right: 12px;
|
|
|
|
}
|
2022-06-21 10:55:38 +02:00
|
|
|
|
2024-01-30 11:53:53 +01:00
|
|
|
.body {
|
|
|
|
flex: 1;
|
|
|
|
overflow: hidden;
|
|
|
|
font-size: 0.9em;
|
|
|
|
color: var(--fg);
|
|
|
|
padding-right: 8px;
|
|
|
|
}
|
2022-06-21 10:55:38 +02:00
|
|
|
|
2024-01-30 11:53:53 +01:00
|
|
|
.name {
|
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
line-height: $bodyTitleHieght;
|
|
|
|
}
|
2023-10-18 23:30:44 +02:00
|
|
|
|
2024-01-30 11:53:53 +01: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 10:55:38 +02:00
|
|
|
|
2024-01-30 11:53:53 +01:00
|
|
|
.chart {
|
|
|
|
height: 30px;
|
2022-06-21 10:55:38 +02:00
|
|
|
}
|
|
|
|
</style>
|