mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 09:54:52 +00:00
b
This commit is contained in:
@@ -103,52 +103,55 @@ 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 (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
key={upgrade.type}
|
key={upgrade.type}
|
||||||
icon={isInstalled ? 'check-square-o' : 'square-o'}
|
icon={isInstalled ? 'check-square-o' : 'square-o'}
|
||||||
content={isInstalled ? `${upgrade.name} ${installedCount
|
content={isInstalled ? `${upgrade.name} ${installedCount
|
||||||
&& (!upgrade.denied_type || upgrade.maximum_of_type > 1)
|
&& (!upgrade.denied_type || upgrade.maximum_of_type > 1)
|
||||||
&& upgrade.cost
|
&& upgrade.cost
|
||||||
!== null ? `(${installedCount} installed)` : ''}`
|
!== null ? `(${installedCount} installed)` : ''}`
|
||||||
: upgrade.name}
|
: upgrade.name}
|
||||||
selected={isInstalled}
|
selected={isInstalled}
|
||||||
onClick={() => act('toggle_upgrade', {
|
onClick={() => act('toggle_upgrade', {
|
||||||
upgrade: upgrade.type,
|
upgrade: upgrade.type,
|
||||||
})} />
|
})} />
|
||||||
{
|
{
|
||||||
(!upgrade.denied_type || upgrade.maximum_of_type > 1)
|
(!upgrade.denied_type || upgrade.maximum_of_type > 1)
|
||||||
&& upgrade.cost !== null ? (
|
&& upgrade.cost !== null
|
||||||
<>
|
? (
|
||||||
<Button
|
<>
|
||||||
content={<Icon name="plus"/>}
|
<Button
|
||||||
disabled={ka_remaining_capacity < upgrade.cost
|
content={<Icon name="plus" />}
|
||||||
|| (upgrade.denied_type
|
disabled={ka_remaining_capacity < upgrade.cost
|
||||||
|
|| (upgrade.denied_type
|
||||||
&& (installedCount === upgrade.maximum_of_type))}
|
&& (installedCount === upgrade.maximum_of_type))}
|
||||||
onClick={() => act('add_upgrade', {
|
onClick={() => act('add_upgrade', {
|
||||||
upgrade: upgrade.type,
|
upgrade: upgrade.type,
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
<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>
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user