mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-10 18:54:06 +02:00
refactor: make noImplicitAny true (#17083)
* wip * Update emojis.emoji.vue * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update manager.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update analytics.ts
This commit is contained in:
@@ -57,10 +57,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, computed, useTemplateRef } from 'vue';
|
||||
import { Chart } from 'chart.js';
|
||||
import MkSelect from '@/components/MkSelect.vue';
|
||||
import type { MkSelectItem, ItemOption } from '@/components/MkSelect.vue';
|
||||
import MkChart from '@/components/MkChart.vue';
|
||||
import type { ChartSrc } from '@/components/MkChart.vue';
|
||||
import MkSelect from '@/components/MkSelect.vue';
|
||||
import MkChart from '@/components/MkChart.vue';
|
||||
import { useChartTooltip } from '@/composables/use-chart-tooltip.js';
|
||||
import { $i } from '@/i.js';
|
||||
import * as os from '@/os.js';
|
||||
@@ -172,7 +172,14 @@ const { handler: externalTooltipHandler2 } = useChartTooltip({
|
||||
position: 'middle',
|
||||
});
|
||||
|
||||
function createDoughnut(chartEl, tooltip, data) {
|
||||
type ChartData = {
|
||||
name: string,
|
||||
color: string,
|
||||
value: number,
|
||||
onClick?: () => void,
|
||||
}[];
|
||||
|
||||
function createDoughnut(chartEl: HTMLCanvasElement, tooltip: ReturnType<typeof useChartTooltip>['handler'], data: ChartData) {
|
||||
const chartInstance = new Chart(chartEl, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
@@ -198,8 +205,8 @@ function createDoughnut(chartEl, tooltip, data) {
|
||||
onClick: (ev) => {
|
||||
if (ev.native == null) return;
|
||||
const hit = chartInstance.getElementsAtEventForMode(ev.native, 'nearest', { intersect: true }, false)[0];
|
||||
if (hit && data[hit.index].onClick) {
|
||||
data[hit.index].onClick();
|
||||
if (hit != null) {
|
||||
data[hit.index].onClick?.();
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
@@ -223,16 +230,9 @@ function createDoughnut(chartEl, tooltip, data) {
|
||||
|
||||
onMounted(() => {
|
||||
misskeyApiGet('federation/stats', { limit: 30 }).then(fedStats => {
|
||||
type ChartData = {
|
||||
name: string,
|
||||
color: string | null,
|
||||
value: number,
|
||||
onClick?: () => void,
|
||||
}[];
|
||||
|
||||
const subs: ChartData = fedStats.topSubInstances.map(x => ({
|
||||
name: x.host,
|
||||
color: x.themeColor,
|
||||
color: x.themeColor ?? '#888888',
|
||||
value: x.followersCount,
|
||||
onClick: () => {
|
||||
os.pageWindow(`/instance-info/${x.host}`);
|
||||
@@ -245,11 +245,11 @@ onMounted(() => {
|
||||
value: fedStats.otherFollowersCount,
|
||||
});
|
||||
|
||||
createDoughnut(subDoughnutEl.value, externalTooltipHandler1, subs);
|
||||
if (subDoughnutEl.value != null) createDoughnut(subDoughnutEl.value, externalTooltipHandler1, subs);
|
||||
|
||||
const pubs: ChartData = fedStats.topPubInstances.map(x => ({
|
||||
name: x.host,
|
||||
color: x.themeColor,
|
||||
color: x.themeColor ?? '#888888',
|
||||
value: x.followingCount,
|
||||
onClick: () => {
|
||||
os.pageWindow(`/instance-info/${x.host}`);
|
||||
@@ -262,7 +262,7 @@ onMounted(() => {
|
||||
value: fedStats.otherFollowingCount,
|
||||
});
|
||||
|
||||
createDoughnut(pubDoughnutEl.value, externalTooltipHandler2, pubs);
|
||||
if (pubDoughnutEl.value != null) createDoughnut(pubDoughnutEl.value, externalTooltipHandler2, pubs);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user