feat: improve stats dashboard and annotation settings

This commit is contained in:
2026-03-15 21:18:35 -07:00
parent 650e95cdc3
commit 04682a02cc
75 changed files with 3420 additions and 619 deletions

View File

@@ -1,4 +1,4 @@
import { useState, useEffect } from 'react';
import { useState, useEffect, useCallback } from 'react';
import { getStatsClient } from './useStatsApi';
import type { AnimeDetailData } from '../types/stats';
@@ -6,6 +6,7 @@ export function useAnimeDetail(animeId: number | null) {
const [data, setData] = useState<AnimeDetailData | null>(null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
const [reloadKey, setReloadKey] = useState(0);
useEffect(() => {
if (animeId === null) return;
@@ -16,7 +17,9 @@ export function useAnimeDetail(animeId: number | null) {
.then(setData)
.catch((err: Error) => setError(err.message))
.finally(() => setLoading(false));
}, [animeId]);
}, [animeId, reloadKey]);
return { data, loading, error };
const reload = useCallback(() => setReloadKey((k) => k + 1), []);
return { data, loading, error, reload };
}