import { ReactNative as RN, stylesheet } 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"; const { FormRow, FormSwitch } = Forms; const { TouchableOpacity, Image } = General; const navigation = findByProps("pushLazy"); const styles = stylesheet.createThemedStyleSheet({ card: { backgroundColor: stylesheet.ThemeColorMap.BACKGROUND_SECONDARY, borderRadius: 5, margin: 10, }, header: { backgroundColor: stylesheet.ThemeColorMap.BACKGROUND_TERTIARY, borderTopLeftRadius: 5, borderTopRightRadius: 5, }, actions: { justifyContent: "flex-end", flexDirection: "row", alignItems: "center", }, icon: { width: 22, height: 22, tintColor: stylesheet.ThemeColorMap.INTERACTIVE_NORMAL, } }) interface PluginCardProps { plugin: Plugin; } export default function PluginCard({ plugin }: PluginCardProps) { const [enabled, setEnabled] = React.useState(plugin.enabled); const Settings = getSettings(plugin.id); return ( i.name).join(", ")}`} leading={} trailing={ { if (v) startPlugin(plugin.id); else stopPlugin(plugin.id); setEnabled(v); }} /> } /> {Settings && { navigation.push(Settings); }} > } } /> ) }