ProductPreviewDialog: close dialog after product adding
This commit is contained in:
@@ -20,6 +20,7 @@ export default function ProductFooter({
|
||||
selectedExtras,
|
||||
selectedGroups,
|
||||
quantity,
|
||||
onClose,
|
||||
}: {
|
||||
product: Product;
|
||||
isValid?: boolean;
|
||||
@@ -27,6 +28,7 @@ export default function ProductFooter({
|
||||
selectedExtras: string[];
|
||||
selectedGroups: string[];
|
||||
quantity: number;
|
||||
onClose?: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const dispatch = useAppDispatch();
|
||||
@@ -34,6 +36,7 @@ export default function ProductFooter({
|
||||
const { specialRequest } = useAppSelector(selectCart);
|
||||
const [isSpecialRequestOpen, setIsSpecialRequestOpen] = useState(false);
|
||||
const { isMobile, isDesktop } = useBreakPoint();
|
||||
const { isRTL } = useAppSelector((state) => state.locale);
|
||||
|
||||
// Check if product has any customization options
|
||||
const hasCustomizationOptions = useMemo(() => {
|
||||
@@ -71,7 +74,10 @@ export default function ProductFooter({
|
||||
}),
|
||||
);
|
||||
// Navigate back to menu - scroll position will be restored automatically
|
||||
window.history.back();
|
||||
if (!isDesktop) window.history.back();
|
||||
else {
|
||||
onClose?.();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -101,7 +107,7 @@ export default function ProductFooter({
|
||||
: {
|
||||
position: "absolute",
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
[isRTL ? "right" : "left"]: 0,
|
||||
width: hasCustomizationOptions ? "50%" : "100%",
|
||||
}),
|
||||
height: "10vh",
|
||||
|
||||
Reference in New Issue
Block a user