From e7ea8443fd66ce367d682ea8908f9bd3e800e7c1 Mon Sep 17 00:00:00 2001 From: Mohammed Al-yaseen Date: Thu, 11 Dec 2025 00:07:43 +0300 Subject: [PATCH] menu: add open button with its bottom sheet --- src/assets/locals/ar.json | 6 +- src/assets/locals/en.json | 6 +- .../OpeningTimesBottomSheet.tsx | 214 ++++++++++++++++++ src/components/Icons/NextIcon.tsx | 10 +- src/pages/menu/menu.module.css | 32 ++- src/pages/menu/page.tsx | 32 ++- 6 files changed, 285 insertions(+), 15 deletions(-) create mode 100644 src/components/CustomBottomSheet/OpeningTimesBottomSheet.tsx diff --git a/src/assets/locals/ar.json b/src/assets/locals/ar.json index 5923270..a415d12 100644 --- a/src/assets/locals/ar.json +++ b/src/assets/locals/ar.json @@ -122,6 +122,8 @@ "carbs": "الكربوهيدرات", "fat": "الدهون", "viewCart": "عرض السلة", + "open": "مفتوح", + "close": "مغلق", "pay": "الدفع", "payDescription": "الدفع", "rating": "التقييم ", @@ -158,7 +160,9 @@ "joinUs": "انضم إلى الولاء", "joinUsDescription": "لتحصل على هدية مجانية", "openingHours": "ساعات العمل: {{openingTime}} - {{closingTime}}", - "restaurantIsClosed": "المطعم مغلق" + "restaurantIsClosed": "المطعم مغلق", + "address": "العنوان", + "openingTimes": "ساعات العمل" }, "cart": { "title": "السلة", diff --git a/src/assets/locals/en.json b/src/assets/locals/en.json index bfc42de..158ffd4 100644 --- a/src/assets/locals/en.json +++ b/src/assets/locals/en.json @@ -138,6 +138,8 @@ "carbs": "Carbs", "fat": "Fat", "viewCart": "View Cart", + "open": "Open", + "close": "Close", "rating": "Rating ", "loyaltyPoints": "Loyalty Points", "loyaltyDescription": "Buy {{value}} meals and get 1 FREE", @@ -170,7 +172,9 @@ "openingHours": "Opening Hours: {{openingTime}} - {{closingTime}}", "restaurantIsClosed": "Restaurant is closed", "pay": "Pay", - "payDescription": "Pay for your order" + "payDescription": "Pay for your order", + "address": "Address", + "openingTimes": "Opening Times" }, "cart": { "title": "Cart", diff --git a/src/components/CustomBottomSheet/OpeningTimesBottomSheet.tsx b/src/components/CustomBottomSheet/OpeningTimesBottomSheet.tsx new file mode 100644 index 0000000..34fb517 --- /dev/null +++ b/src/components/CustomBottomSheet/OpeningTimesBottomSheet.tsx @@ -0,0 +1,214 @@ +import { Button } from "antd"; +import { useTranslation } from "react-i18next"; +import { ProBottomSheet } from "../ProBottomSheet/ProBottomSheet"; +import ProText from "components/ProText"; +import ProTitle from "components/ProTitle"; +import { useAppSelector } from "redux/hooks"; + +interface OpeningTimesBottomSheetProps { + isOpen: boolean; + onClose: () => void; +} + +const textStyle: React.CSSProperties = { + fontWeight: 400, + fontStyle: "Regular", + fontSize: 14, + lineHeight: "140%", + letterSpacing: "0%", +}; + +export function OpeningTimesBottomSheet({ + isOpen, + onClose, +}: OpeningTimesBottomSheetProps) { + const { t } = useTranslation(); + const { isRTL } = useAppSelector((state) => state.locale); + const { restaurant } = useAppSelector((state) => state.order); + + const days = [ + "sunday", + "monday", + "tuesday", + "wednesday", + "thursday", + "friday", + "saturday", + ]; + const todayIndex = new Date().getDay(); + const todayDay = days[todayIndex]; + + return ( + +
+ {t("menu.address")} + + {isRTL ? restaurant?.addressAR : restaurant?.address} + + + {t("menu.openingTimes")} +
+ + sunday + + + 10:00 AM to 10:00 PM + +
+
+ + monday + + + 10:00 AM to 10:00 PM + +
+
+ + tuesday + + + 10:00 AM to 10:00 PM + +
+
+ + wednesday + + + 10:00 AM to 10:00 PM + +
+
+ + thursday + + + 10:00 AM to 10:00 PM + +
+
+ + friday + + + 10:00 AM to 10:00 PM + +
+
+ + saturday + + + 10:00 AM to 10:00 PM + +
+
+ +
+ ); +} diff --git a/src/components/Icons/NextIcon.tsx b/src/components/Icons/NextIcon.tsx index 49d7bb7..da0ec9f 100644 --- a/src/components/Icons/NextIcon.tsx +++ b/src/components/Icons/NextIcon.tsx @@ -4,15 +4,17 @@ import { ProGray1 } from "ThemeConstants"; interface NextIconType { className?: string; onClick?: () => void; + iconColor?: string; + iconSize?: number; } -const NextIcon = ({ className, onClick }: NextIconType) => { +const NextIcon = ({ className, onClick, iconColor, iconSize }: NextIconType) => { const { themeName } = useAppSelector((state) => state.theme); - const color = themeName === "dark" ? "white" : ProGray1; + const color = iconColor || (themeName === "dark" ? "white" : ProGray1); return (
- - {isRTL ? restaurant?.nameAR : restaurant?.restautantName} - +
+ + {isRTL ? restaurant?.nameAR : restaurant?.restautantName} + + +
@@ -128,10 +140,10 @@ function MenuPage() {
- + {/* {restaurant?.openingTime} - {restaurant?.closingTime} - + */}
@@ -152,6 +164,10 @@ function MenuPage() { {isDesktop && } + setIsOpeningTimesOpen(false)} + /> )}