From 3d84b558fb162040d78b7ecc76bb81794ef357f2 Mon Sep 17 00:00:00 2001 From: Gauvain Date: Tue, 16 Jun 2026 23:27:52 +0200 Subject: [PATCH] fix(marlin-search): show the admin-lock notice via the ListItem subtitle The "Disabled by admin" notice was rendered by DisabledSetting inside the rounded, overflow-hidden card, which clipped the text. Switch to the same pattern as the Streamystats settings: plain ListItems with the `disabledByAdmin` prop, so the notice renders as the row subtitle and the URL/toggle disable per-field. --- .../settings/plugins/marlin-search/page.tsx | 91 ++++++++----------- 1 file changed, 36 insertions(+), 55 deletions(-) diff --git a/app/(auth)/(tabs)/(home)/settings/plugins/marlin-search/page.tsx b/app/(auth)/(tabs)/(home)/settings/plugins/marlin-search/page.tsx index 3ce2c81c..d9e737ec 100644 --- a/app/(auth)/(tabs)/(home)/settings/plugins/marlin-search/page.tsx +++ b/app/(auth)/(tabs)/(home)/settings/plugins/marlin-search/page.tsx @@ -1,5 +1,5 @@ import { useNavigation } from "expo-router"; -import { useEffect, useMemo, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { Linking, @@ -14,22 +14,22 @@ import { toast } from "sonner-native"; import { Text } from "@/components/common/Text"; import { ListGroup } from "@/components/list/ListGroup"; import { ListItem } from "@/components/list/ListItem"; -import DisabledSetting from "@/components/settings/DisabledSetting"; import { useNetworkAwareQueryClient } from "@/hooks/useNetworkAwareQueryClient"; import { useSettings } from "@/utils/atoms/settings"; export default function MarlinSearchPage() { const navigation = useNavigation(); - const { t } = useTranslation(); - const insets = useSafeAreaInsets(); - const { settings, updateSettings, pluginSettings } = useSettings(); const queryClient = useNetworkAwareQueryClient(); const [value, setValue] = useState(settings?.marlinServerUrl || ""); + const searchEngineLocked = pluginSettings?.searchEngine?.locked === true; + const marlinUrlLocked = pluginSettings?.marlinServerUrl?.locked === true; + const hasStreamystats = !!pluginSettings?.streamyStatsServerUrl?.value; + const onSave = (val: string) => { updateSettings({ marlinServerUrl: !val.endsWith("/") ? val : val.slice(0, -1), @@ -41,15 +41,8 @@ export default function MarlinSearchPage() { Linking.openURL("https://github.com/fredrikburmester/marlin-search"); }; - const disabled = useMemo(() => { - return ( - pluginSettings?.searchEngine?.locked === true && - pluginSettings?.marlinServerUrl?.locked === true - ); - }, [pluginSettings]); - useEffect(() => { - if (!pluginSettings?.marlinServerUrl?.locked) { + if (!marlinUrlLocked) { navigation.setOptions({ headerRight: () => ( onSave(value)} className='px-2'> @@ -60,7 +53,7 @@ export default function MarlinSearchPage() { ), }); } - }, [navigation, value, pluginSettings?.marlinServerUrl?.locked, t]); + }, [navigation, value, marlinUrlLocked, t]); if (!settings) return null; @@ -72,52 +65,39 @@ export default function MarlinSearchPage() { paddingRight: insets.right, }} > - + - { + updateSettings({ searchEngine: "Jellyfin" }); + queryClient.invalidateQueries({ queryKey: ["search"] }); + }} > - { - updateSettings({ searchEngine: "Jellyfin" }); + { + updateSettings({ searchEngine: val ? "Marlin" : "Jellyfin" }); queryClient.invalidateQueries({ queryKey: ["search"] }); }} - > - { - updateSettings({ - searchEngine: value ? "Marlin" : "Jellyfin", - }); - queryClient.invalidateQueries({ queryKey: ["search"] }); - }} - /> - - + /> + - - + - - {t("home.settings.plugins.marlin_search.url")} - setValue(text)} /> - - + + + {t("home.settings.plugins.marlin_search.marlin_search_hint")}{" "} {t("home.settings.plugins.marlin_search.read_more_about_marlin")} - + ); }