From 59091d74f5bc19e5f7162c143147b1b644d67696 Mon Sep 17 00:00:00 2001 From: Arvids Godjuks Date: Wed, 4 Sep 2024 14:14:55 +0300 Subject: [PATCH] Fix built-in mods showing up as missing in web ui Added "builtInMods" array that contains a list of built-in mod names that we check against to not show an error and remove ability to delete those mods from mod packs Fixes #581 --- .../web_ui/src/components/ModPackViewPage.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/web_ui/src/components/ModPackViewPage.tsx b/packages/web_ui/src/components/ModPackViewPage.tsx index 93f07889..7175ffd5 100644 --- a/packages/web_ui/src/components/ModPackViewPage.tsx +++ b/packages/web_ui/src/components/ModPackViewPage.tsx @@ -242,6 +242,7 @@ type ModsTableProps = { changes: ModChange[]; onChange: (change: ModChange) => void; onRevert: (change: ModChange) => void; + builtInMods: string[]; }; function ModsTable(props: ModsTableProps) { const [showAddMods, setShowAddMods] = useState(false); @@ -263,6 +264,12 @@ function ModsTable(props: ModsTableProps) { const mods = [...props.modPack.mods.values(), ...deletedMods.values()].map( (mod: lib.ModRecord|lib.ModInfo): lib.ModInfo|lib.ModRecord => { + if (props.builtInMods.includes(mod.name)) { + return { + ...mod, + enabled: (mod as any).enabled ?? false, + }; + } const candidate = modsMap.get(`${mod.name}_${mod.version}`); if (!candidate) { return { @@ -283,7 +290,7 @@ function ModsTable(props: ModsTableProps) { function actions(mod: lib.ModRecord|lib.ModInfo) { return - {!deletedMods.has(mod.name) && { props.onChange({ @@ -882,7 +889,13 @@ export default function ModPackViewPage() { - +