- clean coupon on success order
- in menu on clicking on the sticky categories make scroll jump to the category title postion exactly
This commit is contained in:
2026-01-04 07:46:21 +03:00
parent f294138d30
commit 102415fe8b
3 changed files with 119 additions and 101 deletions

View File

@@ -42,12 +42,22 @@ export function ScrollHandlerProvider({ children }: { children: ReactNode }) {
const scrollToCategory = useCallback((categoryId: number) => {
const categoryRef = categoryRefs.current?.[categoryId];
if (categoryRef) {
categoryRef.scrollIntoView({
// Get the sticky header height (70px when sticky, 0 when not)
const stickyHeaderHeight = isCategoriesSticky && categoriesContainerRef.current
? categoriesContainerRef.current.offsetHeight
: 0;
// Calculate the position of the category element
const elementPosition = categoryRef.getBoundingClientRect().top;
const offsetPosition = elementPosition + window.pageYOffset - stickyHeaderHeight;
// Scroll to the exact position, accounting for sticky header
window.scrollTo({
top: offsetPosition,
behavior: "smooth",
block: "start",
});
}
}, []);
}, [isCategoriesSticky, categoriesContainerRef]);
return (
<ScrollHandlerContext.Provider

View File

@@ -364,6 +364,19 @@ const orderSlice = createSlice({
state.collectionMethod = "";
state.paymentMethod = "";
state.loyaltyValidationError = null;
state.discount = {
value: 0,
isGift: false,
isDiscount: false,
};
state.plateCar = "";
state.pickupDate = "";
state.pickupTime = "";
state.pickupType = "";
state.estimateWay = "";
state.order = null;
state.splitBillAmount = 0;
state.customerName = "";
// Clear all cart data from localStorage
if (typeof window !== "undefined") {
Object.values(CART_STORAGE_KEYS)

View File

@@ -158,8 +158,7 @@ export function AddToCartButton({ item }: { item: Product }) {
}
};
return isInCart && !hasOptions ? (
<>
return (
<div
className={styles.cartItemActions}
onClick={(e) => {
@@ -167,12 +166,16 @@ export function AddToCartButton({ item }: { item: Product }) {
e.preventDefault;
}}
>
{isInCart && !hasOptions ? (
<>
<div className={styles.quantityControls}>
<div className={styles.quantityInputContainer}>
<Button
shape="circle"
iconPlacement="start"
icon={<MinusOutlined title="minus" style={{ color: "black" }} />}
icon={
<MinusOutlined title="minus" style={{ color: "black" }} />
}
size="small"
onClick={handleMinusClick}
className={styles.addButton}
@@ -221,17 +224,8 @@ export function AddToCartButton({ item }: { item: Product }) {
/>
</div>
</div>
</div>
</>
) : (
<div
style={{
position: "absolute",
bottom: -11,
[isRTL ? "left" : "right"]: -2,
borderRadius: "50%",
}}
>
<Button
shape="circle"
iconPlacement="start"
@@ -252,13 +246,14 @@ export function AddToCartButton({ item }: { item: Product }) {
width: 28,
height: 28,
position: "absolute",
bottom: 16,
[isRTL ? "left" : "right"]: 7,
[isRTL ? "left" : "right"]: -87,
bottom: 3,
minWidth: 28,
boxShadow:
"0px 1px 2px 0px #8585851A, 0px 3px 3px 0px #85858517, -1px 7px 4px 0px #8585850D, -1px 13px 5px 0px #85858503, -2px 20px 6px 0px #85858500",
}}
/>
)}
</div>
);
}