Add history page with list, timeline and year in review
- Backend: /history/years and /history/:year return every movie and episode watch in a year, with entry posters, genres, networks and buddies - History tab: watches by month and day, back-to-back episodes grouped - Timeline tab: latest to oldest, month dividers, stacked binge sessions - Year in Review tab: hours, top shows and genres, streaks, busiest day, biggest binge, monthly and weekday charts, buddies and new shows - Year picker, movies/TV filter, state kept in the URL; unknown-date watches badged and excluded from the review by default - History link in the sidebar and command palette
This commit is contained in:
1 parent
c4aa0488d4
commit
760afd8e84
13 files changed
+1724
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { historyApi } from "@/api/history";
|
||||
|
||||
export const historyKeys = {
|
||||
years: ["history", "years"] as const,
|
||||
year: (year: number) => ["history", year] as const,
|
||||
};
|
||||
|
||||
export function useHistoryYears() {
|
||||
return useQuery({
|
||||
queryKey: historyKeys.years,
|
||||
queryFn: historyApi.getYears,
|
||||
staleTime: 5 * 60 * 1000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useHistoryYear(year: number) {
|
||||
return useQuery({
|
||||
queryKey: historyKeys.year(year),
|
||||
queryFn: () => historyApi.getYear(year),
|
||||
enabled: !!year,
|
||||
staleTime: 5 * 60 * 1000,
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user