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