From 2a75d46f841a8b18c5fe9b5c255a899e65e11430 Mon Sep 17 00:00:00 2001 From: Mohammed Al-yaseen Date: Thu, 6 Nov 2025 23:34:20 +0300 Subject: [PATCH] fix line-through styles --- src/components/ArabicPrice/ArabicPrice.tsx | 12 +++- src/pages/restaurant/RestaurantServices.tsx | 66 ++++++++++----------- src/pages/restaurant/page.tsx | 11 +--- src/utils/types/appTypes.ts | 1 + 4 files changed, 43 insertions(+), 47 deletions(-) diff --git a/src/components/ArabicPrice/ArabicPrice.tsx b/src/components/ArabicPrice/ArabicPrice.tsx index ee103e3..168e591 100644 --- a/src/components/ArabicPrice/ArabicPrice.tsx +++ b/src/components/ArabicPrice/ArabicPrice.tsx @@ -25,6 +25,10 @@ const ArabicPrice: React.FC = ({ // Format the price to ensure it has 2 decimal places const formattedPrice = typeof price === "number" ? price.toFixed(2) : price; + const { textDecoration, ...restStyle } = style; + const decorationStyle = textDecoration + ? ({ textDecoration } as React.CSSProperties) + : undefined; return ( = ({ alignItems: "baseline", gap: "0.2em", lineHeight: 1, - ...style, + ...restStyle, }} > {isRTL && !hideCurrency ? ( @@ -45,6 +49,7 @@ const ArabicPrice: React.FC = ({ style={{ verticalAlign: "baseline", lineHeight: 1, + ...(decorationStyle ?? {}), }} > {formattedPrice} @@ -56,6 +61,7 @@ const ArabicPrice: React.FC = ({ lineHeight: 1, position: "relative", top: -3, + ...(decorationStyle ?? {}), }} > {t("common.omanCurrency")} @@ -68,6 +74,7 @@ const ArabicPrice: React.FC = ({ verticalAlign: "baseline", lineHeight: 1, display: "inline-block", + ...(decorationStyle ?? {}), }} > {formattedPrice} @@ -78,13 +85,14 @@ const ArabicPrice: React.FC = ({ verticalAlign: "baseline", lineHeight: 1, display: "inline-block", + ...(decorationStyle ?? {}), }} > {t("common.omanCurrency")} ) : ( - <>{formattedPrice} + {formattedPrice} )} ); diff --git a/src/pages/restaurant/RestaurantServices.tsx b/src/pages/restaurant/RestaurantServices.tsx index 77af9c2..0d2471f 100644 --- a/src/pages/restaurant/RestaurantServices.tsx +++ b/src/pages/restaurant/RestaurantServices.tsx @@ -14,33 +14,29 @@ import { updateOrderType } from "features/order/orderSlice"; import { OrderType } from "pages/checkout/hooks/types.ts"; import { useTranslation } from "react-i18next"; import { Link, useParams } from "react-router-dom"; +import { useGetRestaurantDetailsQuery } from "redux/api/others"; import { useAppDispatch, useAppSelector } from "redux/hooks"; import styles from "./restaurant.module.css"; -interface RestaurantServicesProps { - dineIn?: boolean; - pickup?: boolean; - gift?: boolean; - delivery?: boolean; - toRoom?: boolean; - toOffice?: boolean; - is_booking_enabled?: boolean; - params: { locale: string; id: string }; -} - -export default function RestaurantServices({ - dineIn, - pickup, - gift, - delivery, - toRoom, - toOffice, - is_booking_enabled, -}: RestaurantServicesProps) { +export default function RestaurantServices() { const { t } = useTranslation(); const { isRTL } = useAppSelector((state) => state.locale); const { subdomain } = useParams(); const dispatch = useAppDispatch(); + const { data: restaurant } = useGetRestaurantDetailsQuery(subdomain, { + skip: !subdomain, + }); + + const { + dineIn, + pickup, + gift, + toRoom, + toOffice, + is_booking_enabled, + delivery, + is_schedule_order_enabled, + } = restaurant || {}; const services = [ ...((dineIn && [ @@ -146,21 +142,21 @@ export default function RestaurantServices({ }, ]) || []), - ...((true && [ - { - id: OrderType.ScheduledOrder, - title: t("common.scheduledOrder"), - description: t("home.services.scheduledOrder"), - icon: ( - - ), - color: "bg-indigo-50 text-indigo-600", - href: `/${subdomain}/menu?orderType=${OrderType.ScheduledOrder}`, - }, - ]) || - []), + ...((is_schedule_order_enabled === 1 && [ + { + id: OrderType.ScheduledOrder, + title: t("common.scheduledOrder"), + description: t("home.services.scheduledOrder"), + icon: ( + + ), + color: "bg-indigo-50 text-indigo-600", + href: `/${subdomain}/menu?orderType=${OrderType.ScheduledOrder}`, + }, + ]) || + []), ]; // Determine grid class based on number of services diff --git a/src/pages/restaurant/page.tsx b/src/pages/restaurant/page.tsx index 3c99d04..6d42b1a 100644 --- a/src/pages/restaurant/page.tsx +++ b/src/pages/restaurant/page.tsx @@ -104,16 +104,7 @@ export default function RestaurantPage() { - +