import { Button, Input } from "antd"; import WaiterRewardingIcon from "components/Icons/waiter/WaiterRewardingIcon"; import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { ProBottomSheet } from "../ProBottomSheet/ProBottomSheet"; import { updateTip } from "features/order/orderSlice"; import { useAppDispatch } from "redux/hooks"; interface TipBottomSheetProps { isOpen: boolean; onClose: () => void; initialValue: string; } export function TipBottomSheet({ isOpen, onClose, initialValue, }: TipBottomSheetProps) { const { t } = useTranslation(); const dispatch = useAppDispatch(); const [value, setValue] = useState(initialValue); useEffect(() => { setValue(initialValue); }, [initialValue]); const handleSave = () => { const numAmount = parseFloat(value) || 0; dispatch(updateTip(numAmount.toString())); onClose(); }; const handleCancel = () => { setValue(initialValue); onClose(); }; return (

setValue(e.target.value)} placeholder={t("cart.amount")} autoFocus={false} size="large" style={{ height: 48 }} />
); }