From c369807f40bd7a3b374fa5940d5738fda6ffe801 Mon Sep 17 00:00:00 2001 From: Mohammed Al-yaseen Date: Wed, 17 Dec 2025 01:04:45 +0300 Subject: [PATCH] CustomAmountChoiceBottomSheet: update UI --- src/assets/locals/ar.json | 8 +- src/assets/locals/en.json | 8 +- .../ProBottomSheet/ProBottomSheet.tsx | 7 +- .../CustomAmountChoiceBottomSheet.tsx | 161 +++++++++++++----- .../PayForYourItemsChoiceBottomSheet.tsx | 13 +- .../components/splitBill/SplitBill.module.css | 7 + 6 files changed, 157 insertions(+), 47 deletions(-) diff --git a/src/assets/locals/ar.json b/src/assets/locals/ar.json index a415d12..2e91ab6 100644 --- a/src/assets/locals/ar.json +++ b/src/assets/locals/ar.json @@ -425,7 +425,11 @@ "yourAmount": "مبلغك", "selectedTotal": "المجموع المحدد", "splitBillAmount": "مبلغ تقسيم الفاتورة", - "removeSplitWay": "إزالة طريقة التقسيم", - "amount": "المبلغ" + "removeSplit": "إزالة التقسيم", + "amount": "المبلغ", + "howMuchWouldYouLikeToPay": "كم مبلغ تريد دفعه؟", + "confirm": "تأكيد", + "totalBill": "الفاتورة الكلية", + "remainingToPay": "المبلغ المتبقي" } } diff --git a/src/assets/locals/en.json b/src/assets/locals/en.json index 158ffd4..739c623 100644 --- a/src/assets/locals/en.json +++ b/src/assets/locals/en.json @@ -437,7 +437,11 @@ "yourAmount": "Your Amount", "selectedTotal": "Selected Total", "splitBillAmount": "Split Bill Amount", - "removeSplitWay": "Remove Split Way", - "amount": "Amount" + "removeSplit": "Remove Split", + "amount": "Amount", + "howMuchWouldYouLikeToPay": "How much would you like to pay?", + "confirm": "Confirm", + "totalBill": "Total Bill", + "remainingToPay": "Remaining to Pay" } } diff --git a/src/components/ProBottomSheet/ProBottomSheet.tsx b/src/components/ProBottomSheet/ProBottomSheet.tsx index e3ca922..029e5ae 100644 --- a/src/components/ProBottomSheet/ProBottomSheet.tsx +++ b/src/components/ProBottomSheet/ProBottomSheet.tsx @@ -16,6 +16,7 @@ interface ProBottomSheetProps { initialSnap?: number; className?: string; themeName?: "light" | "dark"; + contentStyle?: React.CSSProperties; } export function ProBottomSheet({ @@ -30,6 +31,7 @@ export function ProBottomSheet({ snapPoints = [500], initialSnap = 0, className = "", + contentStyle = {}, }: ProBottomSheetProps) { const [currentSnap, setCurrentSnap] = useState(initialSnap); const [isDragging, setIsDragging] = useState(false); @@ -231,12 +233,13 @@ export function ProBottomSheet({ backdropFilter: themeName === "dark" ? "blur(8px)" : "none", }; - const contentStyle: React.CSSProperties = { + const contentWrapperStyle: React.CSSProperties = { flex: 1, overflow: "auto", padding: "0 20px", backgroundColor: themeName === "dark" ? "#0a0a0a" : "#ffffff", color: themeName === "dark" ? "#ffffff" : "#000000", + ...contentStyle, }; const closeButtonStyle: React.CSSProperties = { @@ -315,7 +318,7 @@ export function ProBottomSheet({ )} -
{children}
+
{children}
); diff --git a/src/pages/pay/components/splitBill/CustomAmountChoiceBottomSheet.tsx b/src/pages/pay/components/splitBill/CustomAmountChoiceBottomSheet.tsx index abbe736..963588a 100644 --- a/src/pages/pay/components/splitBill/CustomAmountChoiceBottomSheet.tsx +++ b/src/pages/pay/components/splitBill/CustomAmountChoiceBottomSheet.tsx @@ -9,7 +9,9 @@ import { updateSplitBillAmount, } from "features/order/orderSlice"; import { useAppDispatch, useAppSelector } from "redux/hooks"; -import ProInputCard from "components/ProInputCard/ProInputCard"; +import ProText from "components/ProText"; +import ArabicPrice from "components/ArabicPrice"; +import styles from "./SplitBill.module.css"; interface SplitBillChoiceBottomSheetProps { isOpen: boolean; @@ -50,6 +52,14 @@ export function CustomAmountChoiceBottomSheet({ onClose(); }; + // Calculate preview values using local amount state for real-time updates + const currentAmount = parseFloat(amount) || 0; + // Original total bill (before split) = grandTotal + splitBillAmount (from Redux) + const originalTotalBill = grandTotal + splitBillAmount; + // Preview: total bill stays the same, remaining = original - current amount being typed + const previewTotalBill = originalTotalBill; + const previewRemaining = originalTotalBill - currentAmount; + return (
- - - setAmount(value?.toString() || "")} - placeholder={t("splitBill.amount")} - max={grandTotal.toString()} - min={"0"} - style={{ width: "100%", fontSize:"1rem" }} - /> - - -
- -
- - + {t("splitBill.howMuchWouldYouLikeToPay")} + + + { + setAmount(value?.toString() || ""); + dispatch(updateSplitBillAmount(Number(value) || 0)); + }} + placeholder={t("splitBill.amount")} + max={(grandTotal + splitBillAmount).toString()} + min={"0"} + style={{ width: "100%", fontSize: "1rem" }} + /> +
+ +
+
+ + {t("splitBill.totalBill")} + + +
+
+ + {t("splitBill.remainingToPay")} + + +
+
+ +
+ + +
); } diff --git a/src/pages/pay/components/splitBill/PayForYourItemsChoiceBottomSheet.tsx b/src/pages/pay/components/splitBill/PayForYourItemsChoiceBottomSheet.tsx index 2ba3b33..36f3e8b 100644 --- a/src/pages/pay/components/splitBill/PayForYourItemsChoiceBottomSheet.tsx +++ b/src/pages/pay/components/splitBill/PayForYourItemsChoiceBottomSheet.tsx @@ -192,8 +192,17 @@ export function PayForYourItemsChoiceBottomSheet({ marginTop: 20, }} > -