diff --git a/src/views/Modals/RedeemPointsModal.jsx b/src/views/Modals/RedeemPointsModal.jsx new file mode 100644 index 0000000..c9db547 --- /dev/null +++ b/src/views/Modals/RedeemPointsModal.jsx @@ -0,0 +1,89 @@ +import { + Box, + Button, + FormLabel, + IconButton, + Input, + Modal, + ModalDialog, + Typography, +} from '@mui/joy' +import { useEffect, useState } from 'react' + +function RedeemPointsModal({ config }) { + useEffect(() => { + setPoints(0) + }, [config]) + + const [points, setPoints] = useState(0) + + const predefinedPoints = [1, 5, 10, 25] + + return ( + + + + Redeem Points + + + Points to Redeem ({config.available ? config.available : 0} points + available) + + { + if (e.target.value > config.available) { + setPoints(config.available) + return + } + setPoints(e.target.value) + }} + /> + Or select from predefined points: + + {predefinedPoints.map(point => ( + { + const newPoints = points + point + if (newPoints > config.available) { + setPoints(config.available) + return + } + setPoints(newPoints) + }} + > + {point} + + ))} + + + {/* 3 button save , cancel and delete */} + + + + + + + ) +} +export default RedeemPointsModal