feat: Added interface options

This commit is contained in:
Simeon Radivoev 2026-03-04 13:18:18 +02:00
parent 4739b89933
commit 2f32cbc730
Signed by: simeonradivoev
GPG key ID: 7611A451D2A5D37A
25 changed files with 327 additions and 74 deletions

View file

@ -1,5 +1,7 @@
import { LocalSettingsSchema, LocalSettingsType } from "@/shared/constants";
import { doesFocusableExist, getCurrentFocusKey } from "@noriginmedia/norigin-spatial-navigation";
import { RefObject, useEffect, useState } from "react";
import { useLocalStorage } from "usehooks-ts";
export function selfFocusSmart (shouldFocus: boolean, focusSelf: () => void)
{
@ -64,6 +66,12 @@ export function mobileCheck ()
return check;
};
export function useLocalSetting (key: keyof LocalSettingsType)
{
const [localValue] = useLocalStorage(key, LocalSettingsSchema.shape[key].parse(undefined), { deserializer: (value) => LocalSettingsSchema.shape[key].parse(JSON.parse(value)) });
return localValue;
}
export function useAsyncGenerator<T> (
generator: AsyncGenerator<T> | undefined,
deps: any[]