mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 01:35:39 -04:00
Replace stats atoms with local state and server action in StatsDisplay
- Swap Jotai `movieStatsAtom`/`episodeStatsAtom` atoms for `useState` + `useEffect` calling `getStatsAction` directly on period change - Remove dependency on `lib/atoms/stats` module - Add touch-friendly tap target padding to `inlineTriggerClass` via negative margin compensation on mobile
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
import { atom } from "jotai";
|
||||
import { unwrap } from "jotai/utils";
|
||||
import { getStatsAction } from "@/lib/actions/watchlist";
|
||||
import type { TimePeriod } from "@/lib/services/discovery";
|
||||
|
||||
export const moviePeriodAtom = atom<TimePeriod>("this_month");
|
||||
export const episodePeriodAtom = atom<TimePeriod>("this_week");
|
||||
|
||||
const movieStatsAsyncAtom = atom(async (get) => {
|
||||
const period = get(moviePeriodAtom);
|
||||
return getStatsAction("movies", period);
|
||||
});
|
||||
|
||||
const episodeStatsAsyncAtom = atom(async (get) => {
|
||||
const period = get(episodePeriodAtom);
|
||||
return getStatsAction("episodes", period);
|
||||
});
|
||||
|
||||
export const movieStatsAtom = unwrap(movieStatsAsyncAtom);
|
||||
export const episodeStatsAtom = unwrap(episodeStatsAsyncAtom);
|
||||
Reference in New Issue
Block a user