import { ReactNative as RN, stylesheet } from "@metro/common"; import { Forms, General } from "@ui/components"; import { Plugin } from "@types"; import { getAssetIDByName } from "@ui/assets"; import { showToast } from "@ui/toasts"; import { removePlugin, startPlugin, stopPlugin, showSettings, getSettings } from "@lib/plugins"; import copyText from "@lib/utils/copyText"; const { FormRow, FormSwitch } = Forms; const { TouchableOpacity, Image } = General; const styles = stylesheet.createThemedStyleSheet({ card: { backgroundColor: stylesheet.ThemeColorMap.BACKGROUND_SECONDARY, borderRadius: 5, margin: 10, marginTop: 0, }, header: { backgroundColor: stylesheet.ThemeColorMap.BACKGROUND_TERTIARY, borderTopLeftRadius: 5, borderTopRightRadius: 5, }, actions: { justifyContent: "flex-end", flexDirection: "row-reverse", alignItems: "center", }, icon: { width: 22, height: 22, marginLeft: 5, tintColor: stylesheet.ThemeColorMap.INTERACTIVE_NORMAL, } }) interface PluginCardProps { plugin: Plugin; } export default function PluginCard({ plugin }: PluginCardProps) { const [removed, setRemoved] = React.useState(false); // This is needed because of Reactâ„¢ if (removed) return null; return ( i.name).join(", ")}`} leading={} trailing={ { if (v) startPlugin(plugin.id); else stopPlugin(plugin.id); }} /> } /> { removePlugin(plugin.id); setRemoved(true); }} > { copyText(plugin.id); showToast("Copied plugin URL to clipboard.", getAssetIDByName("toast_copy_link")); }} > { plugin.update = !plugin.update; showToast(`${plugin.update ? "Enabled" : "Disabled"} updates for ${plugin.manifest.name}.`, getAssetIDByName("toast_image_saved")); }} > {getSettings(plugin.id) && showSettings(plugin)}> } } /> ) }