mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-07-07 13:02:52 +01:00
Some checks are pending
🏗️ Build Apps / 🤖 Build Android APK (Phone) (push) Waiting to run
🏗️ Build Apps / 🤖 Build Android APK (TV) (push) Waiting to run
🏗️ Build Apps / 🍎 Build iOS IPA (Phone) (push) Waiting to run
🏗️ Build Apps / 🍎 Build iOS IPA (Phone - Unsigned) (push) Waiting to run
🏗️ Build Apps / 🍎 Build tvOS IPA (push) Waiting to run
🏗️ Build Apps / 🍎 Build tvOS IPA (Unsigned) (push) Waiting to run
🔒 Lockfile Consistency Check / 🔍 Check bun.lock and package.json consistency (push) Waiting to run
🛡️ CodeQL Analysis / 🔎 Analyze with CodeQL (actions) (push) Waiting to run
🛡️ CodeQL Analysis / 🔎 Analyze with CodeQL (javascript-typescript) (push) Waiting to run
🏷️🔀Merge Conflict Labeler / 🏷️ Labeling Merge Conflicts (push) Waiting to run
🚦 Security & Quality Gate / 📝 Validate PR Title (push) Waiting to run
🚦 Security & Quality Gate / 🔍 Vulnerable Dependencies (push) Waiting to run
🚦 Security & Quality Gate / 🚑 Expo Doctor Check (push) Waiting to run
🚦 Security & Quality Gate / 🔍 Lint & Test (check) (push) Waiting to run
🚦 Security & Quality Gate / 🔍 Lint & Test (format) (push) Waiting to run
🚦 Security & Quality Gate / 🔍 Lint & Test (i18n:check) (push) Waiting to run
🚦 Security & Quality Gate / 🔍 Lint & Test (lint) (push) Waiting to run
🚦 Security & Quality Gate / 🔍 Lint & Test (typecheck) (push) Waiting to run
🛡️ Trivy Security Scan / 🔎 Filesystem scan (push) Waiting to run
39 lines
1012 B
TypeScript
39 lines
1012 B
TypeScript
import { useCallback } from "react";
|
|
import useRouter from "@/hooks/useAppRouter";
|
|
import {
|
|
type TVOptionItem,
|
|
tvOptionModalAtom,
|
|
} from "@/utils/atoms/tvOptionModal";
|
|
import { store } from "@/utils/store";
|
|
|
|
interface ShowOptionsParams<T> {
|
|
title: string;
|
|
options: TVOptionItem<T>[];
|
|
onSelect: (value: T) => void;
|
|
cardWidth?: number;
|
|
cardHeight?: number;
|
|
deferApplyUntilDismissed?: boolean;
|
|
}
|
|
|
|
export const useTVOptionModal = () => {
|
|
const router = useRouter();
|
|
|
|
const showOptions = useCallback(
|
|
<T>(params: ShowOptionsParams<T>) => {
|
|
// Use store.set for synchronous update before navigation
|
|
store.set(tvOptionModalAtom, {
|
|
title: params.title,
|
|
options: params.options,
|
|
onSelect: params.onSelect,
|
|
cardWidth: params.cardWidth,
|
|
cardHeight: params.cardHeight,
|
|
deferApplyUntilDismissed: params.deferApplyUntilDismissed,
|
|
});
|
|
router.push("/(auth)/tv-option-modal");
|
|
},
|
|
[router],
|
|
);
|
|
|
|
return { showOptions };
|
|
};
|