From 70a60a5b33b62fa42e223e1c3ed587c7729988b0 Mon Sep 17 00:00:00 2001 From: Beef Date: Sat, 7 Jan 2023 03:13:28 +0000 Subject: [PATCH] [Plugins] Finish plugin settings --- src/ui/settings/components/PluginCard.tsx | 10 ++- src/ui/settings/components/PluginSettings.tsx | 73 +++++++++++++++++++ 2 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 src/ui/settings/components/PluginSettings.tsx diff --git a/src/ui/settings/components/PluginCard.tsx b/src/ui/settings/components/PluginCard.tsx index 505813b..af3f25d 100644 --- a/src/ui/settings/components/PluginCard.tsx +++ b/src/ui/settings/components/PluginCard.tsx @@ -1,13 +1,12 @@ -import { ReactNative as RN, stylesheet } from "@metro/common"; +import { ReactNative as RN, stylesheet, navigation } from "@metro/common"; import { Forms, General } from "@ui/components"; import { Plugin } from "@types"; import { getAssetIDByName } from "@ui/assets"; import { getSettings, startPlugin, stopPlugin } from "@lib/plugins"; -import { findByProps } from "@metro/filters"; +import PluginSettings from "@ui/settings/components/PluginSettings"; const { FormRow, FormSwitch } = Forms; const { TouchableOpacity, Image } = General; -const navigation = findByProps("pushLazy"); const styles = stylesheet.createThemedStyleSheet({ card: { @@ -62,7 +61,10 @@ export default function PluginCard({ plugin }: PluginCardProps) { {Settings && { - navigation.push(Settings); + navigation.push(PluginSettings, { + plugin: plugin, + children: Settings, + }); }} > diff --git a/src/ui/settings/components/PluginSettings.tsx b/src/ui/settings/components/PluginSettings.tsx new file mode 100644 index 0000000..aa1248f --- /dev/null +++ b/src/ui/settings/components/PluginSettings.tsx @@ -0,0 +1,73 @@ +import { Plugin } from "@types"; +import { navigation, navigationStack, NavigationNative, stylesheet, constants } from "@metro/common"; +import { General } from "@ui/components"; +import { getAssetIDByName } from "@ui/assets"; + +interface PluginSettingsProps { + plugin: Plugin; + children: JSX.Element; +} + +const styles = stylesheet.createThemedStyleSheet({ + container: { + backgroundColor: stylesheet.ThemeColorMap.BACKGROUND_MOBILE_SECONDARY, + flex: 1, + }, + cardStyle: { + backgroundColor: stylesheet.ThemeColorMap.BACKGROUND_MOBILE_PRIMARY, + color: stylesheet.ThemeColorMap.TEXT_NORMAL, + }, + header: { + backgroundColor: stylesheet.ThemeColorMap.BACKGROUND_MOBILE_SECONDARY, + shadowColor: "transparent", + elevation: 0, + }, + headerTitleContainer: { + color: stylesheet.ThemeColorMap.HEADER_PRIMARY, + }, + headerTitle: { + fontFamily: constants.Fonts.PRIMARY_BOLD, + color: stylesheet.ThemeColorMap.HEADER_PRIMARY, + }, + backIcon: { + tintColor: stylesheet.ThemeColorMap.INTERACTIVE_ACTIVE, + marginLeft: 15, + marginRight: 20, + } +}); + +export const Settings = navigationStack.createStackNavigator(); +const { TouchableOpacity, Image } = General; + +export default function PluginSettings({ plugin, children }: PluginSettingsProps) { + return ( + + + ( + navigation.pop()} + > + + + ), + }} + /> + + + ) +} \ No newline at end of file