Skip to content

Commit

Permalink
fix the donate input bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AnshulKahar2729 committed Aug 22, 2024
1 parent 968c284 commit d8cd88a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,9 @@
"yourPreviousDonations": "Your Previous Donations",
"donate": "Donate",
"nothingToShow": "Nothing to show here.",
"success": "Donation Successful"
"success": "Donation Successful",
"invalidAmount": "Please enter a numerical value for the donation amount.",
"donationAmountDescription": "Please enter the numerical value for the donation amount."
},
"userEvents": {
"title": "Events",
Expand Down
8 changes: 8 additions & 0 deletions src/screens/UserPortal/Donate/Donate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ export default function donate(): JSX.Element {
}, [donationData]);

const donateToOrg = (): void => {
// check if the amount is non empty and is a number
if (amount === '' || Number.isNaN(Number(amount))) {
toast.error(t(`invalidAmount`));
return;

Check warning on line 134 in src/screens/UserPortal/Donate/Donate.tsx

View check run for this annotation

Codecov / codecov/patch

src/screens/UserPortal/Donate/Donate.tsx#L133-L134

Added lines #L133 - L134 were not covered by tests
}
try {
donate({
variables: {
Expand Down Expand Up @@ -216,6 +221,9 @@ export default function donate(): JSX.Element {
/>
</InputGroup>
</div>
<Form.Text className="text-muted">
{t('donationAmountDescription')}
</Form.Text>
<div className={styles.donateActions}>
<Button
size="sm"
Expand Down

0 comments on commit d8cd88a

Please sign in to comment.