mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 23:59:08 +00:00
fix(typescript): resolve 44 TypeScript errors in core components (#1004)
This commit is contained in:
@@ -12,7 +12,7 @@ interface Props extends ViewProps {}
|
||||
|
||||
export const AppLanguageSelector: React.FC<Props> = () => {
|
||||
const isTv = Platform.isTV;
|
||||
const [settings, updateSettings] = useSettings();
|
||||
const [settings, updateSettings] = useSettings(null);
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (isTv) return null;
|
||||
|
||||
@@ -17,7 +17,7 @@ export const AudioToggles: React.FC<Props> = ({ ...props }) => {
|
||||
const isTv = Platform.isTV;
|
||||
|
||||
const media = useMedia();
|
||||
const [_, __, pluginSettings] = useSettings();
|
||||
const [_, __, pluginSettings] = useSettings(null);
|
||||
const { settings, updateSettings } = media;
|
||||
const cultures = media.cultures;
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ListGroup } from "../list/ListGroup";
|
||||
import { ListItem } from "../list/ListItem";
|
||||
|
||||
export const ChromecastSettings: React.FC = ({ ...props }) => {
|
||||
const [settings, updateSettings] = useSettings();
|
||||
const [settings, updateSettings] = useSettings(null);
|
||||
return (
|
||||
<View {...props}>
|
||||
<ListGroup title={"Chromecast"}>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ListGroup } from "../list/ListGroup";
|
||||
import { ListItem } from "../list/ListItem";
|
||||
|
||||
export const Dashboard = () => {
|
||||
const [settings, _updateSettings] = useSettings();
|
||||
const [settings, _updateSettings] = useSettings(null);
|
||||
const { sessions = [] } = useSessions({} as useSessionsProps);
|
||||
const router = useRouter();
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ListGroup } from "../list/ListGroup";
|
||||
import { ListItem } from "../list/ListItem";
|
||||
|
||||
export default function DownloadSettings({ ...props }) {
|
||||
const [settings, updateSettings, pluginSettings] = useSettings();
|
||||
const [settings, updateSettings, pluginSettings] = useSettings(null);
|
||||
const { t } = useTranslation();
|
||||
|
||||
const allDisabled = useMemo(
|
||||
|
||||
@@ -13,7 +13,7 @@ interface Props extends ViewProps {}
|
||||
export const GestureControls: React.FC<Props> = ({ ...props }) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [settings, updateSettings, pluginSettings] = useSettings();
|
||||
const [settings, updateSettings, pluginSettings] = useSettings(null);
|
||||
|
||||
const disabled = useMemo(
|
||||
() =>
|
||||
|
||||
@@ -70,7 +70,7 @@ export const HomeIndex = () => {
|
||||
_pluginSettings,
|
||||
_setPluginSettings,
|
||||
refreshStreamyfinPluginSettings,
|
||||
] = useSettings();
|
||||
] = useSettings(null);
|
||||
|
||||
const [isConnected, setIsConnected] = useState<boolean | null>(null);
|
||||
const [loadingRetry, setLoadingRetry] = useState(false);
|
||||
@@ -81,7 +81,7 @@ export const HomeIndex = () => {
|
||||
|
||||
const scrollViewRef = useRef<ScrollView>(null);
|
||||
|
||||
const { downloadedFiles, cleanCacheDirectory } = useDownload();
|
||||
const { getDownloadedItems, cleanCacheDirectory } = useDownload();
|
||||
const prevIsConnected = useRef<boolean | null>(false);
|
||||
const invalidateCache = useInvalidatePlaybackProgressCache();
|
||||
useEffect(() => {
|
||||
@@ -100,7 +100,7 @@ export const HomeIndex = () => {
|
||||
});
|
||||
return;
|
||||
}
|
||||
const hasDownloads = downloadedFiles && downloadedFiles.length > 0;
|
||||
const hasDownloads = getDownloadedItems().length > 0;
|
||||
navigation.setOptions({
|
||||
headerLeft: () => (
|
||||
<TouchableOpacity
|
||||
@@ -117,7 +117,7 @@ export const HomeIndex = () => {
|
||||
</TouchableOpacity>
|
||||
),
|
||||
});
|
||||
}, [downloadedFiles, navigation, router]);
|
||||
}, [navigation, router]);
|
||||
|
||||
useEffect(() => {
|
||||
cleanCacheDirectory().catch((_e) =>
|
||||
@@ -338,10 +338,8 @@ export const HomeIndex = () => {
|
||||
const customSections = useMemo(() => {
|
||||
if (!api || !user?.Id || !settings?.home?.sections) return [];
|
||||
const ss: Section[] = [];
|
||||
for (const key in settings.home?.sections) {
|
||||
// @ts-expect-error
|
||||
const section = settings.home?.sections[key];
|
||||
const id = section.title || key;
|
||||
for (const [index, section] of settings.home.sections.entries()) {
|
||||
const id = section.items?.title || `section-${index}`;
|
||||
ss.push({
|
||||
title: id,
|
||||
queryKey: ["home", id],
|
||||
@@ -363,10 +361,10 @@ export const HomeIndex = () => {
|
||||
const response = await getTvShowsApi(api).getNextUp({
|
||||
userId: user?.Id,
|
||||
fields: ["MediaSourceCount"],
|
||||
limit: section.items?.limit || 25,
|
||||
limit: section.nextUp?.limit || 25,
|
||||
enableImageTypes: ["Primary", "Backdrop", "Thumb"],
|
||||
enableResumable: section.items?.enableResumable,
|
||||
enableRewatching: section.items?.enableRewatching,
|
||||
enableResumable: section.nextUp?.enableResumable,
|
||||
enableRewatching: section.nextUp?.enableRewatching,
|
||||
});
|
||||
return response.data.Items || [];
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export const JellyseerrSettings = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [user] = useAtom(userAtom);
|
||||
const [settings, updateSettings, _pluginSettings] = useSettings();
|
||||
const [settings, updateSettings, _pluginSettings] = useSettings(null);
|
||||
|
||||
const [jellyseerrPassword, setJellyseerrPassword] = useState<
|
||||
string | undefined
|
||||
|
||||
@@ -28,7 +28,7 @@ export const useMedia = () => {
|
||||
};
|
||||
|
||||
export const MediaProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [settings, updateSettings] = useSettings();
|
||||
const [settings, updateSettings] = useSettings(null);
|
||||
const api = useAtomValue(apiAtom);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ interface Props extends ViewProps {}
|
||||
export const MediaToggles: React.FC<Props> = ({ ...props }) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [settings, updateSettings, pluginSettings] = useSettings();
|
||||
const [settings, updateSettings, pluginSettings] = useSettings(null);
|
||||
|
||||
const disabled = useMemo(
|
||||
() =>
|
||||
|
||||
@@ -23,7 +23,7 @@ import { ListItem } from "../list/ListItem";
|
||||
|
||||
export const OtherSettings: React.FC = () => {
|
||||
const router = useRouter();
|
||||
const [settings, updateSettings, pluginSettings] = useSettings();
|
||||
const [settings, updateSettings, pluginSettings] = useSettings(null);
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ListGroup } from "../list/ListGroup";
|
||||
import { ListItem } from "../list/ListItem";
|
||||
|
||||
export const PluginSettings = () => {
|
||||
const [settings, _updateSettings] = useSettings();
|
||||
const [settings, _updateSettings] = useSettings(null);
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ export const SubtitleToggles: React.FC<Props> = ({ ...props }) => {
|
||||
const isTv = Platform.isTV;
|
||||
|
||||
const media = useMedia();
|
||||
const [_, __, pluginSettings] = useSettings();
|
||||
const [_, __, pluginSettings] = useSettings(null);
|
||||
const { settings, updateSettings } = media;
|
||||
const cultures = media.cultures;
|
||||
const { t } = useTranslation();
|
||||
|
||||
Reference in New Issue
Block a user