Skip to content

Commit 57363dc

Browse files
committed
update limits on amount change
1 parent 95a43a0 commit 57363dc

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/pages/DonationPage/sections/MainComponent.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
CharLimitTreshold,
1111
PaymentPageConfigContext,
1212
} from "../../../logic/PaymentPageConfig";
13-
import { toJS } from "mobx";
13+
import { reaction, toJS } from "mobx";
1414

1515
const MessageComponent = observer(({}) => {
1616
const payment = useContext(PaymentStoreContext);
@@ -27,7 +27,7 @@ const MessageComponent = observer(({}) => {
2727
return pageConfig.charLimit.value as number;
2828
}
2929
const tresholds = pageConfig.charLimit.value as CharLimitTreshold[];
30-
console.log({tresholds: tresholds}, "finding limits");
30+
console.log({ tresholds: tresholds }, "finding limits");
3131
return (
3232
toJS(tresholds)
3333
.sort((a, b) => -(a.treshold - b.treshold))
@@ -42,6 +42,13 @@ const MessageComponent = observer(({}) => {
4242
payment.text = newValue;
4343
}
4444

45+
reaction(
46+
() => payment.amount,
47+
() => {
48+
setLimit(calcCharLimit());
49+
},
50+
);
51+
4552
return (
4653
<>
4754
<div className={`${classes.section} ${classes.messagesection}`}>

0 commit comments

Comments
 (0)