feat(dashboard): add recharts data visualizations
- Install recharts - Add WatchActivityChart (AreaChart, movies + episodes/month, year filter) - Add WatchTimeChart (stacked BarChart, hours/month, synced year filter) - Add RatingsChart (BarChart, user ratings distribution 1–10, color ramp) - Add TopGenresChart (horizontal BarChart, top 10 genres, type filter) - Add CouchDayChart (BarChart, watch count by weekday, peak day highlight) - Add GET /statistics/watch-weekday backend endpoint (DAYOFWEEK aggregation) - Extend statisticsApi with getYearlyWatchCount, getYearlyWatchTime, getWatchdayDistribution - Add useYearlyWatchCount, useYearlyWatchTime, useWatchdayDistribution hooks - Wire all charts into DashboardPage with responsive two-column grid layout
This commit is contained in:
1 parent
3648c41cfd
commit
ae67663623
12 files changed
+1216
-2
No files matched your search
@@ -1,5 +1,41 @@
|
||||
import { api } from '@/lib/api';
|
||||
|
||||
export interface MonthlyCountItem {
|
||||
month: number;
|
||||
count: string;
|
||||
}
|
||||
|
||||
export interface MonthlyWatchTimeItem {
|
||||
month: number;
|
||||
watchTime: string;
|
||||
}
|
||||
|
||||
export interface YearlyWatchCount {
|
||||
series: MonthlyCountItem[];
|
||||
movies: MonthlyCountItem[];
|
||||
}
|
||||
|
||||
export interface YearlyWatchTime {
|
||||
series: MonthlyWatchTimeItem[];
|
||||
movies: MonthlyWatchTimeItem[];
|
||||
}
|
||||
|
||||
export interface WatchdayItem {
|
||||
day: number; // 1=Sun, 2=Mon ... 7=Sat
|
||||
count: string;
|
||||
}
|
||||
|
||||
export interface WatchdayDistribution {
|
||||
episodes: WatchdayItem[];
|
||||
movies: WatchdayItem[];
|
||||
}
|
||||
|
||||
export const statisticsApi = {
|
||||
get: () => api.get('/statistics').then((r) => r.data),
|
||||
getYearlyWatchCount: (year: number) =>
|
||||
api.get<YearlyWatchCount>(`/statistics/watch-count/year/${year}`).then((r) => r.data),
|
||||
getYearlyWatchTime: (year: number) =>
|
||||
api.get<YearlyWatchTime>(`/statistics/watch-time/year/${year}`).then((r) => r.data),
|
||||
getWatchdayDistribution: () =>
|
||||
api.get<WatchdayDistribution>('/statistics/watch-weekday').then((r) => r.data),
|
||||
};
|
||||
Reference in new issue
Block a user