Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/game/interface/hud/actionDialogs/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -4514,6 +4514,8 @@ export const ProcessInputOutputSection = ({ title, products, input, output, prim
<ProductWrapper horizontalScroll={products?.length > 7}>
{products.map(({ i: resourceId, recipe, amount }) => {
const thumbProps = {};
const resource = Product.TYPES[resourceId];
let denominator = null;
if (output) {
thumbProps.backgroundColor = `rgba(${hexToRGB(theme.colors.green)}, 0.15)`;
thumbProps.badgeColor = theme.colors.green;
Expand All @@ -4530,7 +4532,13 @@ export const ProcessInputOutputSection = ({ title, products, input, output, prim
thumbProps.tooltipOverride = `[INSUFFICIENT] ${Product.TYPES[resourceId]?.name}`;
}
}
const resource = Product.TYPES[resourceId];
if (!output && stage == actionStage.NOT_STARTED) {
denominator = resource.isAtomic ? sourceContents[resourceId] || '0' : formatResourceMass(sourceContents[resourceId], resourceId);
if (amount + recipe >= sourceContents[resourceId] && sourceContents[resourceId] >= amount) {
thumbProps.backgroundColor = `rgba(${hexToRGB(theme.colors.warning)}, 0.15)`;
thumbProps.badgeColor = theme.colors.warning;
}
}
return (
<ProductSelector
key={resourceId}
Expand All @@ -4541,6 +4549,7 @@ export const ProcessInputOutputSection = ({ title, products, input, output, prim
<ResourceThumbnail
resource={resource}
badge={`${output ? '+' : '-'}${resource.isAtomic ? amount : formatResourceMass(amount, resourceId)}`}
badgeDenominator={denominator}
iconBadge={<RecipeLabel>{recipe.toLocaleString()}</RecipeLabel>}
tooltipContainer="actionDialogTooltip"
{...thumbProps}
Expand Down