import Link from "next/link"; import React from "react"; import { useAppSelector, useAppDispatch } from "../lib/hooks"; import { excludedPlugins } from "../lib/plugins"; import { enableAllPlugins, disableAllPlugins, togglePlugin, } from "../slices/plugins"; import styles from "../styles/PluginList.module.css"; type Props = { selectedCell?: { x: number; y: number }; }; const PluginsList: React.FC = ({ selectedCell }) => { const dispatch = useAppDispatch(); const plugins = useAppSelector((state) => selectedCell ? state.plugins.plugins.filter((plugin) => plugin.parsed?.cells.some( (cell) => cell.x === selectedCell.x && cell.y === selectedCell.y && // TODO: support other worlds cell.world_form_id === 60 ) ) : state.plugins.plugins ); const pluginsPending = useAppSelector((state) => state.plugins.pending); return ( <> {plugins.length > 0 &&

Loaded Plugins ({plugins.length})

} {!selectedCell && plugins.length > 0 && (
)}
    0 ? styles["bottom-spacing"] : "" }`} > {plugins.map((plugin) => (
  1. dispatch(togglePlugin(plugin.filename))} />
  2. ))}
{pluginsPending > 0 && ( Loading {pluginsPending} plugin{pluginsPending === 1 ? "" : "s"} )} ); }; export default PluginsList;