refactor the use of plain string order types

This commit is contained in:
2025-10-28 13:29:52 +03:00
parent 7aa686166b
commit 1abb63e8bd
16 changed files with 73 additions and 58 deletions

View File

@@ -7,6 +7,7 @@ import { useCallback, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { useAppDispatch, useAppSelector } from "redux/hooks";
import styles from "../../address/address.module.css";
import { OrderType } from "pages/checkout/hooks/types.ts";
interface LocationData {
lat: number;
@@ -19,7 +20,7 @@ export const AddressSummary = () => {
const dispatch = useAppDispatch();
const { location } = useAppSelector(selectCart);
const [isMapBottomSheetOpen, setIsMapBottomSheetOpen] = useState(false);
const { orderType } = useAppSelector(selectCart) // Default to delivery for now
const { orderType } = useAppSelector(selectCart); // Default to delivery for now
const handleLocationSave = useCallback(
(locationString: string) => {
@@ -46,7 +47,10 @@ export const AddressSummary = () => {
[location],
);
const shouldRender = useMemo(() => orderType === "delivery", [orderType]);
const shouldRender = useMemo(
() => orderType === OrderType.Delivery,
[orderType],
);
if (!shouldRender) {
return null;