diff --git a/src/components/CustomBottomSheet/CouponBottomSheet.tsx b/src/components/CustomBottomSheet/CouponBottomSheet.tsx
index affd858..7238b20 100644
--- a/src/components/CustomBottomSheet/CouponBottomSheet.tsx
+++ b/src/components/CustomBottomSheet/CouponBottomSheet.tsx
@@ -2,6 +2,9 @@ import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { ProBottomSheet } from "../ProBottomSheet/ProBottomSheet";
import ProRatioGroups from "../ProRatioGroups/ProRatioGroups";
+import { colors } from "ThemeConstants";
+import { updateCoupon } from "features/order/orderSlice";
+import { useAppDispatch } from "redux/hooks";
interface CouponBottomSheetProps {
isOpen: boolean;
@@ -18,13 +21,14 @@ export function CouponBottomSheet({
}: CouponBottomSheetProps) {
const { t } = useTranslation();
const [value, setValue] = useState(initialValue);
-
+ const dispatch = useAppDispatch();
useEffect(() => {
setValue(initialValue);
}, [initialValue]);
- const handleSave = () => {
- onSave(value);
+ const handleSave = (selectedValue: string) => {
+ onSave(selectedValue);
+ dispatch(updateCoupon(selectedValue));
onClose();
};
@@ -41,28 +45,40 @@ export function CouponBottomSheet({
showCloseButton={false}
initialSnap={1}
height={350}
- snapPoints={["30vh"]}
+ snapPoints={[350]}
>
-
+
diff --git a/src/components/ProRatioGroups/ProRatioGroups.tsx b/src/components/ProRatioGroups/ProRatioGroups.tsx
index 03e12c7..fbd1fda 100644
--- a/src/components/ProRatioGroups/ProRatioGroups.tsx
+++ b/src/components/ProRatioGroups/ProRatioGroups.tsx
@@ -1,4 +1,4 @@
-import { Radio, RadioChangeEvent, Space } from "antd";
+import { Divider, Radio, RadioChangeEvent, Space } from "antd";
import ProText from "components/ProText";
import styles from "./ProRatioGroups.module.css";
@@ -7,6 +7,9 @@ interface ProRatioGroupsProps {
onRatioClick?: (value: string) => void;
onChange?: (e: RadioChangeEvent) => void;
value?: string;
+ optionsStyle?: React.CSSProperties;
+ valueStyle?: React.CSSProperties;
+ showDivider?: boolean;
}
const ProRatioGroups = ({
@@ -14,9 +17,13 @@ const ProRatioGroups = ({
onRatioClick,
onChange,
value,
+ optionsStyle,
+ valueStyle,
+ showDivider = false,
...props
}: ProRatioGroupsProps) => {
const handleChange = (e: RadioChangeEvent) => {
+ console.log(e.target.value);
// If onChange is provided (from Form.Item), use it
if (onChange) {
onChange(e);
@@ -39,30 +46,39 @@ const ProRatioGroups = ({
>
{options.map((option) => (
-
-
+
-
- {option.label}
-
- {option?.price}
-
-
+
+ {option.label}
+
+
+ {option?.price}
+
+
+
+ {showDivider && options.length !== options.length - 1 && (
+
+ )}
+ >
))}
diff --git a/src/pages/cart/components/CouponCard.tsx b/src/pages/cart/components/CouponCard.tsx
index 0b06a1b..48d0056 100644
--- a/src/pages/cart/components/CouponCard.tsx
+++ b/src/pages/cart/components/CouponCard.tsx
@@ -1,5 +1,8 @@
import { Button, Form, Input, message } from "antd";
+import { CouponBottomSheet } from "components/CustomBottomSheet/CouponBottomSheet";
+import { CouponDialog } from "components/CustomBottomSheet/CouponDialog";
import CouponHeartIcon from "components/Icons/cart/CouponHeart.tsx";
+import DonateIcon from "components/Icons/cart/DonateIcon";
import ProInputCard from "components/ProInputCard/ProInputCard.tsx";
import ProText from "components/ProText";
import {
@@ -7,20 +10,22 @@ import {
updateCoupon,
updateDiscount,
} from "features/order/orderSlice.ts";
+import useBreakPoint from "hooks/useBreakPoint";
import styles from "pages/cart/cart.module.css";
+import { useState } from "react";
import { useTranslation } from "react-i18next";
import { useGetDiscountMutation } from "redux/api/others";
import { useAppDispatch, useAppSelector } from "redux/hooks.ts";
+import { colors } from "ThemeConstants";
export default function CouponCard() {
const { t } = useTranslation();
const dispatch = useAppDispatch();
const { restaurant } = useAppSelector((state) => state.order);
const { coupon } = useAppSelector(selectCart);
- // const { isDesktop } = useBreakPoint();
+ const { isDesktop } = useBreakPoint();
const [getDiscount] = useGetDiscountMutation();
-
- // const [isCouponOpen, setIsCouponOpen] = useState(false);
+ const [isCouponOpen, setIsCouponOpen] = useState(false);
const handleCouponSave = (value: string) => {
getDiscount({
@@ -43,36 +48,36 @@ export default function CouponCard() {
});
};
- // const handleCouponClose = () => {
- // setIsCouponOpen(false);
- // };
+ const handleCouponClose = () => {
+ setIsCouponOpen(false);
+ };
return (
<>
setIsCouponOpen(true)}
- // >
- //
- // {t("cart.viewOffers")}
- //
- //
- //
- // }
+ titleRight={
+ setIsCouponOpen(true)}
+ >
+
+ {t("cart.viewOffers")}
+
+
+
+ }
>
- {/* {isDesktop ? (
+ {isDesktop ? (
- )} */}
+ )}
>
);
}