import { observer } from "mobx-react-lite"; import styles from "./Panes.module.scss"; import { Text } from "preact-i18n"; import { Button, Checkbox, Tip } from "@revoltchat/ui"; import { useApplicationState } from "../../../mobx/State"; // Just keeping this here for general purpose. Should probably be exported // elsewhere, though. interface Plugin { namespace: string; id: string; version: string; enabled: boolean | undefined; } interface CardProps { plugin: Plugin; } function PluginCard({ plugin }: CardProps) { const plugins = useApplicationState().plugins; // TODO(lexisother): ...don't hijack bot cards? We need a general-purpose // card component. return (
{plugin.namespace} / {plugin.id} } onChange={() => { !plugin.enabled ? plugins.load(plugin.namespace, plugin.id) : plugins.unload( plugin.namespace, plugin.id, ); }} />
); } export const PluginsPage = observer(() => { const plugins = useApplicationState().plugins; return (
{plugins.list().map((plugin) => { return ; })} {plugins.list().length === 0 && (
)}
); });