- replace pin-to-top with persistent launched-once state (filled play/cast icons) - move download/vlc actions into a more-options dropdown when cast is available - scope Toloka search query by show year (no IMDB filter on the tracker) - strip session sid from Toloka download hrefs so cached magnets stay valid - restore row hover, subtle row borders, taller rows; drop table rounding - stacked modal backdrops: :has(~ [data-overlay]) instead of :not(:last-of-type) - only count search in analytics after the query has settled (1s debounce)
20 lines
580 B
TypeScript
20 lines
580 B
TypeScript
import { useAtom } from 'jotai';
|
|
import { atomWithStorage } from 'jotai/utils';
|
|
|
|
const launchedAtom = atomWithStorage<string[]>('launched-torrents', [], undefined, {
|
|
unstable_getOnInit: true
|
|
});
|
|
|
|
const useLaunchedTorrents = () => {
|
|
const [launched, setLaunched] = useAtom(launchedAtom);
|
|
|
|
const isLaunched = (key?: string) => Boolean(key) && launched.includes(key!);
|
|
|
|
const launch = (key?: string) =>
|
|
void setLaunched((current) => (!key || current.includes(key) ? current : [...current, key]));
|
|
|
|
return { isLaunched, launch };
|
|
};
|
|
|
|
export default useLaunchedTorrents;
|