Bug fixes for selected cell plugin list

This commit is contained in:
Tyler Hallada 2022-03-10 01:10:14 -05:00
parent cc625d9029
commit ae6b3bff12
3 changed files with 7 additions and 2 deletions

View File

@ -121,7 +121,6 @@ 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} /> <PluginList selectedCell={selectedCell} />
<CellModList mods={data.mods} counts={counts} /> <CellModList mods={data.mods} counts={counts} />
</> </>

View File

@ -297,6 +297,7 @@ const Map: React.FC = () => {
clearSelectedCell(); clearSelectedCell();
} }
} else if (router.query.plugin && typeof router.query.plugin === "string") { } else if (router.query.plugin && typeof router.query.plugin === "string") {
clearSelectedCell();
clearSelectedCells(); clearSelectedCells();
setSidebarOpen(true); setSidebarOpen(true);
if (plugins && plugins.length > 0 && pluginsPending === 0) { if (plugins && plugins.length > 0 && pluginsPending === 0) {

View File

@ -16,7 +16,11 @@ const PluginsList: React.FC<Props> = ({ selectedCell }) => {
selectedCell selectedCell
? state.plugins.plugins.filter((plugin) => ? state.plugins.plugins.filter((plugin) =>
plugin.parsed?.cells.some( plugin.parsed?.cells.some(
(cell) => cell.x === selectedCell.x && cell.y === selectedCell.y (cell) =>
cell.x === selectedCell.x &&
cell.y === selectedCell.y &&
// TODO: support other worlds
cell.world_form_id === 60
) )
) )
: state.plugins.plugins : state.plugins.plugins
@ -25,6 +29,7 @@ const PluginsList: React.FC<Props> = ({ selectedCell }) => {
return ( return (
<> <>
{selectedCell && plugins.length > 0 && <h2>Loaded Plugins</h2>}
<ol className={styles["plugin-list"]}> <ol className={styles["plugin-list"]}>
{plugins.map((plugin) => ( {plugins.map((plugin) => (
<li key={plugin.filename} title={plugin.filename}> <li key={plugin.filename} title={plugin.filename}>