mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 18:02:57 +00:00
a
This commit is contained in:
@@ -101,26 +101,35 @@ export const BorgPanel = (props, context) => {
|
|||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
<LabeledList.Item label="Upgrades">
|
<LabeledList.Item label="Upgrades">
|
||||||
{upgrades.map(upgrade => {
|
{upgrades.map(upgrade => {
|
||||||
if (!upgrade.module_type || (upgrade.module_type.includes(borg.active_module))) {
|
if (!upgrade.module_type
|
||||||
const installedCount = active_upgrades.filter(installed_upgrade => installed_upgrade.type === upgrade.type).length;
|
|| (upgrade.module_type.includes(borg.active_module))) {
|
||||||
|
const installedCount =
|
||||||
|
active_upgrades.filter(installed_upgrade
|
||||||
|
=> 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 && (!upgrade.denied_type || upgrade.maximum_of_type > 1) && upgrade.cost != null ? `(${installedCount} installed)` : ''}` : upgrade.name}
|
content={isInstalled ? `${upgrade.name} ${installedCount
|
||||||
selected={isInstalled} // Set selected to the value of isInstalled
|
&& (!upgrade.denied_type || upgrade.maximum_of_type > 1)
|
||||||
|
&& upgrade.cost
|
||||||
|
!== null ? `(${installedCount} installed)` : ''}`
|
||||||
|
: upgrade.name}
|
||||||
|
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.cost != null ? (
|
(!upgrade.denied_type || upgrade.maximum_of_type > 1)
|
||||||
|
&& 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 && (installedCount === upgrade.maximum_of_type))}
|
|| (upgrade.denied_type
|
||||||
|
&& (installedCount === upgrade.maximum_of_type))}
|
||||||
onClick={() => act('add_upgrade', {
|
onClick={() => act('add_upgrade', {
|
||||||
upgrade: upgrade.type,
|
upgrade: upgrade.type,
|
||||||
})}
|
})}
|
||||||
@@ -138,7 +147,7 @@ export const BorgPanel = (props, context) => {
|
|||||||
);
|
);
|
||||||
}})}
|
}})}
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
{ka_remaining_capacity != null &&
|
{ka_remaining_capacity !== null &&
|
||||||
<LabeledList.Item label="Remaining ka capacity">
|
<LabeledList.Item label="Remaining ka capacity">
|
||||||
{ka_remaining_capacity}
|
{ka_remaining_capacity}
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
|
|||||||
@@ -213,8 +213,10 @@ export const NtosRobotactContent = (props, context) => {
|
|||||||
)}
|
)}
|
||||||
{tab_sub === 2 && (
|
{tab_sub === 2 && (
|
||||||
<Section>
|
<Section>
|
||||||
{borgUpgrades.filter((upgrade, index, arr) => arr.indexOf(upgrade) === index).map(upgrade => {
|
{borgUpgrades.filter((upgrade, index, arr) =>
|
||||||
const upgradeCount = borgUpgrades.filter(u => u === upgrade).length;
|
arr.indexOf(upgrade) === index).map(upgrade => {
|
||||||
|
const upgradeCount = borgUpgrades.filter(u =>
|
||||||
|
u === upgrade).length;
|
||||||
return (
|
return (
|
||||||
<Box mb={1} key={upgrade}>
|
<Box mb={1} key={upgrade}>
|
||||||
{upgrade} {upgradeCount > 1 ? `x${upgradeCount}` : ''}
|
{upgrade} {upgradeCount > 1 ? `x${upgradeCount}` : ''}
|
||||||
|
|||||||
Reference in New Issue
Block a user