fix vue errors in overview.stats.vue

This commit is contained in:
Hazelnoot 2025-04-02 21:27:23 -04:00
parent d7784ea4ff
commit 022a9c7676

View file

@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<div> <div>
<Transition :name="prefer.s.animation ? '_transition_zoom' : ''" mode="out-in"> <Transition :name="prefer.s.animation ? '_transition_zoom' : ''" mode="out-in">
<MkLoading v-if="fetching"/> <MkLoading v-if="fetching || !stats"/>
<div v-else :class="$style.root"> <div v-else :class="$style.root">
<div class="item _panel users"> <div class="item _panel users">
<div class="icon"><i class="ti ti-users"></i></div> <div class="icon"><i class="ti ti-users"></i></div>
@ -71,8 +71,8 @@ import { customEmojis } from '@/custom-emojis.js';
import { prefer } from '@/preferences.js'; import { prefer } from '@/preferences.js';
const stats = ref<Misskey.entities.StatsResponse | null>(null); const stats = ref<Misskey.entities.StatsResponse | null>(null);
const usersComparedToThePrevDay = ref<number>(); const usersComparedToThePrevDay = ref<number>(0);
const notesComparedToThePrevDay = ref<number>(); const notesComparedToThePrevDay = ref<number>(0);
const onlineUsersCount = ref(0); const onlineUsersCount = ref(0);
const fetching = ref(true); const fetching = ref(true);
@ -85,11 +85,11 @@ onMounted(async () => {
onlineUsersCount.value = _onlineUsersCount; onlineUsersCount.value = _onlineUsersCount;
misskeyApiGet('charts/users', { limit: 2, span: 'day' }).then(chart => { misskeyApiGet('charts/users', { limit: 2, span: 'day' }).then(chart => {
usersComparedToThePrevDay.value = stats.value.originalUsersCount - chart.local.total[1]; usersComparedToThePrevDay.value = _stats.originalUsersCount - chart.local.total[1];
}); });
misskeyApiGet('charts/notes', { limit: 2, span: 'day' }).then(chart => { misskeyApiGet('charts/notes', { limit: 2, span: 'day' }).then(chart => {
notesComparedToThePrevDay.value = stats.value.originalNotesCount - chart.local.total[1]; notesComparedToThePrevDay.value = _stats.originalNotesCount - chart.local.total[1];
}); });
fetching.value = false; fetching.value = false;