mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-06-06 18:31:00 +00:00
Clean up test again, it seems to work
This commit is contained in:
parent
9e8e355ae8
commit
93d0dc9b31
@ -104,6 +104,16 @@ const CoursePaymentButton = ({ lnAddress, amount, onSuccess, onError, courseId }
|
|||||||
setDialogVisible(false);
|
setDialogVisible(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleDiscountCode = (value) => {
|
||||||
|
setDiscountCode(value);
|
||||||
|
if (value.toLowerCase() === DISCOUNT_CODE.toLowerCase()) {
|
||||||
|
setDiscountApplied(true);
|
||||||
|
showToast('success', 'Discount Applied', `${calculateDiscount(amount).savedPercentage}% discount applied!`);
|
||||||
|
} else if (value && value.toLowerCase() !== DISCOUNT_CODE.toLowerCase()) {
|
||||||
|
setDiscountApplied(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
{!showDiscountInput ? (
|
{!showDiscountInput ? (
|
||||||
@ -120,10 +130,7 @@ const CoursePaymentButton = ({ lnAddress, amount, onSuccess, onError, courseId }
|
|||||||
<div className="relative flex-1">
|
<div className="relative flex-1">
|
||||||
<InputText
|
<InputText
|
||||||
value={discountCode}
|
value={discountCode}
|
||||||
onChange={(e) => {
|
onChange={(e) => handleDiscountCode(e.target.value)}
|
||||||
setDiscountCode(e.target.value);
|
|
||||||
setDiscountApplied(e.target.value === DISCOUNT_CODE);
|
|
||||||
}}
|
|
||||||
placeholder="Enter discount code"
|
placeholder="Enter discount code"
|
||||||
className="text-sm w-full p-2"
|
className="text-sm w-full p-2"
|
||||||
/>
|
/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user