Skip to content

[client] Simplify AmountInput by detecting initiallyNegative state from amount

Nicolas Frandeboeuf requested to merge simplifyAmountInput into main

<AmountInput /> now always receive the real value (instead of an absolute one) and handles the display & the initial negative state itself.

There is one case that was possible before but never used: setting the default empty value to a negative one. Ex: a budget is not set yet. The default polarity should probably be negative (I have way more expenses than earnings unfortunately). The budget view cannot force the minus sign whereas it could before (but did not).

To keep it simple I did not implement a considerEmptyValueAsNegative={true} (no idea for a better name neither) prop but that would be easy to do.

Merge request reports