- change refresh icon & apply refreshing logic
- apply validation in action btn in menu
- preserve on customer info state upon refresh
This commit is contained in:
2026-01-04 07:00:56 +03:00
parent 13cce2f12f
commit f294138d30
13 changed files with 233 additions and 105 deletions

View File

@@ -1,5 +1,5 @@
import { MinusOutlined, PlusOutlined } from "@ant-design/icons";
import { Button, message } from "antd";
import { Button, InputNumber, message } from "antd";
import { useTranslation } from "react-i18next";
import { useNavigate, useParams } from "react-router-dom";
import { useGetRestaurantDetailsQuery } from "redux/api/others";
@@ -8,7 +8,7 @@ import { useAppSelector, useAppDispatch } from "redux/hooks";
import { Product } from "utils/types/appTypes";
import NextIcon from "components/Icons/NextIcon";
import { addItem, removeItem, updateQuantity } from "features/order/orderSlice";
import ProText from "components/ProText";
import PlusIcon from "components/Icons/PlusIcon";
export function AddToCartButton({ item }: { item: Product }) {
const { t } = useTranslation();
@@ -161,68 +161,66 @@ export function AddToCartButton({ item }: { item: Product }) {
return isInCart && !hasOptions ? (
<>
<div
className={styles.addButton}
style={{
width: 90,
height: 30,
position: "absolute",
bottom: 3,
[isRTL ? "left" : "right"]: 1,
background: "#FAFAFA",
borderRadius: 888,
className={styles.cartItemActions}
onClick={(e) => {
e.stopPropagation();
e.preventDefault;
}}
>
<Button
shape="circle"
iconPlacement="start"
icon={<MinusOutlined title="minus" style={{ color: "black" }} />}
size="small"
onClick={handleMinusClick}
className={styles.addButton}
style={{
backgroundColor: "white",
width: 28,
height: 28,
position: "absolute",
bottom: 1,
[isRTL ? "left" : "right"]: 60,
minWidth: 28,
border: "none",
}}
/>
<ProText
style={{
position: "absolute",
bottom: 7,
[isRTL ? "left" : "right"]: 45,
fontSize: 14,
fontWeight: 700,
fontStyle: "Bold",
lineHeight: "100%",
letterSpacing: "0.06px",
textAlign: "center",
verticalAlign: "middle",
}}
>
{totalQuantity}
</ProText>
<Button
shape="circle"
iconPlacement="start"
icon={<PlusOutlined title="plus" />}
size="small"
onClick={handlePlusClick}
className={styles.addButton}
style={{
backgroundColor: "#FFC600",
width: 28,
height: 28,
position: "absolute",
bottom: 1,
[isRTL ? "left" : "right"]: 2,
minWidth: 28,
}}
/>
<div className={styles.quantityControls}>
<div className={styles.quantityInputContainer}>
<Button
shape="circle"
iconPlacement="start"
icon={<MinusOutlined title="minus" style={{ color: "black" }} />}
size="small"
onClick={handleMinusClick}
className={styles.addButton}
style={{
backgroundColor: "white",
width: 28,
height: 28,
border: "none",
}}
/>
<InputNumber
min={1}
max={99}
value={totalQuantity}
onClick={(e) => {
e.stopPropagation();
e.preventDefault;
}}
onChange={(value: number | null) =>
dispatch(
updateQuantity({
id: item.id,
uniqueId: basicCartItem?.uniqueId || "",
quantity: value || 1,
}),
)
}
size="small"
controls={false}
className={styles.quantityInput}
name="id"
/>
<Button
shape="circle"
iconPlacement="start"
icon={<PlusIcon color="#FFF" />}
size="small"
onClick={handlePlusClick}
disabled={totalQuantity >= 99}
className={styles.addButton}
style={{
backgroundColor: "#FFC600",
width: 28,
height: 28,
}}
/>
</div>
</div>
</div>
</>
) : (
@@ -246,6 +244,7 @@ export function AddToCartButton({ item }: { item: Product }) {
)
}
onClick={handleClick}
disabled={!hasOptions && totalQuantity >= 99}
className={styles.addButton}
style={{
color: "#302E3E",