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

@@ -6,6 +6,7 @@ import DownIcon from "components/Icons/DownIcon";
import PickupIcon from "components/Icons/PickupIcon";
import useBreakPoint from "hooks/useBreakPoint";
import styles from "../menu.module.css";
import { OrderType } from "pages/checkout/hooks/types.ts";
interface ResponsiveServicesProps {
orderType: string;
@@ -18,18 +19,20 @@ interface ResponsiveServicesProps {
};
}
export default function ResponsiveServices({ orderType, translations }: ResponsiveServicesProps) {
export default function ResponsiveServices({
orderType,
translations,
}: ResponsiveServicesProps) {
const { isMobile } = useBreakPoint();
// Hide pickup service if screen width is less than 400px (insufficient for 3 services)
const shouldHidePickup = isMobile;
return (
<div className={styles.services}>
<Button
className={
orderType == "dine-in"
orderType == OrderType.DineIn
? styles.activeServiceButton
: styles.serviceButton
}
@@ -41,11 +44,11 @@ export default function ResponsiveServices({ orderType, translations }: Responsi
>
{translations.common.dineIn}
</Button>
{!shouldHidePickup && (
<Button
className={
orderType == "pickup"
orderType == OrderType.Pickup
? styles.activeServiceButton
: styles.serviceButton
}
@@ -58,7 +61,7 @@ export default function ResponsiveServices({ orderType, translations }: Responsi
{translations.common.pickup}
</Button>
)}
<Button
className={
orderType == "more"