Compare commits
2 Commits
ed23b10240
...
b149fabfc9
| Author | SHA1 | Date | |
|---|---|---|---|
| b149fabfc9 | |||
| 96573d62f4 |
@@ -16,7 +16,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 1px;
|
padding: 0 1px;
|
||||||
border-radius: 888px;
|
border-radius: 888px;
|
||||||
width: 140px;
|
width: 110px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,10 +58,11 @@ export default function ActionsButtons({
|
|||||||
className={styles.quantityButton}
|
className={styles.quantityButton}
|
||||||
{...(min && { disabled: quantity === min })}
|
{...(min && { disabled: quantity === min })}
|
||||||
style={{
|
style={{
|
||||||
width: 48,
|
width: 36,
|
||||||
height: 48,
|
height: 36,
|
||||||
minWidth: 48,
|
minWidth: 36,
|
||||||
borderColor: "#DEDEE0",
|
borderColor: "#DEDEE0",
|
||||||
|
backgroundColor: "var(--secondary-background)"
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -85,10 +86,10 @@ export default function ActionsButtons({
|
|||||||
className={styles.addButton}
|
className={styles.addButton}
|
||||||
style={{
|
style={{
|
||||||
background: "#FEF2F2",
|
background: "#FEF2F2",
|
||||||
width: 48,
|
width: 36,
|
||||||
height: 48,
|
height: 36,
|
||||||
border: "none",
|
border: "none",
|
||||||
minWidth: 48,
|
minWidth: 36,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
@@ -112,10 +113,10 @@ export default function ActionsButtons({
|
|||||||
className={styles.quantityButton}
|
className={styles.quantityButton}
|
||||||
{...(max && { disabled: quantity >= max })}
|
{...(max && { disabled: quantity >= max })}
|
||||||
style={{
|
style={{
|
||||||
width: 48,
|
width: 36,
|
||||||
height: 48,
|
height: 36,
|
||||||
borderColor: "#DEDEE0",
|
borderColor: "#DEDEE0",
|
||||||
minWidth: 48,
|
minWidth: 36,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { Space } from "antd";
|
|||||||
import ArabicPrice from "components/ArabicPrice";
|
import ArabicPrice from "components/ArabicPrice";
|
||||||
import useBreakPoint from "hooks/useBreakPoint";
|
import useBreakPoint from "hooks/useBreakPoint";
|
||||||
import ExtraGroupsContainer from "pages/product/components/ExtraGroupsContainer.tsx";
|
import ExtraGroupsContainer from "pages/product/components/ExtraGroupsContainer.tsx";
|
||||||
import { useCallback, useMemo, useState } from "react";
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { useGetMenuQuery } from "redux/api/others.ts";
|
import { useGetMenuQuery } from "redux/api/others.ts";
|
||||||
import { colors } from "ThemeConstants";
|
import { colors } from "ThemeConstants";
|
||||||
@@ -30,6 +30,35 @@ export default function ProductDetailPage({
|
|||||||
const { restaurant } = useAppSelector((state) => state.order);
|
const { restaurant } = useAppSelector((state) => state.order);
|
||||||
const { isDesktop, isTablet } = useBreakPoint();
|
const { isDesktop, isTablet } = useBreakPoint();
|
||||||
const [quantity, setQuantity] = useState(1);
|
const [quantity, setQuantity] = useState(1);
|
||||||
|
const [viewportHeight, setViewportHeight] = useState<number>(
|
||||||
|
typeof window !== "undefined" ? window.innerHeight : 0,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update viewport height when browser UI changes (mobile address bar, etc.)
|
||||||
|
useEffect(() => {
|
||||||
|
const updateViewportHeight = () => {
|
||||||
|
setViewportHeight(window.innerHeight);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set initial height
|
||||||
|
updateViewportHeight();
|
||||||
|
|
||||||
|
// Update on resize and orientation change
|
||||||
|
window.addEventListener("resize", updateViewportHeight);
|
||||||
|
window.addEventListener("orientationchange", updateViewportHeight);
|
||||||
|
// Also listen to visual viewport changes for mobile browsers
|
||||||
|
if (window.visualViewport) {
|
||||||
|
window.visualViewport.addEventListener("resize", updateViewportHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("resize", updateViewportHeight);
|
||||||
|
window.removeEventListener("orientationchange", updateViewportHeight);
|
||||||
|
if (window.visualViewport) {
|
||||||
|
window.visualViewport.removeEventListener("resize", updateViewportHeight);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
// Get menu data
|
// Get menu data
|
||||||
const { data: menuData } = useGetMenuQuery(restaurant?.restautantId, {
|
const { data: menuData } = useGetMenuQuery(restaurant?.restautantId, {
|
||||||
@@ -176,7 +205,9 @@ export default function ProductDetailPage({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
height: "75vh",
|
height: viewportHeight > 0
|
||||||
|
? `${viewportHeight - 195}px`
|
||||||
|
: "calc(100dvh - 195px)",
|
||||||
overflow: "auto",
|
overflow: "auto",
|
||||||
scrollbarWidth: "none",
|
scrollbarWidth: "none",
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user