Commit 7a3e0c88 by Arjun Jhukal

updated the minor changes

parent d407ba41
"use client"; "use client";
import GlassWrapper from '@/components/molecules/GlassWrapper'; import GlassWrapper from '@/components/molecules/GlassWrapper';
import { useAppDispatch } from '@/hooks/hook';
import GoldCoinIcon from '@/icons/GoldCoinIcon'; import GoldCoinIcon from '@/icons/GoldCoinIcon';
import { showToast, ToastVariant } from '@/slice/toastSlice';
import { Box, Button, OutlinedInput } from '@mui/material'; import { Box, Button, OutlinedInput } from '@mui/material';
import { Coin } from '@wandersonalwes/iconsax-react'; import { Coin } from '@wandersonalwes/iconsax-react';
import { useRouter } from 'next/navigation'; import { useRouter } from 'next/navigation';
...@@ -13,6 +15,7 @@ export default function CoinCalculator({ slug }: { slug: string }) { ...@@ -13,6 +15,7 @@ export default function CoinCalculator({ slug }: { slug: string }) {
const [_bonusCoins, setBonusCoins] = useState<number | null>(null); const [_bonusCoins, setBonusCoins] = useState<number | null>(null);
const router = useRouter(); const router = useRouter();
const dispatch = useAppDispatch();
// const calculateBonus = (amount: number) => { // const calculateBonus = (amount: number) => {
// return Math.max(Math.round(25.56 * amount - 27.78), 0); // return Math.max(Math.round(25.56 * amount - 27.78), 0);
...@@ -37,6 +40,14 @@ export default function CoinCalculator({ slug }: { slug: string }) { ...@@ -37,6 +40,14 @@ export default function CoinCalculator({ slug }: { slug: string }) {
}; };
const handleBuy = () => { const handleBuy = () => {
if (Number(amount) < 20) {
return dispatch(
showToast({
message: "Minimum amount is 20",
variant: ToastVariant.ERROR,
})
)
}
router.push(`/buy-coins/${slug}/checkout?amount=${amount}&bonus=${amount}`); router.push(`/buy-coins/${slug}/checkout?amount=${amount}&bonus=${amount}`);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment