From 0a9e49838d19f7d6edea02d8a1eef45511ec85be Mon Sep 17 00:00:00 2001 From: Mohammed Al-yaseen Date: Sat, 1 Nov 2025 21:49:55 +0300 Subject: [PATCH] order details sheet: work on components --- src/ThemeConstants.ts | 2 +- src/assets/locals/ar.json | 7 + src/assets/locals/en.json | 7 + .../OrderDetailsBottomSheet.tsx | 138 ------------------ .../OrderDetailsBottomSheet.module.css | 9 ++ .../OrderDetailsBottomSheet.tsx | 108 ++++++++++++++ src/pages/restaurant/page.tsx | 11 +- 7 files changed, 139 insertions(+), 143 deletions(-) delete mode 100644 src/components/CustomBottomSheet/OrderDetailsBottomSheet.tsx create mode 100644 src/components/CustomBottomSheet/orderDetailsSheet/OrderDetailsBottomSheet.module.css create mode 100644 src/components/CustomBottomSheet/orderDetailsSheet/OrderDetailsBottomSheet.tsx diff --git a/src/ThemeConstants.ts b/src/ThemeConstants.ts index 882ff1f..2d8e5a5 100644 --- a/src/ThemeConstants.ts +++ b/src/ThemeConstants.ts @@ -183,7 +183,7 @@ export const themeConfig: ThemeConfig = { colorText: WHITE_COLOR["600"], }, Segmented: { - colorBgLayout: WHITE_COLOR["100"], + colorBgLayout: WHITE_COLOR["hoverBg"], borderRadius: 6, colorTextLabel: "#000000", }, diff --git a/src/assets/locals/ar.json b/src/assets/locals/ar.json index df09f1d..c03f541 100644 --- a/src/assets/locals/ar.json +++ b/src/assets/locals/ar.json @@ -363,5 +363,12 @@ "office": "إلى مكتبك", "scheduled_order": "مجدول", "booking": "حجز مسبق" + }, + "orderDetails": { + "title": "تفاصيل الطلبية", + "fulfillmentType": "نوع التلبية", + "save": "حفظ", + "location": "العنوان", + "pickupTime": "توقيت الاستلام" } } diff --git a/src/assets/locals/en.json b/src/assets/locals/en.json index fdf6d5a..dd7fa96 100644 --- a/src/assets/locals/en.json +++ b/src/assets/locals/en.json @@ -375,5 +375,12 @@ "scheduled_order": "Scheduled", "booking": "Booking", "scheduledOrder": "Scheduled Order" + }, + "orderDetails": { + "title": "Order Details", + "fulfillmentType": "Fulfillment Type", + "save": "save", + "location": "Location", + "pickupTime": "Pickup time" } } diff --git a/src/components/CustomBottomSheet/OrderDetailsBottomSheet.tsx b/src/components/CustomBottomSheet/OrderDetailsBottomSheet.tsx deleted file mode 100644 index 93c8e2e..0000000 --- a/src/components/CustomBottomSheet/OrderDetailsBottomSheet.tsx +++ /dev/null @@ -1,138 +0,0 @@ -import { useTranslation } from "react-i18next"; -import { ProBottomSheet } from "../ProBottomSheet/ProBottomSheet"; -import { useAppSelector } from "redux/hooks"; -import ProText from "components/ProText"; -import { OrderType } from "pages/checkout/hooks/types"; - -interface OrderDetailsBottomSheetProps { - isOpen: boolean; - onClose: () => void; -} - -export function OrderDetailsBottomSheet({ - isOpen, - onClose, -}: OrderDetailsBottomSheetProps) { - const { t } = useTranslation(); - const { orderType, restaurant, specialRequest, items } = useAppSelector( - (state) => state.order, - ); - // const { isRTL } = useAppSelector((state) => state.locale); - - return ( - -
- {/* Order Type */} -
- - {t("Order Type")}: {orderType && t(orderType)} - -
- - {/* Items List */} -
- - {t("Items")} - - {items.length > 0 ? ( -
- {items.map((item) => ( -
-
- - {item.quantity} x {item.name} - -
- {} -
- ))} -
- ) : ( - {t("No items in cart")} - )} -
- - {/* Special Request */} - {specialRequest && ( -
- - {t("Special Request")} - - {specialRequest} -
- )} - - {/* Order Summary */} -
- - {t("Order Summary")} - - -
- {t("Subtotal")} - {} -
- -
- {t("Tax")} - {} -
- - {orderType !== OrderType.DineIn && restaurant?.delivery_fees && ( -
- {t("Delivery Fee")} - {Number(restaurant.delivery_fees)} -
- )} - -
- {t("Total")} - {} -
-
-
-
- ); -} diff --git a/src/components/CustomBottomSheet/orderDetailsSheet/OrderDetailsBottomSheet.module.css b/src/components/CustomBottomSheet/orderDetailsSheet/OrderDetailsBottomSheet.module.css new file mode 100644 index 0000000..d5cec95 --- /dev/null +++ b/src/components/CustomBottomSheet/orderDetailsSheet/OrderDetailsBottomSheet.module.css @@ -0,0 +1,9 @@ +.saveButton { + border-radius: 100px; + height: 48px; + width: 100%; + font-size: 16px; + box-shadow: none; + position: fixed; + bottom: 0;left: 0; +} diff --git a/src/components/CustomBottomSheet/orderDetailsSheet/OrderDetailsBottomSheet.tsx b/src/components/CustomBottomSheet/orderDetailsSheet/OrderDetailsBottomSheet.tsx new file mode 100644 index 0000000..08123e1 --- /dev/null +++ b/src/components/CustomBottomSheet/orderDetailsSheet/OrderDetailsBottomSheet.tsx @@ -0,0 +1,108 @@ +import { useTranslation } from "react-i18next"; +import { ProBottomSheet } from "components/ProBottomSheet/ProBottomSheet.tsx"; +import { useAppSelector } from "redux/hooks.ts"; +import ProText from "components/ProText.tsx"; +import { OrderType } from "pages/checkout/hooks/types.ts"; +import ProInputCard from "components/ProInputCard/ProInputCard.tsx"; +import { Segmented, Button } from "antd"; + +import DineInIcon from "./icons/dineIn.svg?react"; +import DeliveryIcon from "./icons/delivery.svg?react"; +import PickupIcon from "./icons/pickup.svg?react"; +import styles from "./OrderDetailsBottomSheet.module.css"; +import { GoogleMap } from "components/CustomBottomSheet/GoogleMap.tsx"; + +interface OrderDetailsBottomSheetProps { + isOpen: boolean; + onClose: () => void; +} + +export function OrderDetailsBottomSheet({ + isOpen, + onClose, +}: OrderDetailsBottomSheetProps) { + const { t } = useTranslation(); + const { orderType, location } = useAppSelector((state) => state.order); + + return ( + +
+ {/* Order Type */} + + , + }, + { + value: OrderType.Pickup, + label: t("orderTypes.pickup"), + icon: , + }, + { + value: OrderType.Delivery, + label: t("orderTypes.delivery"), + icon: , + }, + ]} + value={orderType} + size="small" + /> + + + {!location ? ( +
+ + {t("address.noLocationSelected")} + +
+ + {t("address.clickEditToSelect")} + +
+ ) : ( +
+ +
+ )} +
+ +
+ + {t("address.noLocationSelected")} + +
+ + {t("address.clickEditToSelect")} + +
+
+ +
+
+ ); +} diff --git a/src/pages/restaurant/page.tsx b/src/pages/restaurant/page.tsx index f5276ac..4fd1efd 100644 --- a/src/pages/restaurant/page.tsx +++ b/src/pages/restaurant/page.tsx @@ -11,7 +11,7 @@ import RestaurantServices from "./RestaurantServices"; // Import the Client Component for localStorage handling import Ads1 from "components/Ads/Ads1"; -import { OrderDetailsBottomSheet } from "components/CustomBottomSheet/OrderDetailsBottomSheet"; +import { OrderDetailsBottomSheet } from "components/CustomBottomSheet/orderDetailsSheet/OrderDetailsBottomSheet.tsx"; import { Loader } from "components/Loader/Loader"; import { CART_STORAGE_KEYS, @@ -45,9 +45,12 @@ export default function RestaurantPage() { (state) => state.order, ); const { isRTL } = useAppSelector((state) => state.locale); - const { data: restaurant, isLoading } = useGetRestaurantDetailsQuery(param.subdomain, { - skip: !param.subdomain, - }); + const { data: restaurant, isLoading } = useGetRestaurantDetailsQuery( + param.subdomain, + { + skip: !param.subdomain, + }, + ); const [isOrderDetailsOpen, setIsOrderDetailsOpen] = useState(false); const { containerRef, handleTouchEnd, handleTouchStart } = useSwipeUp({