Display cannot afford when appropriate for increasing connections actions

This commit is contained in:
thepaperpilot 2023-04-23 23:22:14 -05:00
parent e9d4adda9c
commit cfd29548a0

View file

@ -378,6 +378,13 @@ export const main = createLayer("main", function (this: BaseLayer) {
)} energy`
};
},
confirmationLabel: (node: BoardNode) =>
Decimal.gte(
energy.value,
formula.evaluate((node.state as { maxConnections: number }).maxConnections)
)
? { text: "Tap again to confirm" }
: { text: "Cannot afford", color: "var(--danger)" },
onClick(node: BoardNode) {
const cost = formula.evaluate(
(node.state as { maxConnections: number }).maxConnections