From 848739ed844dd6c5cd935202b91dee500e3a1fd6 Mon Sep 17 00:00:00 2001 From: Freeplay Date: Fri, 19 May 2023 14:28:36 -0400 Subject: [PATCH] add withChart prop to UserCardMini --- .../client/src/components/MkUserCardMini.vue | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/packages/client/src/components/MkUserCardMini.vue b/packages/client/src/components/MkUserCardMini.vue index 02c22b523..27b3e939f 100644 --- a/packages/client/src/components/MkUserCardMini.vue +++ b/packages/client/src/components/MkUserCardMini.vue @@ -28,21 +28,28 @@ import MkMiniChart from "@/components/MkMiniChart.vue"; import * as os from "@/os"; import { acct } from "@/filters/user"; -const props = defineProps<{ - user: misskey.entities.User; -}>(); +const props = withDefaults(defineProps<{ + user: misskey.entities.User; + withChart?: boolean; + }>(), + { + withChart: true, + } +); let chartValues = $ref(null); -os.apiGet("charts/user/notes", { - userId: props.user.id, - limit: 16 + 1, - span: "day", -}).then((res) => { - // 今日のぶんの値はまだ途中の値であり、それも含めると大抵の場合前日よりも下降しているようなグラフになってしまうため今日は弾く - res.inc.splice(0, 1); - chartValues = res.inc; -}); +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; + }); +}