gift: enhance items flow

This commit is contained in:
2026-01-12 00:18:55 +03:00
parent 167b26e0b9
commit f988fd3a4e
6 changed files with 70 additions and 55 deletions

View File

@@ -6,6 +6,7 @@ import GiftItemsBtnIcon from "components/Icons/GiftItemsBtnIcon";
import GiftBalanceBtnIcon from "components/Icons/GiftBalanceBtnIcon";
import GiftItemsAndBalanceBtnIcon from "components/Icons/GiftItemsAndBalanceBtnIcon";
import ProText from "components/ProText";
import { useParams, useNavigate } from "react-router-dom";
interface GiftTypeBottomSheetProps {
isOpen: boolean;
@@ -13,6 +14,12 @@ interface GiftTypeBottomSheetProps {
onSave?: () => void;
}
export enum GiftType {
Items = "items",
Vouchers = "vouchers",
ItemsAndVouchers = "itemsAndVouchers",
}
export function GiftTypeBottomSheet({
isOpen,
onClose,
@@ -20,11 +27,15 @@ export function GiftTypeBottomSheet({
}: GiftTypeBottomSheetProps) {
const { t } = useTranslation();
const dispatch = useAppDispatch();
const handleSave = (giftType: string) => {
dispatch(updateGiftDetails({ giftType: giftType }));
const { subdomain } = useParams();
const navigate = useNavigate();
const handleSave = (giftType: GiftType) => {
dispatch(updateGiftDetails({ giftType }));
onClose();
onSave?.();
if (giftType !== GiftType.Vouchers)
navigate(`/${subdomain}/menu?orderType=gift`);
else navigate(`/${subdomain}/e-gift-cards`);
};
const handleCancel = () => {
@@ -40,6 +51,7 @@ export function GiftTypeBottomSheet({
textAlign: "center",
color: "#86858E",
};
return (
<ProBottomSheet
isOpen={isOpen}
@@ -59,19 +71,22 @@ export function GiftTypeBottomSheet({
padding: 24,
}}
>
<div style={{ width: 60 }} onClick={() => handleSave("items")}>
<div style={{ width: 60 }} onClick={() => handleSave(GiftType.Items)}>
<GiftItemsBtnIcon />
<br />
<ProText style={textStyle}>{t("gift.items")}</ProText>
</div>
<div style={{ width: 60 }} onClick={() => handleSave("vouchers")}>
<div
style={{ width: 60 }}
onClick={() => handleSave(GiftType.Vouchers)}
>
<GiftBalanceBtnIcon />
<br />
<ProText style={textStyle}>{t("gift.balance")}</ProText>
</div>
<div
style={{ width: 60 }}
onClick={() => handleSave("itemsAndVouchers")}
onClick={() => handleSave(GiftType.ItemsAndVouchers)}
>
<GiftItemsAndBalanceBtnIcon />
<br />