update footer BS height & enhnace custom split bill BS styles

This commit is contained in:
2025-12-28 10:34:13 +03:00
parent b261f3508f
commit 85636630e3
18 changed files with 203 additions and 162 deletions

View File

@@ -287,7 +287,8 @@
"pleaseSelectPaymentMethod": "يرجى اختيار طريقة الدفع", "pleaseSelectPaymentMethod": "يرجى اختيار طريقة الدفع",
"pleaseEnterPhoneNumber": "يرجى إدخال رقم الهاتف", "pleaseEnterPhoneNumber": "يرجى إدخال رقم الهاتف",
"viewOrder": "عرض الطلب", "viewOrder": "عرض الطلب",
"itemsSummary": "ملخص العناصر" "itemsSummary": "ملخص العناصر",
"removeSplitBill": "إزالة التقسيم"
}, },
"address": { "address": {
"title": "العنوان", "title": "العنوان",
@@ -436,7 +437,7 @@
"yourAmount": "مبلغك", "yourAmount": "مبلغك",
"selectedTotal": "المجموع المحدد", "selectedTotal": "المجموع المحدد",
"splitBillAmount": "مبلغ تقسيم الفاتورة", "splitBillAmount": "مبلغ تقسيم الفاتورة",
"removeSplit": زالة التقسيم", "cancelSplit": لغاء التقسيم",
"amount": "المبلغ", "amount": "المبلغ",
"howMuchWouldYouLikeToPay": "كم مبلغ تريد دفعه؟", "howMuchWouldYouLikeToPay": "كم مبلغ تريد دفعه؟",
"confirm": "تأكيد", "confirm": "تأكيد",
@@ -447,6 +448,7 @@
"payWithQR": "دفع باستخدام الكود الباري", "payWithQR": "دفع باستخدام الكود الباري",
"cancel": "إلغاء", "cancel": "إلغاء",
"done": "تم", "done": "تم",
"inviteEveryonePayingWithYou": "دع الجميع يدفعوا معك" "inviteEveryonePayingWithYou": "دع الجميع يدفعوا معك",
"includesAllOfTaxesCharges": "يشمل جميع الضرائب والرسوم"
} }
} }

View File

@@ -297,7 +297,8 @@
"pleaseSelectPaymentMethod": "Please select payment method", "pleaseSelectPaymentMethod": "Please select payment method",
"pleaseEnterPhoneNumber": "Please enter phone number", "pleaseEnterPhoneNumber": "Please enter phone number",
"viewOrder": "View Order", "viewOrder": "View Order",
"itemsSummary": "Items Summary" "itemsSummary": "Items Summary",
"removeSplitBill": "Remove Split Bill"
}, },
"address": { "address": {
"title": "Address", "title": "Address",
@@ -448,7 +449,7 @@
"yourAmount": "Your Amount", "yourAmount": "Your Amount",
"selectedTotal": "Selected Total", "selectedTotal": "Selected Total",
"splitBillAmount": "Split Bill Amount", "splitBillAmount": "Split Bill Amount",
"removeSplit": "Remove Split", "cancelSplit": "Cancel Split",
"amount": "Amount", "amount": "Amount",
"howMuchWouldYouLikeToPay": "How much would you like to pay?", "howMuchWouldYouLikeToPay": "How much would you like to pay?",
"confirm": "Confirm", "confirm": "Confirm",
@@ -459,6 +460,7 @@
"payWithQR": "Pay with QR", "payWithQR": "Pay with QR",
"cancel": "Cancel", "cancel": "Cancel",
"done": "Done", "done": "Done",
"inviteEveryonePayingWithYou": "Invite everyone paying with you" "inviteEveryonePayingWithYou": "Invite everyone paying with you",
"includesAllOfTaxesCharges": "includes all of taxes charges"
} }
} }

View File

@@ -9,6 +9,7 @@ interface ArabicPriceProps {
type?: "secondary" | "success" | "warning" | "danger"; type?: "secondary" | "success" | "warning" | "danger";
className?: string; className?: string;
hideCurrency?: boolean; hideCurrency?: boolean;
textStyle?: React.CSSProperties;
} }
const ArabicPrice: React.FC<ArabicPriceProps> = ({ const ArabicPrice: React.FC<ArabicPriceProps> = ({
@@ -18,6 +19,7 @@ const ArabicPrice: React.FC<ArabicPriceProps> = ({
type, type,
className, className,
hideCurrency = false, hideCurrency = false,
textStyle = {},
}) => { }) => {
const { isRTL } = useAppSelector((state) => state.locale); const { isRTL } = useAppSelector((state) => state.locale);
const { restaurant } = useAppSelector((state) => state.order); const { restaurant } = useAppSelector((state) => state.order);
@@ -49,6 +51,7 @@ const ArabicPrice: React.FC<ArabicPriceProps> = ({
lineHeight: 1, lineHeight: 1,
fontSize: "14px", fontSize: "14px",
...(decorationStyle ?? {}), ...(decorationStyle ?? {}),
...textStyle,
}} }}
> >
{formattedPrice} {formattedPrice}
@@ -62,6 +65,7 @@ const ArabicPrice: React.FC<ArabicPriceProps> = ({
position: "relative", position: "relative",
top: -3, top: -3,
...(decorationStyle ?? {}), ...(decorationStyle ?? {}),
...textStyle,
}} }}
> >
{isRTL ? restaurant.local_currency : restaurant.global_currency} {isRTL ? restaurant.local_currency : restaurant.global_currency}
@@ -76,6 +80,7 @@ const ArabicPrice: React.FC<ArabicPriceProps> = ({
display: "inline-block", display: "inline-block",
fontSize: "14px", fontSize: "14px",
...(decorationStyle ?? {}), ...(decorationStyle ?? {}),
...textStyle,
}} }}
> >
{formattedPrice} {formattedPrice}
@@ -88,13 +93,16 @@ const ArabicPrice: React.FC<ArabicPriceProps> = ({
lineHeight: 1, lineHeight: 1,
display: "inline-block", display: "inline-block",
...(decorationStyle ?? {}), ...(decorationStyle ?? {}),
...textStyle,
}} }}
> >
{isRTL ? restaurant.local_currency : restaurant.global_currency} {isRTL ? restaurant.local_currency : restaurant.global_currency}
</span> </span>
</> </>
) : ( ) : (
<span style={decorationStyle}>{formattedPrice}</span> <span style={{ ...decorationStyle, ...textStyle }}>
{formattedPrice}
</span>
)} )}
</ProText> </ProText>
); );

View File

@@ -122,7 +122,7 @@ export function CancelOrderBottomSheet() {
> >
<Button <Button
type="primary" type="primary"
style={{ width: "100%", height: 50, color: "#FFF" }} style={{ width: "100%", height: 48, color: "#FFF" }}
onClick={handleKeepOrder} onClick={handleKeepOrder}
> >
{t("order.keepOrder")} {t("order.keepOrder")}
@@ -132,7 +132,7 @@ export function CancelOrderBottomSheet() {
type="primary" type="primary"
style={{ style={{
width: "100%", width: "100%",
height: 50, height: 48,
color: "#ea1f22", color: "#ea1f22",
borderColor: "#ea1f22", borderColor: "#ea1f22",
backgroundColor: "#fff", backgroundColor: "#fff",

View File

@@ -277,7 +277,7 @@ export default function DatePickerBottomSheet({
<Button <Button
type="primary" type="primary"
style={{ width: "100%", height: 50, marginTop: 10 }} style={{ width: "100%", height: 48, marginTop: 10 }}
onClick={handleConfirm} onClick={handleConfirm}
> >
{t("common.confirm")} {t("common.confirm")}

View File

@@ -50,7 +50,7 @@ export function InfoButtonSheet({
<ProText type="secondary" style={{textAlign:"center"}}>{description}</ProText> <ProText type="secondary" style={{textAlign:"center"}}>{description}</ProText>
</div> </div>
<br /> <br />
<Button type="primary" style={{ width: "100%", boxShadow: "none" }} onClick={handleSave}> <Button type="primary" style={{ width: "100%", boxShadow: "none", height: 48 }} onClick={handleSave}>
{t("address.gotIt")} {t("address.gotIt")}
</Button> </Button>
</ProBottomSheet> </ProBottomSheet>

View File

@@ -62,5 +62,5 @@
.actionButton { .actionButton {
flex: 1; flex: 1;
height: 50px; height: 48px;
} }

View File

@@ -205,7 +205,7 @@ export function OpeningTimesBottomSheet({
</div> </div>
<Button <Button
type="primary" type="primary"
style={{ width: "100%", height: 50 }} style={{ width: "100%", height: 48 }}
onClick={onClose} onClick={onClose}
> >
{t("menu.close")} {t("menu.close")}

View File

@@ -231,7 +231,7 @@ export function RateBottomSheet() {
type="primary" type="primary"
style={{ style={{
width: "100%", width: "100%",
height: 50, height: 48,
color: colors.primary, color: colors.primary,
borderColor: colors.primary, borderColor: colors.primary,
backgroundColor: "#fff", backgroundColor: "#fff",

View File

@@ -70,7 +70,7 @@ export function TipBottomSheet({
<Button <Button
type="primary" type="primary"
style={{ width: "100%", height: 50 }} style={{ width: "100%", height: 48 }}
onClick={handleSave} onClick={handleSave}
> >
{t("cart.addTip")} {t("cart.addTip")}

View File

@@ -0,0 +1,20 @@
import { InputNumber, InputNumberProps } from "antd";
export const ProInputNumber = (props: InputNumberProps) => {
return (
<InputNumber
style={{
fontFamily: "Outfit",
fontWeight: 400,
fontStyle: "Regular",
fontSize: 12,
lineHeight: "140%",
letterSpacing: "0%",
height: 48,
width: "100%",
}}
min={"0"}
{...props}
/>
);
};

View File

@@ -213,7 +213,9 @@ export function ProBottomSheet({
bottom: 0, bottom: 0,
height: snapPoints[currentSnap] || height, height: snapPoints[currentSnap] || height,
backgroundColor: backgroundColor:
themeName === "dark" ? darkColors.bgColor : lightColors.bgColor, themeName === "dark"
? darkColors.secondaryBgColor
: lightColors.secondaryBgColor,
borderTopLeftRadius: 20, borderTopLeftRadius: 20,
borderTopRightRadius: 20, borderTopRightRadius: 20,
boxShadow: boxShadow:
@@ -259,7 +261,9 @@ export function ProBottomSheet({
overflow: "auto", overflow: "auto",
padding: "0 20px", padding: "0 20px",
backgroundColor: backgroundColor:
themeName === "dark" ? darkColors.bgColor : lightColors.bgColor, themeName === "dark"
? darkColors.secondaryBgColor
: lightColors.secondaryBgColor,
color: themeName === "dark" ? "#ffffff" : "#000000", color: themeName === "dark" ? "#ffffff" : "#000000",
...contentStyle, ...contentStyle,
}; };

View File

@@ -74,7 +74,8 @@ interface CartState {
totalServices: number; totalServices: number;
hiddenServices: number; hiddenServices: number;
visibleServices: number; visibleServices: number;
} fee: number;
}
// localStorage keys // localStorage keys
export const CART_STORAGE_KEYS = { export const CART_STORAGE_KEYS = {
@@ -198,6 +199,7 @@ const initialState: CartState = {
totalServices: 8, totalServices: 8,
hiddenServices: 0, hiddenServices: 0,
visibleServices: 0, visibleServices: 0,
fee: 0,
}; };
const orderSlice = createSlice({ const orderSlice = createSlice({
@@ -209,6 +211,7 @@ const orderSlice = createSlice({
}, },
updateRestaurant(state, action: PayloadAction<Partial<RestaurantDetails>>) { updateRestaurant(state, action: PayloadAction<Partial<RestaurantDetails>>) {
state.restaurant = action.payload; state.restaurant = action.payload;
state.fee = Number(action.payload.delivery_fees || 0);
state.visibleServices = [ state.visibleServices = [
action.payload.dineIn, action.payload.dineIn,
action.payload.delivery, action.payload.delivery,

View File

@@ -55,7 +55,7 @@ export function BottomSheet({
<br /> <br />
<Button type="primary" style={{ width: "100%" }} onClick={handleSave}> <Button type="primary" style={{ width: "100%", height: 48 }} onClick={handleSave}>
{t("cart.save")} {t("cart.save")}
</Button> </Button>
</div> </div>

View File

@@ -44,17 +44,6 @@ export default function CheckoutButton({ form }: { form: FormInstance }) {
dispatch(updateSplitBillAmount(0)); dispatch(updateSplitBillAmount(0));
}, [dispatch]); }, [dispatch]);
const getSplitButtonTitle = useMemo(() => {
if (selectedSplitWay === "customAmount") {
return t("splitBill.payAsCustomAmount");
} else if (selectedSplitWay === "equality") {
return t("splitBill.divideTheBillEqually");
} else if (selectedSplitWay === "payForItems") {
return t("splitBill.payForYourItems");
}
return t("checkout.splitBill");
}, [selectedSplitWay, t]);
const handlePlaceOrderClick = useCallback(async () => { const handlePlaceOrderClick = useCallback(async () => {
try { try {
await form.validateFields(); await form.validateFields();
@@ -77,7 +66,9 @@ export default function CheckoutButton({ form }: { form: FormInstance }) {
className={styles.splitBillButton} className={styles.splitBillButton}
onClick={handleSplitBillClick} onClick={handleSplitBillClick}
> >
{getSplitButtonTitle} {selectedSplitWay
? t("checkout.removeSplitBill")
: t("checkout.splitBill")}
</Button> </Button>
)} )}
@@ -90,7 +81,7 @@ export default function CheckoutButton({ form }: { form: FormInstance }) {
{t("checkout.placeOrder")} {t("checkout.placeOrder")}
</Button> </Button>
</Layout.Footer> </Layout.Footer>
<SplitBillChoiceBottomSheet <SplitBillChoiceBottomSheet
isOpen={isSplitBillChoiceBottomSheetOpen} isOpen={isSplitBillChoiceBottomSheetOpen}
onClose={() => setIsSplitBillChoiceBottomSheetOpen(false)} onClose={() => setIsSplitBillChoiceBottomSheetOpen(false)}

View File

@@ -1,4 +1,4 @@
import { Button, Form, InputNumber } from "antd"; import { Button, Form } from "antd";
import { ProBottomSheet } from "components/ProBottomSheet/ProBottomSheet.tsx"; import { ProBottomSheet } from "components/ProBottomSheet/ProBottomSheet.tsx";
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -12,6 +12,7 @@ import { useAppDispatch, useAppSelector } from "redux/hooks";
import ProText from "components/ProText"; import ProText from "components/ProText";
import ArabicPrice from "components/ArabicPrice"; import ArabicPrice from "components/ArabicPrice";
import styles from "./SplitBill.module.css"; import styles from "./SplitBill.module.css";
import { ProInputNumber } from "components/Inputs/ProInputNumber";
interface SplitBillChoiceBottomSheetProps { interface SplitBillChoiceBottomSheetProps {
isOpen: boolean; isOpen: boolean;
@@ -26,7 +27,7 @@ export function CustomAmountChoiceBottomSheet({
}: SplitBillChoiceBottomSheetProps) { }: SplitBillChoiceBottomSheetProps) {
const { t } = useTranslation(); const { t } = useTranslation();
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const { splitBillAmount } = useAppSelector(selectCart); const { splitBillAmount, fee } = useAppSelector(selectCart);
const grandTotal = useAppSelector(selectGrandTotal); const grandTotal = useAppSelector(selectGrandTotal);
const [amount, setAmount] = useState<string>( const [amount, setAmount] = useState<string>(
splitBillAmount > 0 ? splitBillAmount.toString() : "", splitBillAmount > 0 ? splitBillAmount.toString() : "",
@@ -57,137 +58,145 @@ export function CustomAmountChoiceBottomSheet({
// Preview: total bill stays the same, remaining = original - current amount being typed // Preview: total bill stays the same, remaining = original - current amount being typed
const previewTotalBill = originalTotalBill; const previewTotalBill = originalTotalBill;
const previewRemaining = originalTotalBill - currentAmount; const previewRemaining = originalTotalBill - currentAmount;
const taxesChargesStyle = {
fontWeight: 400,
fontStyle: "Regular",
fontSize: 12,
lineHeight: "140%",
letterSpacing: "0%",
color: "#777580",
};
return ( return (
<ProBottomSheet <ProBottomSheet
isOpen={isOpen} isOpen={isOpen}
onClose={onClose} onClose={onClose}
title={t("splitBill.payAsCustomAmount")} title={t("splitBill.payAsCustomAmount")}
showCloseButton={true} showCloseButton={true}
initialSnap={1} initialSnap={1}
height={430} height={425}
snapPoints={[430]} snapPoints={[425]}
contentStyle={{ contentStyle={{
padding: 0, padding: 0,
}}
>
<div
style={{
padding: "20px",
display: "flex",
flexDirection: "column",
gap: 20,
}} }}
> >
<div <div style={{ display: "flex", flexDirection: "column", gap: 5 }}>
style={{ <ProText
padding: "20px",
display: "flex",
flexDirection: "column",
gap: 20,
}}
>
<div>
<ProText
style={{
fontWeight: 400,
fontStyle: "Regular",
fontSize: 16,
lineHeight: "140%",
letterSpacing: "0%",
}}
>
{t("splitBill.howMuchWouldYouLikeToPay")}
</ProText>
<Form.Item
label={t("splitBill.amount")}
name="amount"
style={{ position: "relative", top: -5 }}
>
<InputNumber
value={amount}
onChange={(value) => {
setAmount(value?.toString() || "");
dispatch(updateSplitBillAmount(Number(value) || 0));
}}
placeholder={t("splitBill.amount")}
max={(grandTotal + splitBillAmount).toString()}
min={"0"}
style={{ width: "100%", fontSize: "1rem" }}
/>
</Form.Item>
</div>
</div>
<div
style={{
display: "flex",
flexDirection: "column",
backgroundColor: "var(--background)",
padding: "20px",
opacity: 1,
gap: 8,
borderTopLeftRadius: 24,
borderTopRightRadius: 24,
paddingTop: 12,
paddingRight: 24,
paddingBottom: 24,
paddingLeft: 24,
}}
>
<div className={styles.summaryRow}>
<ProText
style={{
fontWeight: 400,
fontStyle: "Regular",
fontSize: 14,
lineHeight: "140%",
letterSpacing: "0%",
}}
>
{t("splitBill.totalBill")}
</ProText>
<ArabicPrice price={previewTotalBill} />
</div>
<div className={styles.summaryRow}>
<ProText
style={{
fontWeight: 400,
fontStyle: "Regular",
fontSize: 14,
lineHeight: "140%",
letterSpacing: "0%",
}}
>
{t("splitBill.remainingToPay")}
</ProText>
<ArabicPrice price={Math.max(0, previewRemaining)} />
</div>
</div>
<div
style={{
display: "flex",
gap: 12,
margin: 20,
}}
>
<Button
style={{ style={{
flex: 1, fontWeight: 400,
backgroundColor: "#FEEDED", fontStyle: "Regular",
color: "#DD4143", fontSize: 16,
boxShadow: "none", lineHeight: "140%",
border: "none", letterSpacing: "0%",
}} }}
onClick={handleRemoveSplitWay}
> >
{t("splitBill.removeSplit")} {t("splitBill.howMuchWouldYouLikeToPay")}
</Button> </ProText>
<Button <Form.Item name="amount">
type="primary" <ProInputNumber
style={{ value={amount}
flex: 1, onChange={(value) => {
boxShadow: "none", setAmount(value?.toString() || "");
}} dispatch(updateSplitBillAmount(Number(value) || 0));
onClick={handleSave} }}
disabled={!amount || parseFloat(amount) <= 0} placeholder={t("splitBill.amount")}
> max={(grandTotal + splitBillAmount).toString()}
{t("splitBill.confirm")} />
</Button> </Form.Item>
</div> </div>
</ProBottomSheet> </div>
<div
style={{
display: "flex",
flexDirection: "column",
backgroundColor: "var(--background)",
padding: "20px",
opacity: 1,
gap: 8,
borderTopLeftRadius: 24,
borderTopRightRadius: 24,
paddingTop: 12,
paddingRight: 24,
paddingBottom: 24,
paddingLeft: 24,
}}
>
<div className={styles.summaryRow}>
<ProText style={taxesChargesStyle}>
{t("splitBill.totalBill")}
</ProText>
<ArabicPrice price={previewTotalBill} textStyle={taxesChargesStyle} />
</div>
<div className={styles.summaryRow}>
<ProText style={taxesChargesStyle}>
{t("splitBill.serviceFee")}
</ProText>
<ArabicPrice price={fee} textStyle={taxesChargesStyle} />
</div>
<div className={styles.summaryRow}>
<ProText
style={{
fontWeight: 400,
fontStyle: "Regular",
fontSize: 14,
lineHeight: "140%",
letterSpacing: "0%",
}}
>
{t("splitBill.remainingToPay")}
</ProText>
<ArabicPrice
price={Math.max(0, previewRemaining)}
textStyle={taxesChargesStyle}
/>
</div>
<ProText style={taxesChargesStyle}>
{t("splitBill.includesAllOfTaxesCharges")}
</ProText>
</div>
<div
style={{
display: "flex",
gap: 12,
margin: 20,
}}
>
<Button
style={{
flex: 1,
backgroundColor: "#FEEDED",
color: "#DD4143",
boxShadow: "none",
border: "none",
height: 48,
}}
onClick={handleRemoveSplitWay}
>
{t("splitBill.cancelSplit")}
</Button>
<Button
type="primary"
style={{
flex: 1,
boxShadow: "none",
height: 48,
}}
onClick={handleSave}
disabled={!amount || parseFloat(amount) <= 0}
>
{t("splitBill.confirm")}
</Button>
</div>
</ProBottomSheet>
); );
} }

View File

@@ -325,14 +325,15 @@ export function EqualltyChoiceBottomSheet({
color: "#DD4143", color: "#DD4143",
boxShadow: "none", boxShadow: "none",
border: "none", border: "none",
height: 48,
}} }}
onClick={handleRemoveSplitWay} onClick={handleRemoveSplitWay}
> >
{t("splitBill.removeSplit")} {t("splitBill.cancelSplit")}
</Button> </Button>
<Button <Button
type="primary" type="primary"
style={{ flex: 1, boxShadow: "none" }} style={{ flex: 1, boxShadow: "none", height: 48 }}
onClick={handleSave} onClick={handleSave}
> >
{t("cart.save")} {t("cart.save")}

View File

@@ -205,14 +205,15 @@ export function PayForYourItemsChoiceBottomSheet({
color: "#DD4143", color: "#DD4143",
boxShadow: "none", boxShadow: "none",
border: "none", border: "none",
height: 48,
}} }}
onClick={handleRemoveSplitWay} onClick={handleRemoveSplitWay}
> >
{t("splitBill.removeSplit")} {t("splitBill.cancelSplit")}
</Button> </Button>
<Button <Button
type="primary" type="primary"
style={{ flex: 1, boxShadow: "none" }} style={{ flex: 1, boxShadow: "none", height: 48 }}
onClick={handleSave} onClick={handleSave}
disabled={selectedTotal === 0} disabled={selectedTotal === 0}
> >