From f8e0baa0c0a274f92066c4912993d740e6269ac8 Mon Sep 17 00:00:00 2001 From: Gauvain Date: Tue, 16 Jun 2026 23:42:25 +0200 Subject: [PATCH] refactor(kefin-tweaks): use the standard ListItem/disabledByAdmin pattern Rebuild the KefinTweaks toggle on ListGroup + ListItem like the other plugin settings: drop the bespoke card, the red label, the custom switch colours, and the `t("Watchlist On")`/`t("Watchlist Off")` literal-as-key strings. The admin lock now shows via the ListItem subtitle instead of wrapping the whole screen in DisabledSetting. --- .../settings/plugins/kefinTweaks/page.tsx | 12 ++---- components/settings/KefinTweaks.tsx | 39 ++++++++----------- 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/app/(auth)/(tabs)/(home)/settings/plugins/kefinTweaks/page.tsx b/app/(auth)/(tabs)/(home)/settings/plugins/kefinTweaks/page.tsx index e9af145f..b6fd8c2e 100644 --- a/app/(auth)/(tabs)/(home)/settings/plugins/kefinTweaks/page.tsx +++ b/app/(auth)/(tabs)/(home)/settings/plugins/kefinTweaks/page.tsx @@ -1,11 +1,8 @@ -import { ScrollView } from "react-native"; +import { ScrollView, View } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; -import DisabledSetting from "@/components/settings/DisabledSetting"; import { KefinTweaksSettings } from "@/components/settings/KefinTweaks"; -import { useSettings } from "@/utils/atoms/settings"; export default function KefinTweaksPage() { - const { pluginSettings } = useSettings(); const insets = useSafeAreaInsets(); return ( @@ -16,12 +13,9 @@ export default function KefinTweaksPage() { paddingRight: insets.right, }} > - + - + ); } diff --git a/components/settings/KefinTweaks.tsx b/components/settings/KefinTweaks.tsx index 228b4692..0021859c 100644 --- a/components/settings/KefinTweaks.tsx +++ b/components/settings/KefinTweaks.tsx @@ -1,33 +1,28 @@ import { useTranslation } from "react-i18next"; -import { Switch, Text, View } from "react-native"; +import { Switch } from "react-native"; import { useSettings } from "@/utils/atoms/settings"; +import { ListGroup } from "../list/ListGroup"; +import { ListItem } from "../list/ListItem"; export const KefinTweaksSettings = () => { - const { settings, updateSettings } = useSettings(); + const { settings, updateSettings, pluginSettings } = useSettings(); const { t } = useTranslation(); const isEnabled = settings?.useKefinTweaks ?? false; + const locked = pluginSettings?.useKefinTweaks?.locked === true; return ( - - - - {t("home.settings.plugins.kefinTweaks.watchlist_enabler")} - - - - - {isEnabled ? t("Watchlist On") : t("Watchlist Off")} - - - updateSettings({ useKefinTweaks: value })} - trackColor={{ false: "#555", true: "purple" }} - thumbColor={isEnabled ? "#fff" : "#ccc"} - /> - - - + + + updateSettings({ useKefinTweaks: value })} + /> + + ); };