diff --git a/components/CellData.tsx b/components/CellData.tsx index f96c01e..95fc327 100644 --- a/components/CellData.tsx +++ b/components/CellData.tsx @@ -4,6 +4,7 @@ import useSWRImmutable from "swr/immutable"; import styles from "../styles/CellData.module.css"; import CellModList from "./CellModList"; +import PluginList from "./PluginsList"; export interface Mod { id: number; @@ -120,6 +121,8 @@ const CellData: React.FC = ({ selectedCell, counts }) => { {data.plugins_count} +

Loaded Plugins

+ ) diff --git a/components/PluginsList.tsx b/components/PluginsList.tsx index a8192c0..a0d08b4 100644 --- a/components/PluginsList.tsx +++ b/components/PluginsList.tsx @@ -6,11 +6,21 @@ import { excludedPlugins } from "../lib/plugins"; import { togglePlugin } from "../slices/plugins"; import styles from "../styles/PluginList.module.css"; -type Props = {}; +type Props = { + selectedCell: { x: number; y: number }; +}; -const PluginsList: React.FC = () => { +const PluginsList: React.FC = ({ selectedCell }) => { const dispatch = useAppDispatch(); - const plugins = useAppSelector((state) => state.plugins.plugins); + const plugins = useAppSelector((state) => + selectedCell + ? state.plugins.plugins.filter((plugin) => + plugin.parsed?.cells.some( + (cell) => cell.x === selectedCell.x && cell.y === selectedCell.y + ) + ) + : state.plugins.plugins + ); const pluginsPending = useAppSelector((state) => state.plugins.pending); return (