Swap the static "both will be updated" info box with a ConfigRow + Switch toggle so users can control whether adding to balance also updates the granted balance. Remove the overly restrictive included_grant validation on the server and clean up dead params in computeGrantedBalanceInput. Made-with: Cursor
18 lines
489 B
TypeScript
18 lines
489 B
TypeScript
/**
|
|
* Computes the granted_balance value to send to the balance update API
|
|
* when the BalanceEditSheet "set" mode submits.
|
|
*
|
|
* The form displays grantedAndPurchasedBalance (GPB) as an editable field.
|
|
* To derive the actual granted_balance, we subtract the prepaid allowance
|
|
* from the user's new GPB value.
|
|
*/
|
|
export function computeGrantedBalanceInput({
|
|
newGPB,
|
|
prepaidAllowance,
|
|
}: {
|
|
newGPB: number;
|
|
prepaidAllowance: number;
|
|
}): number {
|
|
return newGPB - prepaidAllowance;
|
|
}
|