This commit is contained in:
かっこかり 2024-11-12 03:08:24 +09:00 committed by GitHub
commit 3d55e8a160
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 69 additions and 18 deletions

View file

@ -53,7 +53,7 @@ export type ChartSrc =
import { onMounted, ref, shallowRef, watch } from 'vue';
import { Chart } from 'chart.js';
import * as Misskey from 'misskey-js';
import { misskeyApiGet } from '@/scripts/misskey-api.js';
import { misskeyApiGet, misskeyApi } from '@/scripts/misskey-api.js';
import { defaultStore } from '@/store.js';
import { useChartTooltip } from '@/scripts/use-chart-tooltip.js';
import { chartVLine } from '@/scripts/chart-vline.js';
@ -758,7 +758,10 @@ const fetchPerUserPvChart = async (): Promise<typeof chartData> => {
};
const fetchPerUserFollowingChart = async (): Promise<typeof chartData> => {
const raw = await misskeyApiGet('charts/user/following', { userId: props.args?.user?.id, limit: props.limit, span: props.span });
const raw = await misskeyApi('charts/user/following', { userId: props.args?.user?.id!, limit: props.limit, span: props.span }).catch(() => {
return null;
});
if (raw == null) return null;
return {
series: [{
name: 'Local',
@ -773,7 +776,10 @@ const fetchPerUserFollowingChart = async (): Promise<typeof chartData> => {
};
const fetchPerUserFollowersChart = async (): Promise<typeof chartData> => {
const raw = await misskeyApiGet('charts/user/following', { userId: props.args?.user?.id, limit: props.limit, span: props.span });
const raw = await misskeyApi('charts/user/following', { userId: props.args?.user?.id!, limit: props.limit, span: props.span }).catch(() => {
return null;
});
if (raw == null) return null;
return {
series: [{
name: 'Local',

View file

@ -32,7 +32,7 @@ const props = defineProps<{
user: Misskey.entities.User;
}>();
const chartEl = shallowRef<HTMLCanvasElement>(null);
const chartEl = shallowRef<HTMLCanvasElement>();
const legendEl = shallowRef<InstanceType<typeof MkChartLegend>>();
const now = new Date();
let chartInstance: Chart = null;
@ -88,7 +88,7 @@ async function renderChart() {
}, extra);
}
chartInstance = new Chart(chartEl.value, {
chartInstance = new Chart(chartEl.value!, {
type: 'bar',
data: {
datasets: [

View file

@ -14,7 +14,10 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #header><i class="ti ti-pencil"></i> Notes</template>
<XNotes :user="user"/>
</MkFoldableSection>
<MkFoldableSection class="item">
<MkFoldableSection
v-if="isFollowersVisibleForMe(user) && isFollowingVisibleForMe(user)"
class="item"
>
<template #header><i class="ti ti-users"></i> Following</template>
<XFollowing :user="user"/>
</MkFoldableSection>
@ -33,9 +36,10 @@ import XNotes from './activity.notes.vue';
import XFollowing from './activity.following.vue';
import MkFoldableSection from '@/components/MkFoldableSection.vue';
import MkHeatmap from '@/components/MkHeatmap.vue';
import { isFollowersVisibleForMe, isFollowingVisibleForMe } from '@/scripts/isFfVisibleForMe.js';
const props = defineProps<{
user: Misskey.entities.User;
user: Misskey.entities.UserDetailed;
}>();
</script>