This commit is contained in:
SandPoot
2023-12-07 23:37:04 -03:00
parent d2039c33fe
commit 0d8739aebf

View File

@@ -103,8 +103,8 @@ export const BorgPanel = (props, context) => {
{upgrades.map(upgrade => { {upgrades.map(upgrade => {
if (!upgrade.module_type if (!upgrade.module_type
|| (upgrade.module_type.includes(borg.active_module))) { || (upgrade.module_type.includes(borg.active_module))) {
const installedCount = const installedCount
active_upgrades.filter(installed_upgrade = active_upgrades.filter(installed_upgrade
=> installed_upgrade.type === upgrade.type).length; => installed_upgrade.type === upgrade.type).length;
const isInstalled = installedCount > 0; const isInstalled = installedCount > 0;
return ( return (
@@ -123,10 +123,11 @@ export const BorgPanel = (props, context) => {
})} /> })} />
{ {
(!upgrade.denied_type || upgrade.maximum_of_type > 1) (!upgrade.denied_type || upgrade.maximum_of_type > 1)
&& upgrade.cost !== null ? ( && upgrade.cost !== null
? (
<> <>
<Button <Button
content={<Icon name="plus"/>} content={<Icon name="plus" />}
disabled={ka_remaining_capacity < upgrade.cost disabled={ka_remaining_capacity < upgrade.cost
|| (upgrade.denied_type || (upgrade.denied_type
&& (installedCount === upgrade.maximum_of_type))} && (installedCount === upgrade.maximum_of_type))}
@@ -135,20 +136,22 @@ export const BorgPanel = (props, context) => {
})} })}
/> />
<Button <Button
content={<Icon name="minus"/>} content={<Icon name="minus" />}
disabled={!isInstalled} disabled={!isInstalled}
onClick={() => act('remove_upgrade', { onClick={() => act('remove_upgrade', {
upgrade: upgrade.type, upgrade: upgrade.type,
})} })}
/> />
</> </>
) : ""} ) : ""
}
</> </>
); );
}})} } })}
</LabeledList.Item> </LabeledList.Item>
{ka_remaining_capacity !== null && {
<LabeledList.Item label="Remaining ka capacity"> ka_remaining_capacity !== null
&& <LabeledList.Item label="Remaining ka capacity">
{ka_remaining_capacity} {ka_remaining_capacity}
</LabeledList.Item> </LabeledList.Item>
} }