working on tip card and BS
This commit is contained in:
@@ -3,21 +3,22 @@ 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;
|
||||
onSave: (value: string) => void;
|
||||
}
|
||||
|
||||
export function TipBottomSheet({
|
||||
isOpen,
|
||||
onClose,
|
||||
initialValue,
|
||||
onSave,
|
||||
}: TipBottomSheetProps) {
|
||||
const { t } = useTranslation();
|
||||
const dispatch = useAppDispatch();
|
||||
const [value, setValue] = useState(initialValue);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -25,7 +26,8 @@ export function TipBottomSheet({
|
||||
}, [initialValue]);
|
||||
|
||||
const handleSave = () => {
|
||||
onSave(value);
|
||||
const numAmount = parseFloat(value) || 0;
|
||||
dispatch(updateTip(numAmount.toString()));
|
||||
onClose();
|
||||
};
|
||||
|
||||
@@ -39,7 +41,6 @@ export function TipBottomSheet({
|
||||
isOpen={isOpen}
|
||||
onClose={handleCancel}
|
||||
title={t("cart.tip")}
|
||||
showCloseButton={false}
|
||||
initialSnap={1}
|
||||
height={370}
|
||||
snapPoints={[370]}
|
||||
@@ -64,6 +65,7 @@ export function TipBottomSheet({
|
||||
placeholder={t("cart.amount")}
|
||||
autoFocus={false}
|
||||
size="large"
|
||||
style={{ height: 48 }}
|
||||
/>
|
||||
|
||||
<br />
|
||||
|
||||
Reference in New Issue
Block a user