diff --git a/app/(auth)/(tabs)/(home)/settings/popular-lists/page.tsx b/app/(auth)/(tabs)/(home)/settings/popular-lists/page.tsx index 43cf76c4..c7d66e75 100644 --- a/app/(auth)/(tabs)/(home)/settings/popular-lists/page.tsx +++ b/app/(auth)/(tabs)/(home)/settings/popular-lists/page.tsx @@ -9,6 +9,8 @@ import { useQuery, useQueryClient } from "@tanstack/react-query"; import { useNavigation } from "expo-router"; import { useAtom } from "jotai"; import { Linking, Switch, View } from "react-native"; +import {useMemo} from "react"; +import DisabledSetting from "@/components/settings/DisabledSetting"; export default function page() { const navigation = useNavigation(); @@ -16,7 +18,7 @@ export default function page() { const [api] = useAtom(apiAtom); const [user] = useAtom(userAtom); - const [settings, updateSettings] = useSettings(); + const [settings, updateSettings, pluginSettings] = useSettings(); const handleOpenLink = () => { Linking.openURL( @@ -48,13 +50,22 @@ export default function page() { staleTime: 0, }); + const disabled = useMemo(() => ( + pluginSettings?.usePopularPlugin?.locked === true && + pluginSettings?.mediaListCollectionIds?.locked === true + ), [pluginSettings]); + if (!settings) return null; return ( - + { updateSettings({ usePopularPlugin: true }); queryClient.invalidateQueries({ queryKey: ["search"] }); @@ -62,9 +73,10 @@ export default function page() { > { - updateSettings({ usePopularPlugin: value }); - }} + disabled={pluginSettings?.usePopularPlugin?.locked} + onValueChange={(usePopularPlugin) => + updateSettings({ usePopularPlugin }) + } /> @@ -88,11 +100,14 @@ export default function page() { <> {mediaListCollections?.map((mlc) => ( - + { if (!settings.mediaListCollectionIds) { updateSettings({ @@ -130,6 +145,6 @@ export default function page() { )} )} - + ); }