Show loaded plugins that edit cell on cell pane
This commit is contained in:
parent
d45c4f51b1
commit
cc625d9029
@ -4,6 +4,7 @@ import useSWRImmutable from "swr/immutable";
|
|||||||
|
|
||||||
import styles from "../styles/CellData.module.css";
|
import styles from "../styles/CellData.module.css";
|
||||||
import CellModList from "./CellModList";
|
import CellModList from "./CellModList";
|
||||||
|
import PluginList from "./PluginsList";
|
||||||
|
|
||||||
export interface Mod {
|
export interface Mod {
|
||||||
id: number;
|
id: number;
|
||||||
@ -120,6 +121,8 @@ const CellData: React.FC<Props> = ({ selectedCell, counts }) => {
|
|||||||
<span>{data.plugins_count}</span>
|
<span>{data.plugins_count}</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<h2>Loaded Plugins</h2>
|
||||||
|
<PluginList selectedCell={selectedCell} />
|
||||||
<CellModList mods={data.mods} counts={counts} />
|
<CellModList mods={data.mods} counts={counts} />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
@ -6,11 +6,21 @@ import { excludedPlugins } from "../lib/plugins";
|
|||||||
import { togglePlugin } from "../slices/plugins";
|
import { togglePlugin } from "../slices/plugins";
|
||||||
import styles from "../styles/PluginList.module.css";
|
import styles from "../styles/PluginList.module.css";
|
||||||
|
|
||||||
type Props = {};
|
type Props = {
|
||||||
|
selectedCell: { x: number; y: number };
|
||||||
|
};
|
||||||
|
|
||||||
const PluginsList: React.FC<Props> = () => {
|
const PluginsList: React.FC<Props> = ({ selectedCell }) => {
|
||||||
const dispatch = useAppDispatch();
|
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);
|
const pluginsPending = useAppSelector((state) => state.plugins.pending);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user