cart: enhancements
This commit is contained in:
@@ -56,14 +56,14 @@ const ArabicPrice: React.FC<ArabicPriceProps> = ({
|
|||||||
>
|
>
|
||||||
{formattedPrice}
|
{formattedPrice}
|
||||||
</span>
|
</span>
|
||||||
<span style={{ margin: "0 2px" }} />
|
<span style={{ margin: "0 3px" }} />
|
||||||
<span
|
<span
|
||||||
style={{
|
style={{
|
||||||
fontSize: "14px",
|
fontSize: "14px",
|
||||||
verticalAlign: "baseline",
|
verticalAlign: "baseline",
|
||||||
lineHeight: 1,
|
lineHeight: 1,
|
||||||
position: "relative",
|
position: "relative",
|
||||||
top: -3,
|
top: -2,
|
||||||
...(decorationStyle ?? {}),
|
...(decorationStyle ?? {}),
|
||||||
...textStyle,
|
...textStyle,
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -22,23 +22,28 @@
|
|||||||
border-radius: 30px !important;
|
border-radius: 30px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.differentCardIcon{
|
.differentCardIcon {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 1px
|
top: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.eCardIcon {
|
.eCardIcon {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 3px;
|
top: 3px;
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:global(.ant-app-rtl) .eCardIcon {
|
||||||
|
margin-right: 0;
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
/* Make AntD checkbox look like a circular check indicator (scoped via CSS modules) */
|
/* Make AntD checkbox look like a circular check indicator (scoped via CSS modules) */
|
||||||
.circleCheckbox :global(.ant-checkbox-inner) {
|
.circleCheckbox :global(.ant-checkbox-inner) {
|
||||||
width: 24px;
|
width: 24px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
border-radius: 50% !important;
|
border-radius: 50% !important;
|
||||||
border: 1.5px solid #D5D8DA;
|
border: 1.5px solid #d5d8da;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,6 +64,11 @@
|
|||||||
top: 50%;
|
top: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:global(.ant-app-rtl) .circleCheckbox :global(.ant-checkbox-inner::after) {
|
||||||
|
left: auto;
|
||||||
|
right: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
.circleCheckbox :global(.ant-checkbox-checked .ant-checkbox-inner::after) {
|
.circleCheckbox :global(.ant-checkbox-checked .ant-checkbox-inner::after) {
|
||||||
width: 18px;
|
width: 18px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
@@ -68,12 +78,17 @@
|
|||||||
background: #ffb700;
|
background: #ffb700;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:global(.ant-app-rtl) .circleCheckbox :global(.ant-checkbox-checked .ant-checkbox-inner::after) {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: -9px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Apply same circular style to Radio buttons */
|
/* Apply same circular style to Radio buttons */
|
||||||
.circleCheckbox :global(.ant-radio-inner) {
|
.circleCheckbox :global(.ant-radio-inner) {
|
||||||
width: 24px;
|
width: 24px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
border-radius: 50% !important;
|
border-radius: 50% !important;
|
||||||
border: 1.5px solid #D5D8DA;
|
border: 1.5px solid #d5d8da;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,6 +108,11 @@
|
|||||||
top: 50%;
|
top: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:global(.ant-app-rtl) .circleCheckbox :global(.ant-radio-inner::after) {
|
||||||
|
left: auto;
|
||||||
|
right: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
.circleCheckbox :global(.ant-radio-checked .ant-radio-inner::after) {
|
.circleCheckbox :global(.ant-radio-checked .ant-radio-inner::after) {
|
||||||
width: 18px;
|
width: 18px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
@@ -102,3 +122,7 @@
|
|||||||
background: #ffb700;
|
background: #ffb700;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:global(.ant-app-rtl) .circleCheckbox :global(.ant-radio-checked .ant-radio-inner::after) {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: -9px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.cartItem {
|
.cartItem {
|
||||||
padding: 16px;
|
padding: 0 !important;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
.cartItems {
|
.cartItems {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 16px;
|
gap: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
@@ -606,3 +606,8 @@
|
|||||||
top: -7px;
|
top: -7px;
|
||||||
right: 5px;
|
right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:global(.ant-app-rtl) .editIcon {
|
||||||
|
right: auto;
|
||||||
|
left: 5px;
|
||||||
|
}
|
||||||
@@ -5,12 +5,12 @@ import ImageWithFallback from "components/ImageWithFallback";
|
|||||||
import ProHeader from "components/ProHeader/ProHeader.tsx";
|
import ProHeader from "components/ProHeader/ProHeader.tsx";
|
||||||
import ProText from "components/ProText.tsx";
|
import ProText from "components/ProText.tsx";
|
||||||
import ProTitle from "components/ProTitle.tsx";
|
import ProTitle from "components/ProTitle.tsx";
|
||||||
import { selectCart } from "features/order/orderSlice.ts";
|
import { clearCart, selectCart } from "features/order/orderSlice.ts";
|
||||||
import styles from "pages/cart/cart.module.css";
|
import styles from "pages/cart/cart.module.css";
|
||||||
import YouMightAlsoLike from "pages/cart/components/youMayLike/YouMightAlsoLike.tsx";
|
import YouMightAlsoLike from "pages/cart/components/youMayLike/YouMightAlsoLike.tsx";
|
||||||
import { Link, useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
|
|
||||||
import { useAppSelector } from "redux/hooks.ts";
|
import { useAppDispatch, useAppSelector } from "redux/hooks.ts";
|
||||||
|
|
||||||
import { FormInstance } from "antd";
|
import { FormInstance } from "antd";
|
||||||
import useBreakPoint from "hooks/useBreakPoint.ts";
|
import useBreakPoint from "hooks/useBreakPoint.ts";
|
||||||
@@ -40,7 +40,7 @@ export default function CartMobileTabletLayout({
|
|||||||
const { isMobile, isTablet } = useBreakPoint();
|
const { isMobile, isTablet } = useBreakPoint();
|
||||||
const getResponsiveClass = () => (isTablet ? "tablet" : "mobile");
|
const getResponsiveClass = () => (isTablet ? "tablet" : "mobile");
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
const getMenuItemImageStyle = () => {
|
const getMenuItemImageStyle = () => {
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
return {
|
return {
|
||||||
@@ -63,15 +63,14 @@ export default function CartMobileTabletLayout({
|
|||||||
<Space
|
<Space
|
||||||
orientation="vertical"
|
orientation="vertical"
|
||||||
size={isMobile ? "middle" : isTablet ? "large" : "large"}
|
size={isMobile ? "middle" : isTablet ? "large" : "large"}
|
||||||
style={{ width: "100%", gap: 16 }}
|
style={{ width: "100%", gap: 16, padding: 0 }}
|
||||||
>
|
>
|
||||||
{/* Table Number */}
|
{/* Table Number */}
|
||||||
{(orderType === OrderType.DineIn ||
|
{(orderType === OrderType.DineIn ||
|
||||||
orderType === OrderType.ToOffice) && <TableNumberCard />}
|
orderType === OrderType.ToOffice) && <TableNumberCard />}
|
||||||
|
|
||||||
<div className={`${styles.cartContent} ${getResponsiveClass()}`}>
|
<div className={`${styles.cartContent} ${getResponsiveClass()}`}>
|
||||||
<div className={styles.cartItems}>
|
<Card className={styles.cartItem}>
|
||||||
<Card hoverable className={styles.cartItem}>
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@@ -100,15 +99,6 @@ export default function CartMobileTabletLayout({
|
|||||||
</ProTitle>
|
</ProTitle>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Link
|
|
||||||
to={`/${subdomain}/menu?${
|
|
||||||
orderType ? `orderType=${orderType}` : ""
|
|
||||||
}`}
|
|
||||||
style={{
|
|
||||||
width: "100%",
|
|
||||||
textAlign: "end",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Button
|
<Button
|
||||||
shape="circle"
|
shape="circle"
|
||||||
iconPlacement="start"
|
iconPlacement="start"
|
||||||
@@ -126,8 +116,10 @@ export default function CartMobileTabletLayout({
|
|||||||
height: 32,
|
height: 32,
|
||||||
border: "1px solid #DEDEE0",
|
border: "1px solid #DEDEE0",
|
||||||
}}
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
dispatch(clearCart());
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</Link>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{items.length >= 1 && (
|
{items.length >= 1 && (
|
||||||
@@ -167,10 +159,8 @@ export default function CartMobileTabletLayout({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isRTL
|
{isRTL
|
||||||
? (item.variant as Variant)?.optionsAR?.[0]
|
? (item.variant as Variant)?.optionsAR?.[0]?.value
|
||||||
?.value
|
: (item.variant as Variant)?.options?.[0]?.value}
|
||||||
: (item.variant as Variant)?.options?.[0]
|
|
||||||
?.value}
|
|
||||||
</span>
|
</span>
|
||||||
</ProText>
|
</ProText>
|
||||||
<br />
|
<br />
|
||||||
@@ -246,16 +236,17 @@ export default function CartMobileTabletLayout({
|
|||||||
<Button
|
<Button
|
||||||
style={{ width: "100%", marginTop: 24, color: "#4C4A58" }}
|
style={{ width: "100%", marginTop: 24, color: "#4C4A58" }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
navigate(`/${subdomain}/menu?${
|
navigate(
|
||||||
|
`/${subdomain}/menu?${
|
||||||
orderType ? `orderType=${orderType}` : ""
|
orderType ? `orderType=${orderType}` : ""
|
||||||
}`);
|
}`,
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<PlusIcon dimesion="18" /> {t("cart.addMore")}
|
<PlusIcon dimesion="18" /> {t("cart.addMore")}
|
||||||
</Button>
|
</Button>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<YouMightAlsoLike />
|
<YouMightAlsoLike />
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { useAppSelector } from "redux/hooks";
|
|||||||
import { selectCart } from "features/order/orderSlice";
|
import { selectCart } from "features/order/orderSlice";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { useGetOrderDetailsQuery } from "redux/api/others";
|
import { useGetOrderDetailsQuery } from "redux/api/others";
|
||||||
|
import BackIcon from "components/Icons/BackIcon";
|
||||||
|
|
||||||
export default function BriefMenuCard() {
|
export default function BriefMenuCard() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -24,6 +25,7 @@ export default function BriefMenuCard() {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
const totalItems = items.length || orderDetails?.orderItems.length;
|
const totalItems = items.length || orderDetails?.orderItems.length;
|
||||||
|
const { isRTL } = useAppSelector((state) => state.locale);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -53,12 +55,18 @@ export default function BriefMenuCard() {
|
|||||||
cursor: "pointer",
|
cursor: "pointer",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span style={{ marginRight: 5, position: "relative", top: 3.5 }}>
|
<span
|
||||||
|
style={{
|
||||||
|
[isRTL ? "marginLeft" : "marginRight"]: 5,
|
||||||
|
position: "relative",
|
||||||
|
top: 3.5,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<InvoiceIcon />
|
<InvoiceIcon />
|
||||||
</span>
|
</span>
|
||||||
{t("checkout.viewOrder")} ( {totalItems} {t("cart.items")} )
|
{t("checkout.viewOrder")} ( {totalItems} {t("cart.items")} )
|
||||||
</ProText>
|
</ProText>
|
||||||
<NextIcon />
|
{isRTL ? <BackIcon /> : <NextIcon />}
|
||||||
</div>
|
</div>
|
||||||
</ProInputCard>
|
</ProInputCard>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user