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

@@ -22,6 +22,7 @@ import YouMightAlsoLike from "pages/cart/components/youMayLike/YouMightAlsoLike.
import { useTranslation } from "react-i18next";
import { useAppSelector } from "redux/hooks.ts";
import CartFooter from "./cartFooter/CartFooter";
import { OrderType } from "pages/checkout/hooks/types.ts";
interface CartDesktopLayoutProps {
form: FormInstance;
@@ -177,11 +178,10 @@ export default function CartDesktopLayout({ form }: CartDesktopLayoutProps) {
<CouponCard />
</div>
{orderType === "pickup" && <CarPlateCard />}
{orderType === OrderType.Pickup && <CarPlateCard />}
{(orderType === "delivery" || orderType === "pickup") && (
<TimeEstimateCard />
)}
{(orderType === OrderType.Delivery ||
orderType === OrderType.Pickup) && <TimeEstimateCard />}
<div
className={styles.desktopSidebarCard}
@@ -191,7 +191,7 @@ export default function CartDesktopLayout({ form }: CartDesktopLayoutProps) {
</div>
{/* Table Number */}
{orderType === "dine-in" && (
{orderType === OrderType.DineIn && (
<div
className={styles.desktopSidebarCard}
style={{ "--animation-order": 3 } as React.CSSProperties}

View File

@@ -30,6 +30,7 @@ import SpecialRequestCard from "pages/cart/components/specialRequest/SpecialRequ
import TableNumberCard from "pages/cart/components/TableNumberCard.tsx";
import TimeEstimateCard from "pages/cart/components/timeEstimate/TimeEstimateCard.tsx";
import { useTranslation } from "react-i18next";
import { OrderType } from "pages/checkout/hooks/types";
interface CartMobileTabletLayoutProps {
form: FormInstance;
@@ -224,15 +225,14 @@ export default function CartMobileTabletLayout({
<CouponCard />
{/* Car Plate*/}
{orderType === "pickup" && <CarPlateCard />}
{orderType === OrderType.Pickup && <CarPlateCard />}
{/* Estimate Time */}
{(orderType === "delivery" || orderType === "pickup") && (
<TimeEstimateCard />
)}
{(orderType === OrderType.Delivery ||
orderType === OrderType.Pickup) && <TimeEstimateCard />}
{/* Collection Method */}
{orderType === "pickup" && (
{orderType === OrderType.Pickup && (
<ProInputCard title={t("cart.collectionMethod")}>
<Form.Item
name="collectionMethod"
@@ -270,7 +270,7 @@ export default function CartMobileTabletLayout({
<RewardWaiterCard />
{/* Table Number */}
{orderType === "dine-in" && <TableNumberCard />}
{orderType === OrderType.DineIn && <TableNumberCard />}
{/* Invoice Summary */}
<OrderSummary />