Add enable/disable all plugins buttons

This commit is contained in:
2022-03-15 01:03:51 -04:00
parent 72b7981e8c
commit ee7c956525
3 changed files with 45 additions and 2 deletions

View File

@@ -3,7 +3,11 @@ import React from "react";
import { useAppSelector, useAppDispatch } from "../lib/hooks";
import { excludedPlugins } from "../lib/plugins";
import { togglePlugin } from "../slices/plugins";
import {
enableAllPlugins,
disableAllPlugins,
togglePlugin,
} from "../slices/plugins";
import styles from "../styles/PluginList.module.css";
type Props = {
@@ -30,6 +34,16 @@ const PluginsList: React.FC<Props> = ({ selectedCell }) => {
return (
<>
{plugins.length > 0 && <h2>Loaded Plugins ({plugins.length})</h2>}
{!selectedCell && plugins.length > 0 && (
<div className={styles.buttons}>
<button onClick={() => dispatch(enableAllPlugins())}>
Enable all
</button>
<button onClick={() => dispatch(disableAllPlugins())}>
Disable all
</button>
</div>
)}
<ol className={styles["plugin-list"]}>
{plugins.map((plugin) => (
<li key={plugin.filename} title={plugin.filename}>